Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 23:29:47 +0000



[Programming Help] - calculate mean of rolling max value

View Count: 235

[2023-06-20 07:17:37]
ronvle - Posts: 4
hi all, I'm newbie to Sierra and wanted to learn ASCIL. I have a strategy coded in Python but wanted to convert to ASCIL, having a problem with the code below where I'm trying to calculate the mean of the rolling max of the last 20 ATR values, but meanMaxATR[sc.Index] is always 0.00, any help is appreciated!



  SCFloatArray meanMaxATR;
  SCFloatArray ATRHigh;
sc.ATR(sc.BaseDataIn, SG_ATR, 20, MOVAVGTYPE_SIMPLE);
ATRHigh[sc.Index] = sc.GetHighest(SG_ATR, 20);
sc.SimpleMovAvg(ATRHigh,meanMaxATR,20);
  
  msg.Format("avgMaxATR=%f, highATR=%f, currentATR=%f",meanMaxATR[sc.Index],ATRHigh[sc.Index],SG_ATR[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