I am attempting to test which rank actually performs best in my monthly rotational strategy. The position score will default to the highest score or "best rank" so to speak. I can optimize worst rank held but that does not accomplish the goal. I want to compare the rank selections individually .
My goal is to run an optimization showing the performance of the system in a 5 year period where it tests each rank separately. So the fist line would show the back test selecting rank 1 every month, the second line would show the system selecting rank 2 every month all the way down to 504 since I am testing on the S&P.
Here is the code for the optimization of worst rank held which does work but it is not what I am trying to accomplish.
SetBacktestMode( backtestRotational );
SetPositionSize( 99.5, spsPercentOfEquity );
Score= (ROC(Close, 1) +ROC(Close, 3) +ROC(Close,6))/3 ;
PositionScore = Score;
variable = Optimize("WorstRankHeld",1 , 1, 504, 1 );
SetOption("WorstRankHeld", variable ); // YOU HAVE TO USE the variable!Z