Login Page - Create Account

Support Board


Date/Time: Mon, 24 Feb 2025 15:29:13 +0000



[User Discussion] - plotting a condition on chart

View Count: 437

[2021-03-15 20:13:38]
User61576 - Posts: 445
I am trying to call another study and to plot on the chart a simple condition using this code


SCFloatArray P_R_Upper_Band; //Upper Band
  sc.GetStudyArrayUsingID(Input_LIne1_Poly_Reg.GetStudyID(), Input_LIne1_Poly_Reg.GetSubgraphIndex(), P_R_Upper_Band);

  SCFloatArray P_R_Lower_Band;//Lower Band
  sc.GetStudyArrayUsingID(Input_LIne2_Poly_Reg.GetStudyID(), Input_LIne2_Poly_Reg.GetSubgraphIndex(), P_R_Lower_Band);
  
  float PRUB = P_R_Upper_Band[sc.Index];
  float PRLB = P_R_Lower_Band[sc.Index];

  if (
    // make sure the price is < = lower band
    sc.Low[sc.Index] <= P_R_Lower_Band
    )
  {
    // mark the signal on the chart
    Subgraph_P_R_BuyEntry[sc.Index] = sc.Low[sc.Index];

  }

when compiling I am getting this error:

error: no match for 'operator<=' (operand types are 'float' and 'SCFloatArray' {aka 'c_ArrayWrapper<float>'})

any advice here on how to solve this?
thanks
[2021-03-15 21:38:55]
ForgivingComputers.com - Posts: 1012
sc.Low[sc.Index] <= P_R_Lower_Band

The right side needs an array index.

I think you want this instead:

sc.Low[sc.Index] <= PRLB

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

Login

Login Page - Create Account