Algorithmic Trading Tips 06.

PROFIT FROM GAP TRADING.

A SYSTEMATIC TRADING STRATEGY. SIMPLE, BUT EFFECTIVE.

Ever wanted to test a simple gap strategy? Sometimes the simplest of strategies can reveal startling results. We show you here how to apply a gap trading strategy to a portfolio of stocks or watch list. It’s very easy, yet powerful.

FIG. 1: EQUITY-CURVE.

Of particular importance is the equity curve. A steadily rising stream of profit. Here comes the Equilla code to do just this:

if​​ open​​ of​​ tomorrow​​ >​​ high

then short next bar​​ at​​ market;

// short if overnight gap up.

cover​​ ("Gap closed")​​ next bar​​ at​​ high​​ limit;

// cover if gap closed

The strategy is designed to keep things simple. It is works best if run on daily data and it enters a short trade if there has been an up-gap overnight. (open tomorrow > high today). The trade is closed if the gap is closed.

As with most strategies this may be applied to a portfolio or watch list. Here I have a selection of stocks from the FTSE 100 to find good opportunities for trading the gaps.

FIG. 2: MARKET SCANNER.

To do the same in reverse (that is go long, if we get a down gap) we just add again reversing the direction like so:

if​​ open​​ of​​ tomorrow​​ >​​ high

then short next bar​​ at​​ market;

// short if overnight gap up.

cover​​ ("Gap closed")​​ next bar​​ at​​ high​​ limit;

// cover if gap closed

 

if​​ open​​ of​​ tomorrow <​​ low

then buy next bar​​ at​​ market;

// long if overnight gap down.

sell​​ ("Gap closed")​​ next bar​​ at​​ low​​ limit;

// sell if gap closed

If the gap is not closed during the day a second strategy can provide the emergency exit and closes the trade at the end of the day.

This is the code I would use for my end of day exit:

exitposition this bar​​ on​​ close;