It is an automated strategy used for Brent oil CFD on 5 minute chart with good results since October 2015 as i don’t have more data to run it. Trailing stop code from Nicolas.
If anyone is able to run the backtest for a longer time then please post it here. As you will see, there is no 0 bars on the backtest. Any idea for improving the code is welcome.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 |
DEFPARAM CumulateOrders = False // Cumulating positions deactivated //defparam flatbefore = 230000 //defparam flatafter = 065500 // Conditions to enter long positions indicator1 = TimeSeriesAverage[12](close) indicator2 = WilderAverage[60](close) c1 = (indicator1 >= indicator2) indicator3 = SMI[14,2,16](close) c2 = (indicator3 CROSSES OVER -44) IF c1 AND c2 THEN BUY 2 CONTRACT AT MARKET ENDIF // Conditions to enter short positions indicator4 = TimeSeriesAverage[28](close) indicator5 = WilderAverage[88](close) c3 = (indicator4 <= indicator5) indicator6 = SMI[8,1,16](close) c4 = (indicator6 >= 45) IF c3 AND c4 THEN SELLSHORT 2 CONTRACT AT MARKET ENDIF ////////////////////////////////////////////////////////////////////////// ////Trailing stop logikk ////////////////////////////////////////////////////////////////////////// //trailing stop trailingstop = 34 //resetting variables when no trades are on market if not onmarket then MAXPRICE = 0 MINPRICE = close priceexit = 0 endif //case SHORT order if shortonmarket then MINPRICE = MIN(MINPRICE,close) //saving the MFE of the current trade if tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then priceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price level endif endif //case LONG order if longonmarket then MAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current trade if MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop then priceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price level endif endif //exit on trailing stop price levels if onmarket and priceexit>0 then EXITSHORT AT priceexit STOP SELL AT priceexit STOP endif SET STOP ploss 62//20 SET TARGET pPROFIT 98//54 |
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
Thanks Kenneth for your contribution to the Library!
Your strategy result is good on the time period I have tested so far. But it seems that you have maybe overfitted the indicators periods? If I am right, you should consider round the whole parameters to the nearest one or the most common ones for the indicators used in your strategy. This way, it should improved the chance to get the same result as the backtest with the future data that market will deal.
Hi Nicolas. I posted the same one in his name last night, so don’t list it in the forum please
Yes, many thanks Emil. The first Kenneth post were in the pending review list, but I were on leave.
Her is a screen shoot of live acc.
try to put up screen shoot from live acc.. but it wont show
Your screenshot is automatically attached to the post, with the strategy ITF file.
Thanks Kenneth!
Unfortunately, My (IG) PRT platform can’t load any data of Brent Oil CFD… Anyone know why?
br,
CKW
hi.. thanks CKW
I run my strategy from IG.com so you should be good.
Type in brent crude and choose the one with eur1 and LOC indices.
Then you put in in 5 min and x units and type in 100 000 units
Very strange. I only have data from 1. Aug 2016 from IG when I type in the exact same data
I have around 9 months backtest data.
Mybe a call to IG will help?
Hi Kenneth,
Thanks for your reply. I contacted IG.com and they confirmed this market is currently not available to my country. By the way, it’s Okay. perhaps i could try on other indices with your strategy :))
Br,CKW
Hi Kenneth from your screendump it appears that you have data form 24 may 2015 on 5 min chart?
I wrote IG and they said that the retention for 5 min chart was the one that I have. around 20 days.
I’m confused!
Cheers Kasper
Hi Elsborgtrading.
I really dont know why, I just started IG for 6 months ago and after a while I started/PRT trough IG.
My friend also has same backtest time as me in 5 min chart. we started IG and PRT around the same time.
There are many CFD contracts with the same code “LCO”, have you tested all of them?
With IG, you can have an CFD account or a Spread bet account. There might be the difference, I have the same results as Kenneth on Spread bet account
Elsborgtrading: if you whant to test a strategy you can send it and I can out it on my prt and send it over too you with all the reports and screenshots
Thanks Kenneth. Nicolas -I found it. I normally just test on the mini contracts, so I have the same data on the “normal” contract for Brent Crude
CIAO KENNETH
GRAZIE PER L TUO CONTRIBUTO.
HO TESTATO LA STRATEGIA IN PROBACKTEST SU IG, MA I RISULTATI PER IL PERIODO 29.10.15 -26.08.2016 SONO DIVERSI.
POTRESTI CONFERMARE CHE I VALORI DEL CODICI CHE HAI CONDIVISO SONO QUELLI CHE HAI UTILIZZATO PER AVERE I RISULTATI DEL PROBACKTEST SOPRA RIPORTATO?
GRAZIE ALESSANDRO
CIAO KENNETH
HO RISOLTO IL PROBLEMA.
GRAZIE ALESSANDRO
Ciao Aleale, come hai risolto? Perchè a me la strategia va intotale perdita
Hello Kenneth, thank you so much for the strategy is very very interring.
Im newbie for the code and i have one question :
I use PTR premium and i have dont find the indicator :
TimeSeriesAverage
WilderAverageI wish you a good end of dayjo
you first have to find
*regular* moving average in prt and under settings you can choose timeseriesaverage
Thank you soooooooo much Kennth
I have been using this model for det last week, and it generated 5 trades. None of them gave profit.
Has it happend before in backtest?
Last week wasn’t one of the best weeks. You should have better trades this week.
Little feed back for the moment your strategy is perfect and make me win!
Thank you so much to share your excellent strategy
jo
How long have u been running it live?
Hi Kenneth and Nicolas, thanks for the contribution. Just a question, what’s the spread estimated you use in the backtest. I have an IG account and for brent the estimated spread is between 3 and 6 points, it seems too much, isn’t it?
regards & thanks
a
I personaly use and run Brent with 3 in spread on the backtest
Hi,
Could you tell me what the SMI indicator is, in this strategy?
Mark
Hi,
The SMI is the Stochastic Momentum Index
@ fabio anthony terenzio, devi selezionare il brent su ig con codice lco, se usi quello con valore 1E contract, per il probacktest imposta un valore di conto 1000 , seleziona il time frame da 5 minuti, copia bene il codice, non bloccare la strategia di notte, compra e vendi 1 azione, emetti uno stop ploss di 67 e un take profit di 153. dovresti avere uno storico che parte il 28/29 ottobre un profitto di 370% e drawdown di 396. ricordati di lavorare con drawdown massimo del 20%, se meno meglio.
@ALEALE Io ho provato a mettere i dati che hai scritto tutto ma ho un guadagno di +39,25%….hai modificato qualcosa dall’altro del codice originale? come spread cosa metti? I valori che mi vanno meglio sono 60 ploss e 100 di profit sempre acquistando e vendendo 2.
Gratie
@ Mat-CH ciao no il codice non l’ho modificato, ti riepilogo i dati:
Oil Crude Brent 1E contract, valore conto probacktest €1000, compra e vendi 2 azioni non mettere lo spread ( sarebbe 3punti) se vuoi mettere stop loss 60 e take profit 100 il risultato che dovresti ottenere:dal 19.10.2015 al 07.09.2016 – gain 905% trades vincenti 71,63% ratio 2,10 drawdown 702€Se non ottieni risultati simili controlla:il tipo di contratto ( devi selezionare il brent)l’orario di trading e 24hassicurati di caricare lo storico da ottobre 2015se hai bisogno non esitare!
PS il sitema funziona e non restituisce artefatti, e un buon sistema.
Grazie ALEALE, mia svista, avevo messo 10000.-.
Ora lo sto provando sul conto reale e vediamo….tu già provato sul conto reale?
Thanks Kenneth for share this strategy.
ciaol’ho testato dul demo dal 27.08.16 al 06.09.16 , per verificare la corrispodenza delle posizioni con il backtest, da ieri l’ho messo a girare sul conto reale.
Prova lo stop loss a 60 e il takeprofit a 150.
Buon TradingThanks Kenneth!!
salve faccio trading da un annetto e vorrei sperimentare un po di trading system…a voi in reale che risultati da questa strategia??? ha senso usarla cn un conto da 200euro??? potete consigliarmi qualcosa appropriato al mio conto visto che nn conosco l inglese ed ho appena scoperto questo sito???
grazie a chiunque voglia rispondermi 😉
Hi kenneth,
Thanks for the coding. Is there any need for defparam flatbefore/after at the top of the coding?
Is this just a system which enters as and when or did you look at having time parameters set?
Many thanks
james
Hi. The strategy runs for 24 hours and enters when the indicators are at the defined value.
ragazzi ha senso usarlo su un conto da 1500euro…a voi che risultati sta dando in reale…grazie
Ciao
prova a fare un backtest con il massimo storico, impostando il valore di conto 1500 , compra e vendi un azione, io ho messo come target profit 150 e stop 60
dovresti avere un drawdown di circa 20/25 % ..
Io lo sto usando dal 27.08.16 in reale, il probacktest è affidabile. O lì stessi risultati. ( 60 € di differenza in meno)
la pecca è che ha solo 11 mesi di storico, per il resto sembra ok
I 60 € di differenza sono generati da 2 azioni però
grazie per la risposta….posso chiederti gentilmente quali tra questi codici risulta migliore se ne hai sperimentato qualcuno??? soprattutto che abbia drowdown contenuto avendo io un conto piccolo….
grazie ancora 😉
Per il tuo conto questo è L unico
Hey Kenneth,
first of all thanks for the code. It looks promising.
I backtested it in the same time with a value of 1.000€ in the 1€ mini contract (same number of winnig trades and losing trades) but I only achieved 395% instead of your 723%. Are there any differences (e.g. position size) between the posted code and the screen shot?
Regards, Wisko
Per il tuo conto questo è L unico
grazie mille gentilissimo buon trading
è un piacere, tra l’altro oggi ha lavorato bene…
ciao, sto provando da alcuni mesi la piattaforma PRT … con scarsi risultati .. quando si fa il test in demo le percentuali si abbassano tanto se non diventano negative un po tutte … posso sapere da qualcuno che le usa in reale quali sono le migliori…
adesso ho messo in macchina questa su brent in prova vediamo nei prossimi giorni cosa succede con 2 contratti… ma dal backtest ho visto che non riesco ad arrivare alle percentuali che avete indicato …
grazie
?
Ciao
maxxb non capisco cosa intendi per percentuali e a quale trading sistem?
ciao Aleale,
intendo che ho provato varie strategie “codici” che all’apparenza sembrano buoni (scaricati da questo sito) … messi a girare test su demo vanno quasi tutti in negativo … allora mi chiedo questo programma PRT vale davvero o alla fine gira e rigira si perde solo tempo ?.. per cui mi piacerebbe vedere una strategia che guadagna su conto reale… tutto qua… ne ho provati sul dax – cac – eur/usd che hanno gli spread piu bassi …. il sottostante è indifferente..
per la percentuale ho visto che su questo trading su brent vi dava circa (gain 905% trades vincenti 71,63% ratio 2,10 drawdown 702€ eccc..) ho provato il codice ma a me non arriva a questa percentuale di guadagno … tutto qua… comunque adesso l’ho messo in prova su demo vediamo come va…
ciao, grazie…
Ciao Maxxb,
per esperienza personale, ho notato delle discrepanze tra piattaforma demo e piattaforma reale di IG (anche se non so se abbiano allineato le 2 piattaforme ma fino a poco tempo fa era così), quindi ti consiglierei di fare come faccio io. Fai i backtest nella piattaforma reale poi quando hai il codice che in backtest ti soddisfa lo metti a girare in autotrading in demo.
ciao
ciao Duccio,
grazie proverò a fare anche cosi ….. il problema comunque è l’enorme discrepanza tra i backtest e l’autotrading.. so che è un problema di lettura delle candele … che ha il programma e parlano che verrà risolto con il prossimo aggiornamento.. per ora consigliano di fare backtest che usano time frame bassi 5/10/15/30 … booo vediamo se si trova qualche codice valido che abbia una stabiltà nel tempo ….
ciao
Hi,
Ive been trading the code on a demo account since the 1st September. All trades on the demo account match up to the backtest until this Friday. On Friday night it entered at 20:20 on the demo account. It then traded through the weekend and exited this morning at 03:00. On the backtest I ran this morning there was not a trade placed at the same time as this.
Any ideas why this happened? If the system was running inefficiently would you not expect the backtest to have an extra trade more than the demo account ?
It s a great piece of coding, nice work.
james
Dear James
that position was open on my demo account, but no on the real account like in the probacktest..
very strange
Hi jamesgodfrey80
I had the same problem last friday. Do you trade with IG ?
I called them on monday and we found the reason. If you check an IG chart , you will see that there is a small difference between this chart and the PRT one (0.5 pips).
On IG chart the Stop loss of the living trade is reached but not on the PRT one. So when the code recalculates the SL , IG had opened a new trade and you loose some money on the monday morning
thanks for the sharing Kenneth
Could be a malfunction of the demo account
Hallo Kenneth ,
Følger du selv denne koden , hvordan syns du det fungerer?
Also on my live account a position opened on Friday 16 and ran for 457 bars with a loss on Monday.
This did not happen on backtest.
David
Dear David,
In my live account no position is opened on fryday evening, but was open in demo account.
Hi everyone.
I have been on vication so I have not seen or done anyhing with all the posts or the strategy.
I am currently still running it with not too much profits yet.
Why the backtest did a position while the live acc. Did I have no clue about it.
The best guy to answer for this is mybe Nicolas or someone else that have doen PRT longer than me.
Hi Kenneth, hi all
I find a new difference between PRT and IG
On the 23rd, sept, the strat opened a short at 11:50 (Paris, Berlin time) and was stopped by IG at 15:32 (because trailing stop moved the stop at 4818 at 15h10)
The backtest doesn’t recalculate the stop. So, it was never reached and the TP was reached a few hours later.
In one week, there are 2 differences between IG and PRT. The consequence is a difference of – 160 pips
Did you notice that before ?
Regards,
Reb
There are some.diffrenses yes. PRT can be a pain.in the xxx..
Its nothing to do about it. I BELIVE this is for all automaded strategies in.backtest and live acc. It will.never be 100% accurate is my belife. Mybe in the new prt version it will.be more realistic??
Hello Kenneth! Thank you for sharing this strategy. I have one question; how did you calculate the amount of pips to set as your profit target and stop loss?
Best Regards,
Johan
@ rev
You ‘d best write that problem to IG.
They should sort out why there was a dfference and wether the problem is IG or PRT.
It must become clear to you as a customer what happened exactly. You are paying fees to IG for the brokerage.
If the answers of IG are not satisfying PRT should be informed about that. PRT supplies their software to IG, so IG is a customer of PRT. If IG gives wrong prices or their integrity is in doubt, PRT should be aware of that.
HI There,
Can someone explain what this part of the code means? I have come across it a few times & have NFI what it means.
// Variables that would be adapted to your preferencesif time = 174500 then
Regards.
can we run on crude oil (CL) and (NG) @ ninja trader platform
i can run it on ninja trader for more time i need the help to setup
thank you in advance.
i can run it on ninja trader for more time i need the help to setup you can back test all the way 3 years
thank you in advance.
I have stoped the system due to diffrenses between backtest and live acc. I AM curently waiting til februry when ig relises new. Version for prt
hi Kenneth
for which reason are you waiting for the v10.3 ? What will be the impact about this strategy ?
GAMMA. I dont know how ninja trader setup is.. it would e nice to test and see:)
To Reb: the new version will come february to IG.com , new version has inside candel information. So it will be more accurate an reliable when we backtest. That means that we can tweek the code better.
Hi everyone.
I tried to upload a screenshot of my live acc. That i started around 20july and ended around 20september.
Looks like i need to sit on computer since I cant upload from my phone.
I will try to do this later.
Anyway I run the automated startegy live and gained 1000euro before it had a drawdown with 1000 euro, as many know I stopped the strategy since it had some few diffrenses with backtest and live but looks like we are close to figure something out.
Is there anybody who would like to run the strategy with a tick by tick version 10.3 prt.
I am a ig user and cant do.much before ig gets version 10.3 around february 2017
ok thks for the info Kenneth
Keep us updated!
Hi Kenneth,
Do you have any updates for this strategy?
pro real time version 10.3 available for norwegian customer trough IG
Hi..
I have been working for many months now and have not tested it or done anything since last I posted a tread here.
Anyone that have been running it on 10.3 backtest mode? I am now on vication and very eeger to start again soon
Hi Kennith.
Only read your code now.
I tested on PRT 10.3
Tested your code with various capital and time frames. Even with intial capital of just $100 it performs well. Best results got from time frame 2min over 100,000 (x)units. Then the next good results are between 18-24min again. Strange in these time frames (18-24min) the graph only shows trade from 14March 2017 onwards. Before that is flatline.
For me personally it says a lot if code/autotrade performs well with initial small amount of capital.
Great code!! and nicely commented as well.!
Hope this helps.
@vorster
hi,
wich parameter do you use for your test with starting capital of 100$ ?And SL/TP which value ? Tanks
volpiemanuel.
I back tested your strategy again now and could not find the same results as before. I will try and reproduce the results with some tweaking. I did not run the strategy because the backtest on Oil does not seem stable to me. On IG the backest frames only goes back to about a month.
Buongiorno, qualcuno sta utilizzando in reale questa strategia? con quali risultati?
Grazie!
Hi Stenozar
Sorry in the library, could you use english pls ?
I don’t use this strategy live. I have followed it since the beginning and the results are not so good (less interesting than before mid 2016)
Reb
Thanks Reb; do you suggest any other strategy on Brent?
thanks