Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 05:05:05 +0000



[Programming Help] - how to log a vriable?

View Count: 530

[2021-02-23 18:20:29]
User61576 - Posts: 418
I am trying to inherit a study by using the example of scsf_TradingSystemStudySubgraphCrossover
and trying to know if I am getting the correct data
so I wanted to log the
SCFloatArray StudyLine1;
I read this sc.AddMessageToLog() and checked the examples of scsf_ButtonAndMenuAndPointerExample
but non the less, when compiling the following code:
SCString MessageText;
MessageText = StudyLine1;
sc.AddMessageToLog(MessageText, 0);

I got errors:
t.cpp: In function 'void scsf_TradingSystemStudySubgraphCrossover(SCStudyInterfaceRef)':
t.cpp:140:16: error: no match for 'operator=' (operand types are 'SCString' and 'SCFloatArray' {aka 'c_ArrayWrapper<float>'})
140 | MessageText = StudyLine1;
| ^~~~~~~~~~
In file included from scstructures.h:105,
from sierrachart.h:22,
from rotation_v5_test.cpp:5:
SCString.h:331:18: note: candidate: 'SCString& SCString::operator=(const SCString&)'
331 | inline SCString& SCString::operator = (const SCString& Rhs)

Any idea what I m doing wrong here?
[2021-02-23 19:43:07]
bradh - Posts: 854
You are trying to convert a SCFloatArray to SCString.
[2021-02-23 19:53:22]
User61576 - Posts: 418
I guessed so but I couldn't find in the documentation who to do it.

what will be the correct way to log a SCFloatArray ?
[2021-02-23 20:19:38]
bradh - Posts: 854
You access the float array values one at a time.

Use sc.Index
SCFloatArray StudyLine1;
sc.GetStudyArrayUsingID(Input_Line1Ref.GetStudyID(), Input_Line1Ref.GetSubgraphIndex(), StudyLine1);
float Var = StudyLine1[sc.Index];
SCString MessageText;
MessageText.Format("Var = %f", var);
sc.AddMessageToLog(MessageText, 0);

Date Time Of Last Edit: 2021-02-23 20:26:08

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account