Gap Trading Strategies (How To Trade Gaps With Real And Quantified Examples)
The strategy in plain English:
This is a daytrading strategy and requires a bit more complicated code in Amibroker. Anyway, here is the strategy in plain English:
- Today’s open must be lower than 0.15% but higher than 0.7%.
- Today’s open must be higher than yesterday’s 25 day moving average of the last 25 days (on daily bars).
- If 1 and 2 are correct, then buy today’s open.
- Sell if the 5-minute bar’s close is above yesterday’s closing price, otherwise sell at 1500 Chicago time.
The article of the strategy can be found by click here.
Amibroker code:
Traded at 5-mute bars:
SetOption(“initialEquity”,100000);
SetPositionSize(99.75*leverage,spsPercentOfEquity);
setOption(“MaxOpenPositions”,1);
setOption(“holdminbars”,1);
SetTradeDelays( 0, 0, 0, 0 );
TimeFrameSet(inDaily);
AvgGap=MA( abs( (O-ref(C,-1))/Ref(C,-1) ),25);
Averages=MA(Close,25);
TimeFrameRestore();
AvgGap1=Ref(TimeFrameExpand(AvgGap,inDaily),-1);
Averages1=Ref(TimeFrameExpand(Averages,inDaily),-1);
dailyOpen = TimeFrameGetPrice(“O”, inDaily,0);
dailyPrevClose = TimeFrameGetPrice(“C”, inDaily, -1);
gapDiff = dailyOpen / dailyPrevClose – 1;
//************************Strategy************************************
Buy= gapdiff<-.0015 AND gapdiff>-0.007 AND TimeNum()==083000 AND Open>averages1 ;
BuyPrice=Open;
sell= TimeNum()>=145500 OR ( Close>TimeFrameGetPrice(“C”, inDaily, -1) ) ;
SellPrice=Close ;
Tradestation code:
Not done yet, coming soon
Disclaimer: 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.
