Fading The Opening Gap

Discussion in 'Trading' started by larrybf, Jan 7, 2002.

  1. Fading the opening gap on the emini nasdaq futures contract has seemed to work well for using on a limited basis. Before I commit to larger size (multiple contracts) for this strategy I was wondering whether anyone has backtested this strategyon a long term basis in both bull and bear periods?( i.e.-1998-2001)
  2. Hi

    I will try it give me exact entry and exit rules then i can make the test.
  3. dozu888


    try these rules:

    if Opening >= yesterday's close * (102%)
    record the hi/lo of the first 5 minutes;
    if after 5 minutes price makes new low, go short, set stop at the 5min hi, and set target at yesterday's close;
    after 10minutes (or 15 or whatever), close the trade no matter what;

    Reverse for gap downs. try different percentages as 2% gap up is kinda rare..... I doube you will see any significant edge, without filtering, such as how many days it has run up, increasing the possibility of an exhaustion gap etc. just use NQ or ES data, instead of individual stocks.

    but give it a try and let us know the results. Have fun.
  4. lassiter


    When you post the results of your test would you please include the average return to risk ratio.
    When employing a similar strategy on Nasdaq stocks I have found that the range of the first 5 minute candle is typically so great it drops the R:R to nearly one.

    Fading an opening gap up
    Enter short: when prices take out the low of the first 5 minute candle.
    Stop: is placed just above the high of the first 5-minute candle
    Target: The price which fills the opening gap
    (you can reverse the above for a gap down)

    I look forward to your post.

    Thank you.
  5. When it is extreme or at support or resistance. Emotional up or down openings almost always have a reaction.

    Gaps not of an extreme nature often have follow-up in the direction of the gap.

    Whichever it is, wait for the trigger, then pounce.
  6. WarEagle

    WarEagle Moderator

    Hi guys,

    I was a little reluctant to post this, because on the surface it seems pretty good, lol. But since I've gained a lot from this board, I decided to do it. I have only done some preliminary testing, but the results so far are good considering how little this system is in the market. Its basically the same idea that dozu suggested, and it proves the point that a simple system is best. It is optimized, but is profitable over a wide range of settings for both of the inputs (that's right, only two). I have not done any walk forward testing with it, so it might fall apart starting tomorrow, who knows. It definitely needs more work to make sure its robust.

    The rules are simple. If the Naz futures gap up or down by .6% (six tenths of a percent) then enter the opposite way with an exit at a profit target equal to the gap or after 15 bars (I used 5 minute bars), whichever comes first. There is no stoploss other than the time limit, although you could add one easy enough, but generally the results aren't as good.

    The test results are on the full contract (from 10/97 to 8/01), because that is the only continuous contract that I had several years of data for. The contract is back adjusted, so take that for what its worth. To get the results on the mini, just divide everything by 5. I like e-mini systems with an average trade (after slippage and commission) of over $100, and this one has that. I deducted $50 in slippage ($10 on the mini) and $10 in commissions per side. It doesn't trade every day of course, and with an average trade of $100 you either need to trade size, build slowly, or incorporate it with other systems.

    On a rolling monthly basis, the Sharpe ratio fluctuates between 1.5 and 2.5 over 12 months, so there is some variability of returns. I know some won't trade a system with less than a Sharpe of 2. However, it looks to average around 2 which is decent, though not jaw dropping.

    Here is the TradeStation report:

    Total Net Profit $133,780.00
    Open position P/L $0.00
    Gross Profit $383,610.00
    Gross Loss ($249,830.00)

    Total # of trades 245
    Percent profitable 62.04%
    Number winning trades 152
    Number losing trades 93

    Largest winning trade $14,440.00
    Largest losing trade ($9,560.00)
    Average winning trade $2,523.75
    Average losing trade ($2,686.34)
    Ratio avg win/avg loss .94
    Avg trade (win & loss) $546.04

    Max consec. Winners 7
    Max consec. losers 4
    Avg # bars in winners 9
    Avg # bars in losers 15

    Max intraday drawdown ($33,470.00)
    Profit Factor 1.54
    Max # contracts held 1
    Account size required $53,470.00
    Return on account 250.20%

    Here is the code for anyone with TS:

    {Fade the Gap}
    {Tested using 5 minute bars}

    Vars: gap(0),

    Inputs: stopLoss(9999),

    If time = 0935 then begin {Must be the first bar of the day to measure for gap, you will need to change this depending on your time zone}

    gap = AbsValue((Close of 1 bar ago) - Open); {This measures the gap to create a profit target}

    If gap >= (Close of 1 bar ago)*gapPercent and Open > High of 1 bar ago then sellGap = true;

    If gap >= (Close of 1 bar ago)*gapPercent and Open < Low of 1 bar ago then buyGap = true;

    If sellGap = true then sell 1 contract next bar at low on a stop;

    If buyGap = true then buy 1 contract next bar at high on a stop;


    If MarketPosition <> 0 then begin

    SetProfitTarget(gap * BigPointValue); {Exit if gap is filled}

    {SetStopLoss(stopLoss);} {If you want a stoploss, just remove the brackets and change the input}

    If BarsSinceEntry >= inactiveStop then begin {Exits if in trade more than x number of bars}



    sellGap = false; {reset the variables}

    buyGap = false;

    {End of code}

    So there it is. Nothing fancy, and maybe nothing good...I will have to play around with it some more to make sure it holds up. If anyone is able to improve on it then please post it here. I hope this might at least be educational for those interested in building systems.

    I am also adding a picture of the equity curve for anyone who is interested.

    Good trading,

  7. nitro


    In order to get this to work with TS 6, you need to comment out the lines as below and replace with the code to the right.

    {ExitLong; } Sell Next Bar On Open;
    {ExitShort; } BuyToCover Next Bar On Open;

    I used the next bar so that one does not fall into the trap of using "this" bar analisys inadvertently to read the "future."

  8. WarEagle

    WarEagle Moderator

    Thanks nitro,

    I should have included the TS6 version too (why did they have to change it anyway :)?).

    In TS6 they make you specify "next bar", but in 2000i, it executes the same way, but is not required in the syntax. I like the old way better, but I guess they think the new way is easier to understand for someone new to EasyLanguage.