1 registered members (AndrewAMD),
1,089
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Handle LookBack exceeded
[Re: AndrewAMD]
#486016
05/28/22 20:08
05/28/22 20:08
|
Joined: Feb 2017
Posts: 1,729 Chicago
AndrewAMD
OP
Serious User
|
OP
Serious User
Joined: Feb 2017
Posts: 1,729
Chicago
|
So it looks like series length is determined during INITRUN but not allocated until FIRSTRUN: https://zorro-project.com/manual/en/series.htmSince the LookBack value is normally only known after the INITRUN, series are allocated in the FIRSTRUN. During the INITRUN they are set to a temporary pointer and filled with the initial value. This temporary content is overwritten by the series allocation in the FIRSTRUN. Plus my tests seem to confirm that quit "+" allows me to change series length without issue. This is nice! One more thing: there's a bug in this sample code from the manual: https://zorro-project.com/manual/en/lookback.htm// restart script when lookback period is exceededvoid run(){
LookBack = max(30,LookBackNeeded); ...
SMA(seriesC(),50); // need more than 30 bars!
if(!Init && LookBack < LookBackNeeded)
return quit("+Restart with new LookBack"); ...} quit(+) gets skipped because this can only be detected in Init. So more like this: if(Init && LookBack < LookBackNeeded)
|
|
|
|