Biotech Trading Strategy (Amibroker And Tradestation Code)

You find the original article here.

The strategy in plain English:

  • The IBS indicator is lower than 0.1.
  • The 5-day RSI indicator is below 35.
  • If both 1 and 2 are correct, then buy XBI at the close.
  • Sell at the close when today’s IBS is above 0.75

Amibroker code:

ibs=(C-L)/(H-L)  ;
Buy=ibs<0.1 AND RSI(5)<35 ;  
buyprice=Close;
Sell=ibs>0.75 ;
sellPrice=Close;

Tradestation code:

{
Biotech strategy (no 136):
The IBS indicator is lower than 0.1. 
The 5-day RSI indicator is below 35.
If both 1 and 2 are correct, then buy XBI at the close.
Sell at the close when today's IBS is above 0.75
}

Inputs:
	RsiLength(5),
	RsiTreshold(35),
	IbsBuyTreshold(0.1),
	IbsSellTreshold(0.75);
	
Vars:
	ibs(0);

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

if (ibs < IbsBuyTreshold) and (RSI(C,RsiLength)<RsiTreshold) Then
	buy this bar at close;

if ibs > IbsSellTreshold then 
	Sell this bar at close;