Overnight In The S&P 500 – Oddis Bands (Amibroker And Tradestation Code)
The strategy in plain English:
- Calculate a 50 day average of the (High minus Low). That is the “ATR”.
- Calculate the high of the last 10 days.
- Calculate the (C-L)/(H-L) ratio every day (IBS).
- Calculate a band 2.5 times below the 10 day high using the average from point number 1 (ATR). Ie, subtracting number 1 (2.5 times) from number 2.
- If SPY closes below the band in number 4, and point 3 has a lower value than 0.5, go long at the close and exit on tomorrow’s open.
Click here for the original article.
Amibroker code:
setOption(“holdminbars”,1);
ibs=(C-L)/(H-L) ;
range=MA((H-L),50);
OddisHigh=HHV(H,10);
OddisBand=OddisHigh – (range*3);
Buy= Close<OddisBand AND ibs<0.5;
buyPrice= C;
Sell= C>0;
sellPrice= O ;
Tradestation code:
{
Overnight In The S&P 500 - Oddis Bands (Strategy 52)
Calculate a 50 day average of the (High minus Low). That is the “ATR” or Range.
Calculate the high of the last 10 days.
Calculate the (C-L)/(H-L) ratio every day (IBS).
Calculate a band 2.5 times below the 10 day high using the average from point number 1 (ATR). Ie, subtracting number 1 (2.5 times) from number 2.
If SPY closes below the band in number 4, and point 3 has a lower value than 0.5, go long at the close and exit on tomorrow’s open.
}
Inputs:
RangeLookback(50),
RangleMultiple(2.5),
OddisHighLookback(10),
IbsTreshold(0.5);
Vars:
Ibs(0),
Rng(0),
OddisHigh(0),
OddisBand(0);
Ibs = (Close - Low) / (High - Low);
Rng = Average(High - Low, RangeLookback);
OddisHigh = Highest(High, OddisHighLookback);
OddisBand = OddisHigh - Rng * RangleMultiple;
if Close < OddisBand and Ibs < IbsTreshold Then
begin
Buy this bar on close;
Sell next bar on open;
end;
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.
