Dear all,
This is my first strategy posted, I have coded this strategy based on my empirical experience, the idea is that Italy 40 index tends to invert directionality in the morning at 09:00 CET. 09:00 is the time when the future starts trading and is also the time when the index bid offer spread shrinks from around 25ticks to 6/7 ticks.
The fliter I used are:
- the previous day bar has a well defined directionality, parametrized by the variable b in the code, set at 120.
- the market is volatile enough: ATR[50] >20
The code force open and close at 30 minutes distance, open at 09:00 and closes at 09:30
In the code I also added an accumulator of positions, ading up positions as long as the strategy is profitable.
You find the results in the picture named btVP.png.
I also tried to do a walk forward analysis, with constant positions, and the results are in backtestwg.png
There is one thing to note before trying to run the code.
In the example I used a 30 minutes time frame in order to capture the longest possible timeseries, but pls be warned that in real you should open a position slightly later than 09:00:00 because the bid offer tightnes only after few seconds after. Ideally 09:01:00 should be fine.
As far as I know Nicolas has done a 200, 000 backtest and it looks that the strategy has worked consistently well up to 2013.
Any comment, improvement will be greatly appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
// Definition of code parameters DEFPARAM CumulateOrders = False // Cumulating positions deactivated timeenter = time = 090000 timeexit = time = 093000 indicator1 = AverageTrueRange[50](close) volfilter= indicator1>20 b = 120 size = 5 increasestep = 2000 // Conditions to enter long positions c1 = (DClose(1) <= DOpen(1)-b) and abs(dclose(1)-dopen(1))<900 NotAugust = CurrentMonth < 8 OR CurrentMonth > 8 if strategyprofit >=0 then IF c1 AND timeenter and NotAugust and volfilter THEN BUY size+round(strategyprofit/increasestep) PERPOINT AT MARKET ENDIF endif if strategyprofit < 0 then IF c1 AND timeenter and NotAugust and volfilter THEN BUY size/2 PERPOINT AT MARKET ENDIF endif if longonmarket AND timeexit and volfilter THEN SELL AT MARKET ENDIF // Conditions to enter short positions c2 = (DClose(1) >= DOpen(1)+b)and abs(dclose(1)-dopen(1))<900 if strategyprofit >=0 then IF c2 AND timeenter and NotAugust and volfilter THEN SELLSHORT size+round(strategyprofit/increasestep) PERPOINT AT MARKET ENDIF endif if strategyprofit < 0 then IF c2 AND timeenter and NotAugust and volfilter THEN SELLSHORT size/2 PERPOINT AT MARKET ENDIF endif if shortonmarket AND timeexit THEN EXITSHORT AT MARKET ENDIF // Stops and targets SET STOP ploss 300 set target pprofit 400 |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Hi, I do not understand why to do strategies for indexes with a slipage so high. I do not like to give my money to the brokers. In Spain IG gives us a slip for Italy of 15. We have the DAX with 1 point !!!.Thank you anyway
HI Iramirez,
my personal view is that as is not easy at all to find patterns, even pay a bit of slippage is not a disaster on the long term.
It become insignificant on the long term if the backtest is solid.
I appreciate your comment anyway.
Ciao
Thanks
Ciao e grazie per il codice.
Avevo osservato la stessa cosa circa sette o otto anni fa, sempre con IG ma facendo trading manuale. Per un po’ è andata bene ma poi ho cominciato a mangiare il gruzzoletto guadagnato, ed ho lasciato perdere. In effetti lo spread alto fa la differenza.
Purtroppo!
Perché è un pattern su cui si può fare affidamento.
Grazie a te per il commento, per quanto riguarda lo spread basta impostare l’entrata alle subito dopo le nove del mattino ora italiana. Mi fa piacere sapere che funzionava anche setto otto anni fa..:)
Molto bene, ho voluto parlare di una cosa che sto trovando con questa strategia, ho girato su un conto demo per vedere come funziona e non soddisfa gli orari, le posizioni sono aperte alle 9 del mattino e devono chiudere a 9 30 e molti giorni non chiudere quella posizione, dando poi un errore e fermare la strategia si fa a sapere che è?Grazie mille.
Ciao Nacho, grazie per il commento, onestamente a me non e’ mai capitato, ma ho fatto solo in reale…
Spero che qualcun altro possa aiutarti.
Saluti!
ciao francesco grazie mille. pietro ranzato non riesco a contattarti sono interessato al tuo lavoro se mi puoi contattare su fb grazie.