New 5 Day Low In SPY And Closes In The Low of The Range (Amibroker And Tradestation Code)

The strategy in plain English:

  1. The IBS must be lower than 0.25.
  2. The close must be lower than the lowest the previous 5 days.
  3. If those two simple criteria are met, go long at the close.
  4. The exit is at the close 5 days later.

Click here for the original article.

Amibroker code:

setOption(“holdminbars”,1);

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

Buy= Close < Ref(LLV(L,5),-1) AND ibs<0.25 ;

buyPrice= Close;

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

sellPrice= Close ;

You might also try this extra exit:

ApplyStop(stopTypeNBar,stopModeBars,5,1);

Tradestation code:

{
New 5 Day Low In SPY And Closes In The Low of The Range (Strategy 49)
The IBS must be lower than 0.25.
The close must be lower than the lowest the previous 5 days.
If those two simple criteria are met, go long at the close.
The exit is at the close 5 days later.
}

Inputs:
    LowLookback(5),
    BuyTreshold(0.25);
	
Vars:
	ibs(0),
	llv(0);

ibs = (C-L)/(H-L);
llv = Lowest(Low, LowLookback);

if ibs < BuyTreshold and Close < llv[1] Then
	Buy this bar at close;
	
if Close > High[1] 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.