Login Page - Create Account

Support Board


Date/Time: Wed, 07 May 2025 14:49:23 +0000



ACSIL: Using subgraph values for NewOrder.Stop1Price, float vs double error

View Count: 220

[2024-11-25 07:23:51]
User745789 - Posts: 377
I am a beginner ACSIL user, but come a long way in 2 days.

I have this

//Declare variables to hold the array of values from the stoploss line studies
  SCFloatArray SLlongRef;
  SCFloatArray SLshortRef;

Then in other lines of code not shown here, I successfully populate these arrays with the study subgraph values that I want to use as stoploss prices. Using msg I have confirmed this works in the message log with some debug text.

Then I experimented with this to use these array values as attached stop loss prices:

//Attach SL - using study
    NewOrder.AttachedOrderStop1Type = SCT_ORDERTYPE_STOP;
    NewOrder.Stop1Price = SLlongRef;
    NewOrder.Stop1Price_2 = SLshortRef;

But I get a compiler error:

SCFloatArray {aka c_ArrayWrapper<float>}
ORB_simple.cpp:77:27: error: cannot convert 'SCFloatArray' {aka 'c_ArrayWrapper<float>'} to 'double' in assignment

Which Seems to tell me that "NewOrder.Stop1Price" is a Double not a Float?

How do I solve this?

Please excuse incorrect use of terminology.
Date Time Of Last Edit: 2024-11-25 07:24:43
[2024-11-25 12:26:46]
emmanuel - Posts: 62
NewOrder.Stop1Price is a double, but you can assign a float value to it without issues. The problem is that SCFloatArray is an array of floats, not a float. You need to decide which of the array values you want to use. For example, the code below will use the current value in SLlongRef:

NewOrder.Stop1Price = SLlongRef[sc.Index];

However, you may want to use the value from the prior bar:

NewOrder.Stop1Price = SLlongRef[sc.Index - 1];

[2024-11-26 00:15:30]
User745789 - Posts: 377
Perfect, thank you. And your explanation was educational, thanks again.

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

Login

Login Page - Create Account