{"id":1365,"date":"2016-04-17T21:59:24","date_gmt":"2016-04-17T20:59:24","guid":{"rendered":"http:\/\/www.amibroker.com\/kb\/?p=1365"},"modified":"2016-04-21T22:00:22","modified_gmt":"2016-04-21T21:00:22","slug":"long-only-rotational-back-test","status":"publish","type":"post","link":"https:\/\/www.amibroker.com\/wordpress\/kb\/2016\/04\/17\/long-only-rotational-back-test\/","title":{"rendered":"Long-only rotational back-test"},"content":{"rendered":"
Rotational trading is a kind of backtest where you trade by switching positions between various symbols based on their relative score instead of traditional buy\/sell\/short\/cover signals. <\/p>
Since there are no signals used, only PositionScore assigned to given symbol matters.<\/p>
It is worth noting that in case of rotational test, the Positions<\/strong> field in General tab of the Analysis settings is ignored. It is only used for regular backtests that use actual buy\/sell\/short\/cover signals.<\/p> In the rotational mode the trades are driven by values of PositionScore variable alone. <\/p> In particular:<\/p> As you can see the SIGN<\/strong> of PositionScore variable decides whenever it is long or short.<\/p> Therefore – if we want to test long-only system in rotational backtesting mode, then we should use only positive values in PositionScore variable. For example – if we are trading a system, which uses 252-bar rate of change for scoring purposes: <\/p> Then, to trade only long positions, we should change PositionScore defintion for example to:<\/p> This way our scores will remain positive and that will effectively disable short trades.<\/p>SetBacktestMode<\/span>( <\/span>backtestRotational <\/span>);
<\/span>SetOption<\/span>(<\/span>"MaxOpenPositions"<\/span>,<\/span>5<\/span>);
<\/span>SetOption<\/span>(<\/span>"WorstRankHeld"<\/span>,<\/span>5<\/span>);
<\/span>SetPositionSize<\/span>( <\/span>20<\/span>, <\/span>spsPercentOfEquity <\/span>);
<\/span>PositionScore <\/span>= <\/span>ROC<\/span>( <\/span>Close<\/span>, <\/span>252 <\/span>)<\/code>PositionScore <\/span>= <\/span>1000 <\/span>+ <\/span>ROC<\/span>( <\/span>Close<\/span>, <\/span>252 <\/span>); <\/span>\/\/ make sure it is positive by adding big constan<\/code>