Rotational Backtesting - holding periods

I am trying to perform rotational backtesting. I want the holdings to change at the end of every week instead of monthly. How can I code the weekly time rotation?

thanks in advance,

SetBacktestMode( backtestRotational );

LastDay = IIf( (Month() == Ref( Month(), 1) AND (Month() != Ref( Month(), 2)) ), 1, 0);
aROC = ROC(Close, 30); 
SetOption("WorstRankHeld", 5);
PositionScore = IIf(lastday, aROC, scoreNoRotate);
rotationDay = DayOfWeek() == 5; // Historical or Live (no rotations for weeks where Friday is a non-trading day)

Or

rotationDay = Nz(TimeFrameExpand(1, inWeekly, expandPoint)); // Historical only (rotates on the last trading day of the week)
2 Likes

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.