Intraday Gap Up and Gap Down – Amibroker Strategy

Before getting into the strategy just wanna tell you that amibroker supports two in built functions gapup() and gapdown() to identify gap up and gap down openings.

GapUp() – this inbuilt function Returns ‘1’ or ‘true’ on the day a security opens gap up. Rest of the days it returns Zero.

GapDown() – this inbuilt function Returns ‘1’ or ‘true’ on the day a security opens gap down. Rest of the days it returns Zero.

Based on this two functions one can easily create a Simple Gapup and Gapdown Strategies.

Strategy Rules

Strategy is very simple. when the market open with gap up and at the same time ,it crossed the previous day high then it should be considered as strong buy. When the market open with gap down and while opening if it crosses yesterday low then it should be considered as strong short.

stoploss setting

1)Target % parameter Control is given to the user. so user can set the target as required. Default value is 1%

2)Stop loss logic in the AFL code is not added however you can set the stop loss nearly 0.3% in the bactesting settings as shown below. 0.3% if Static stoploss is the minimum risk

3)Tested the strategy with different stocks and its success ratio in between 50 to 60 %

4)On an average you will get the signal 2-4 times in month .

5)Exploration is also added to scan the stocks which meet above requirement

Preferred Timeframe : 5min charts.

One can experiment with high beta stock.The beauty of the system is stop loss is only 0.3 % which is very less .

Sample report for Bank Nifty for the last 4 years with 4 lots of Bank Nifty taken at every trade with Rs100/Lot Commisions +Slippages included.
Backtest Report

Download Gap-Up Gap-Down Amibroker AFL Code

Related Readings and Observations

  • Things You Need to Know About VWAP In finance terms, volume-weighted average price (VWAP) is defined as the ratio of the value traded to total volume traded over a particular time horizon (usually one day). It is a measure […]
  • Rotation Factor – Amibroker AFL Code Rotation Factor is a sentimental indicator used in Market Profile to Indicate who is control (Buyers/Sellers) in the market for the day. If the rotational factor prints positive values […]
  • Full Gap Open Range Strategy – Amibroker AFL Code Here is a simple Full Gap Open Range Strategy for intraday traders to trade the big gap ups and gap downs using open range breakout. And more important strategy is back-testable.
  • How to Compute Cointegration using Amibroker and Python Cointegration is used in Statistical Arbitrage to find best Pair of Stocks (Pair Trading) to go long in one stock and short(Competitive peers) another to generate returns. Statistical […]


  1. bapu jadhav says

    i am bapu jadhav i like it to amibrokar softwaer i parchase use your softwaer how can i you parchase softwaeer

  2. Rajesh R says

    Hi Dinesh,

    Can we have an EOD Gap Up & Gap Down analysis, since in our office we do not get access to stock market sites and also we cannot install Amibroker software in our official computers.

    Can you please do the needful.

    Thanks in Advance

    Rajesh R

  3. STOCKSTOPP says

    Where do we enter and exit, and is it intraday?
    Have u tried this on higher timeframe?
    Thank you

  4. Dinesh says

    As I clearly mentioned,at day open when the Gap up /Down happens and at the same time the price should crosses yesterdays high /low. at that time we need to take position .
    As per my analysis higher time frame is not suitable for the strategy

  5. STOCKSTOPP says

    so basically,
    let market open with gap up
    watch out for price to cross yesterday’s high
    enter in long trade
    book profit at user defined target in intraday itself?
    In less time high returns, sounds cool.

  6. prachi says

    your afl is scanning stocks which opened gap up above previous days range and its giving buy signals.I think following two are better strategies compared to what you have done:-
    1. security open gap up above previous day range, initiate sell when it goes below previous days high.
    2. Security opens gap up with in previous days range, initiate buy when it crossed above previous days high.

    vice versa for gap down.
    I also need a help.I need scanner for rsi double top(Mr Rajan vyas might have requested). If you can design it , then it will be very helpful.


Leave a Reply

Your email address will not be published. Required fields are marked *