Login Page - Create Account

Support Board


Date/Time: Tue, 26 Nov 2024 17:45:59 +0000



[Programming Help] - problem acsil fonction GetStudyArrayFromChartUsingID

View Count: 220

[2023-11-03 10:48:56]
stephane1 - Posts: 111
Hi there,

I am trying to recover the value of the ATR on a daily chart and use it on a DOM chart study. This program does not work, it returns me the value 0... it's curious but I can only recover the values d of the study applied to the DOM... however I think that the function used allowed the values ​​to be used on other charts and studies.
#include "sierrachart.h"
SCDLLName("TestSizeCalculatorOrder")
SCSFExport scsf_TestAdjustPositionSizeByATR(SCStudyInterfaceRef sc)

{
  // loggin object
  SCString msg;
  
  // inputs
  SCInputRef i_ATR=sc.Input[0];
  


    if (sc.SetDefaults)
    {
     sc.GraphName= "Size calculator Order by ATR";
     sc.GraphRegion=1;
     i_ATR.Name="Selectionne ATR study";
     i_ATR.SetChartStudySubgraphValues(1,1,0);

      return;
    }
    // Declare variable to hold the array of values from the study
    
    SCFloatArray ATRRef ;
    
    // pass these in by reference to populate these array with study values
    sc.GetStudyArrayFromChartUsingID(i_ATR.GetChartStudySubgraphValues(),ATRRef);
    
  
    
  
    
   if (sc.Index==sc.ArraySize-1){
    //msg.Format("ATR=%f,Max loss=%f,Adjused Position Size=%d, Account=%f",atrValue,maxLoss,adjustedPositionSize, AccountValue);
      msg.Format("ATR=%f",ATRRef[sc.Index]);
      sc.AddMessageToLog(msg, 1);
    }
  
    
    

}

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

Login

Login Page - Create Account