A Simple Pair Trade In Liquid ETFs (Amibroker Code)

The strategy in plain English:

 

The strategy uses the following ETFs: EEM, EWJ, SPY, EWG, and EWU.

The original strategy goes long the ETF with today’s lowest IBS and goes short the one with the highest IBS (the above 5 ETFs being the “portfolio”).

The code below is not completely similar to the one on the website. The difference is that the code doesn’t always go short, only when the IBS reading is very high (above 0.75). We found this to yield better results.

However, this code can be used on both daily and weekly data and is short about 14% of the time while keeping just one long position any time based on the IBS.

 

Click here for the original article.

 

Amibroker code:

 

ibs= (Close-Low) / (High – Low );

setOption(“holdminbars”,1);

 

SetBacktestMode( backtestRotational );

SetOption(“initialequity”,100000);

SetOption(“MaxOpenPositions”,1);

SetOption(“WorstRankHeld”,1);

SetPositionSize( 99.9, spsPercentOfEquity );

PositionScore = 0.75 – ibs ;

 

 

Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.