Internal Bar Strength In Consumer Staples (XLP)

Last Updated on June 11, 2021 by Oddmund Groette

The internal bar strength is defined as follows: (close-low)/(high-low).

Here is the strategy tested on the ETF XLP which tracks the major consumer staples:

  • Yesterday’s IBS must be lower than 0.15.
  • Today’s IBS must be lower than 0.4.
  • RSI(5) today must be lower than 50.
  • Entry on the close.
  • Exit when today’s close is higher than yesterday’s high.

Here is the equity curve:

2008 was actually by far the best year:

And here are all the trade details:

When testing for optimization there is a clear pattern that it’s best with a low IBS yesterday and a bit higher today. Here is the code for Amibroker:

SetOption(“initialequity”,50000);
//SetPositionSize(700,spsShares);
SetOption(“commissionMode”,3);
SetOption(“commissionAmount”,0.02);

ibs=(C-L)/(H-L);
oddis=Optimize(“ibs1”,0.15,0.1,0.5,0.05);
oddis1=Optimize(“ibs2”,0.4,0.1,0.5,0.05);
Buy= ibs<oddis AND Ref(ibs,-1)<oddis1
AND
RSI(5)<50;
BuyPrice=Close;
Sell=C>Ref(High,-1);
SellPrice=Close;

Of course, the annual return is pretty low, but that is because the strategy spends most of the time on the sidelines. The strategy spends about 505 days in the market over this period, only around 16% of the trading days.

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