http://www.amibroker.com/kb/2016/04/17/long-only-rotational-back-test/
Set the AA window to backtest on monthly periodicity,
then something like this will be getting close.
SetBacktestMode( backtestRotational );
SetOption("MaxOpenPositions",5);
SetOption("WorstRankHeld",5);
SetPositionSize( 20, spsPercentOfEquity );
PositionScore = ROC( Close, 3); // highest 3 month ROC
You'll want to run this on say ASX50, not across the whole market. afaik, you can't specify turnover as a condition in rotational trading.
thank you very much for your answer.
What does SetPosistionSize(20,spsPercentOfEquity) do?
this is my code - could you reread it?
_SECTION_BEGIN("TTTT");
SetTradeDelays (0,0,0,0);
SetBacktestMode(backtestRotational);
SetOption("UsePrevBarEquityForPosSizing", True); // use previous bar opening equity to perform position sizing
SetOption("MinShares", 1); // minimum number of shares required to open the position in the backtester
SetOption("AllowPositionShrinking", True);
SetOption("AccountMargin",100); // Gewinnmarge 100 = keine Begrenzung
MaxOpenPositions = 5;
SetOption("WorstRankHeld", MaxOpenPositions ); // worst rank of symbol to be held in trading mode
SetOption("MaxOpenPositions", MaxOpenPositions);
SetOption("SeparateLongShortRank", True );
SetOption("MaxOpenLong", 5); // 5 beste Aktien raussuchen
SetOption("MaxOpenPositions",5);
newMonth = Month() != Ref(Month(), -1);
Nmonths = 3;
rotate = newMonth AND Cum(newmonth) % Nmonths==0;
perf = TimeFrameGetPrice("O", inMonthly, -1); // get monthly Open price 1 month ago
perf1 = TimeFrameGetPrice("O", inMonthly, -2); // get monthly Open price 2 month ago
score= 100*((perf- perf1)/perf1) + 100;
PositionSize = -100/MaxOpenPositions;
PositionScore = IIf(rotate,PositionScore,scoreNoRotate);
// scoreNoRotate = already open trades should be kept and no new trades entered