Internal Bar Strength In Consumer Staples (XLP) (Amibroker And Tradestation Code)

The strategy in plain English:

 

  1. Yesterday’s IBS must be lower than 0.15.
  2. Today’s IBS must be lower than 0.4.
  3. RSI(5) today must be lower than 50.
  4. If 1-3 is true, enter at the close.
  5. Exit at the close when today’s close is higher than yesterday’s high.

 

Click here for the original article.

 

Amibroker code:

 

setOption(“holdminbars”,1);

ibs=(C-L)/(H-L) ;

Buy=Ref(ibs,-1)<0.15 AND ibs<0.4 AND RSI(5)<50 ;

buyPrice= Close;

Sell= C>ref(H,-1) ;

sellPrice= Close ;

 

Tradestation code:

 

If (IFF((H-L)<>0,((C-L))/(H-L),1)) < 0.4 And
(IFF((H-L)<>0,((C-L))/(H-L),1))[1] < 0.15 And
RSI(c,5)<50
then buy this bar at c;
If c>h[1] then Sell this bar at c;

 

 

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.