Paul

Gap trading Catcher

Category: Strategies By: Paul Created: September 14, 2017, 10:16 AM
September 14, 2017, 10:16 AM
Strategies
18 Comments
Gap trading Catcher

Hi, I modified prorealtime gapdetection indicator to a simple strategy basis for a long position.

Only 1 or 2  parameters and it gives interesting results with a simple stop of 1% for intraday or for daily a stop of 3%

the parameter has very small range i.e. 1-14 to optimise.

some stock/futures 5 min with 50.000 units backtest

p=1 unilever 81.89 % profitable with win/loss 1.8 in 497 trades.

p=1 tkh 71.67 % profitable with win/loss 1.54 473 trades

p=1 heineken 82,46% profitable with win/loss 1.48 496 trades

p=5 aex 5 min 84.44% profitable with win/loss 1.65 270 trades

Have a look and maybe it’s interesting enough to dig further !

//Strategy: GapCatcherLong

DEFPARAM CUMULATEORDERS = false
DEFPARAM PRELOADBARS = 1000
//DEFPARAM FLATBEFORE = 100000
//DEFPARAM FLATAFTER = 200000

//lasttime = 235900
//begintime = 000000
//endtime = 210000

Amplitude = 0
Detector = 0

p=5

// buy criteria
if close < dclose(p) then
 if (abs((high-low[1]) / low[1]) > Amplitude)  then
  detector = 1
 endif
endif

// sell criteria
if close > dclose(p) then
 if (abs((low-high[1]) /high[1]) > Amplitude)  then
  detector = -1
 endif
endif

// long entry
// if time >= begintime and time<=lasttime then
if not longonmarket and detector = 1 then
 buy 1 lot at market
 SET STOP %LOSS 1
endif
//endif

// long exit
if longonmarket and detector = -1   then
 sell at market
endif

//If time >= endtime then
//if longonmarket then
//sell at market
//elsif shortonmarket then
//exitshort at market
//endif
//endif

//If dayofweek >= 5 and hour > 17 Then
//If longonmarket Then
//Sell at market
//ElsIf shortonmarket Then
//Exitshort at market
//EndIf
//EndIf

GRAPH detector coloured(300,0,0) AS "detector" //noting
GRAPH (positionperf*100) coloured(0,0,0,255) AS "PositionPerformance"

Download
Filename: Gap-Catcher.itf
Downloads: 519
Paul
Paul Master
Operating in the shadows, I hack problems one by one. My bio is currently encrypted by a complex algorithm. Decryption underway...
Author’s Profile

Comments

bertrandpinoy
7 years ago
#

merci. vous l utiliser actuellment sur quel instrument vous? et quel timeframe? Merci

Paul
7 years ago
#

Bonjour, supprimez les lignes avec un "graph"

bertrandpinoy
7 years ago
#

BONJOUR PAUL impossible de tenter le trading automatique, PRT me dis que l instruction "GRAPH" ne passe pas...as tu une solution? cordialement

Kris75
8 years ago
#

Hi Paul, Thanks for sharing but I cannot reproduce any profit on Heineken on 5mn ; Best, C

Paul
9 years ago
#

try activate Williams 3 bar trailing stop to exit when profits are i.e. above x% with a stoploss of y%. You can modify to go short. It's more tough although profitable and the gains are lacking behind to the long positions.

Frank
9 years ago
#

Another thing - have you also tried to go short?

Frank
9 years ago
#

Hi Paul - I tried the original strategy. My first trade showed first a great profit, but it turned out to be a loss in the end. Should the strategy have a element of profit-taking?

Andrea
9 years ago
#

Hi, great strategy, it would be interesting to filter signals with atr.

Paul
9 years ago
#

1-10 min. Here 5 as posted. add additional indicator to get bigger profits and limit number of trades.

Despair
9 years ago
#

I can not reproduce your results. Which timeframe do you run it on?

Paul
9 years ago
#

Useful to this code is to put this as indicator on a intraday price chart dc=dclose(1) RETURN dc as "dc"

Paul
9 years ago
#

its the aex25 futures with p5

CKW
CKW
9 years ago
#

Hi Paul, Thanks for sharing :) Same question probably as Francesco78, which securities you used on the screenshot that you posted? Just to compare if I have similar result as yours

Paul
9 years ago
#

You're right. It's always bigger then 0 unless it's 0, which can happen the way you said.. You can set a different amplitude like 0.0005 which probably makes more sense. In the original gap detection indicator the value is also bigger then 0. With different coding on amplitude you can improve the code, although it gives more parameters to optimise.

nwesterhuijs
9 years ago
#

Although it looks interesting just wondering: Aren't the second conditions for the buy and sell criteria [Buy: (abs((high-low[1]) / low[1]) > Amplitude) ; Sell: (abs((low-high[1]) /high[1]) > Amplitude)] always true due to the use of "abs" with amplitude at 0 [unless high and low[1] or high[1] and low are exactly the same]?

Paul
9 years ago
#

Thanks for the interest. I'am new to this and will trade CFD. What exactly do you mean with underlying? I didn't set the spread in backtest.

auvergnat
9 years ago
#

Thank's for your job. Which spread on your screen report ?

Francesco78
9 years ago
#

thanks, which underlying are you using?

ProRealCode ProRealCode
Loading...