Login Page - Create Account

Support Board


Date/Time: Thu, 28 Nov 2024 01:27:18 +0000



Post From: calculate mean of rolling max value

[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);