Positional Trading Strategy (Amibroker Code)

The original article can be found here.

Logic in plain English:

  • It’s based on monthly quotes in the ETFs SPY, TLT, EFA, and EEM.
  • Every month we rank all four ETFs based on last month’s performance/momentum.
  • We go long the one ETF with the best performance the prior month (it doesn’t matter if negative or positive return).
  • Hold for one month and rinse and repeat (or continue being long the same instrument).

Amibroker code:

setOption("holdminbars",1);

Leverage=1.0 ;
SetOption("accountmargin",100/leverage);
setPositionSize(99.75*leverage,spsPercentOfEquity);
SetBacktestMode( backtestRotational );
SetOption("initialequity",100000);
//SetOption("commissionMode",1);
//SetOption("commissionAmount",0.1);
SetOption("MaxOpenPositions",1);
SetOption("WorstRankHeld",1);

PositionScore = 1000 +ROC(C,1) ;