Gap Down Strategy In Stocks – Going Long (Amibroker And Tradestation Code)
The strategy in plain English:
The strategy works well on the S&P 500, but has few fills. To get more fills, test it on stocks, for example, S&P 100 components. Entry is done intraday.
Click here for the original article.
Amibroker code:
Buy= Ref(O,-1)<Ref(L,-2) AND Ref(V,-1)<Ref(MA(V,50),-2) AND L<O – ( Ref(range,-1)*0.75 ) AND Open<Ref(Close,-1);
buyPrice= O – ( Ref(range,-1)*0.75 );
Sell= C>MA(C,10) ;
sellPrice= Close ;
Tradestation code:
{
Gap Down Strategy In Stocks - Going Long (strategy 23_ENTRY)
It is not possible to combine next bar's open price and on close order in the same Strategy (Error #30215).
For this reason this strategy defines entry rule only.
To backtest properly add the both 23_ENTRY and 23_EXIT strategies to the list and then run backtest.
}
Inputs:
RangeLookback(25),
VolumeLookback(50),
Treshold(0.75);
Vars:
Rang(0),
VolumeAvg(0);
Rang = Average(H-L, RangeLookback);
VolumeAvg = Average(Volume, VolumeLookback);
if Open < Low[1] and Volume < VolumeAvg[1] and Open next bar < Close Then
buy next bar at Open next bar - Rang * Treshold limit;
{
Gap Down Strategy In Stocks - Going Long (strategy 23_EXIT)
It is not possible to combine next bar's open price and on close order in the same Strategy (Error #30215).
For this reason this strategy defines exit rule only.
To backtest properly add the both 23_ENTRY and 23_EXIT strategies to the list and then run backtest.
}
Inputs:
Lookback(10);
if Close > Average(Close, Lookback) then
sell this bar on 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.
