Hi everyone,
Hope all is well! I wanted to ask the community to see if we can get some other possible ideas to optimize this piece of code by removing the fold statement:
Any suggestions or workarounds are welcome
Hope all is well! I wanted to ask the community to see if we can get some other possible ideas to optimize this piece of code by removing the fold statement:
Code:
def bn = barnumber();
def v = volume;
def isRTH = GetTime() >= RegularTradingStart(GetYYYYMMDD()) and GetTime() < RegularTradingEnd(GetYYYYMMDD());
def cnt = if bn==1 then 1 else if isRTH then cnt[1] + 1 else 0;
def cntx = HighestAll(cnt);
# solve without fold
def Sum = fold index = 1 to TimeBasedNumDays + 1 with a = 0 do a + GetValue(v, index * cntx);
Any suggestions or workarounds are welcome