The internal Bar Strength Indicator On The S&P 500 (Amibroker And Tradestation Code)

The strategy in plain English:

The Internal Bar Strength is an effective indicator in mean-revertive assets, like stock indices, for example. We test the following:

  1. Calculate the IBS each day: (close-low)/(high-low).
  2. If the close has an IBS reading below 0.2, go long at the close.
  3. Sell at the close when the IBS ends higher than 0.8.

Click here to see the original article.

Amibroker code:

IBS: (Close-Low)/(High-Low) ;

Buy= IBS<0.2 ;

buyPrice=C ; //buy on the close

Sell= IBS>0.8 ;

sellPrice=C ; //sell on the close

Tradestation code:

{
The internal Bar Strength Indicator On The S&P 500 (Strategy 71)
Calculate the IBS each day: (close-low)/(high-low).
If the close has an IBS reading below 0.2, go long at the close.
Sell at the close when the IBS ends higher than 0.8.
}

Inputs:
	IbsBuyTreshold(0.2),
	IbsSellTreshold(0.8);
	
Vars:
	ibs(0);

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

if ibs < IbsBuyTreshold Then
	buy this bar at close;

if ibs > IbsSellTreshold then 
	Sell this bar at close;

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.