I posted “Bullish and Bearish Forex Screeners (based on 3 indicators)” about 4 months ago and had a lot of suggestions and support from @Nicolas, @Sofitech and @Doctrading to develop an automatic trading system.
Well, after a lot of testing, I have come up with the attached system. It seems to be happier in the longer time frames viz. H4 up. I have posted it with two variables, a and b, which are the parameters for the SuperTrend indicator. Since this is the exit signal, it is important to optimise these variables for the instrument you plan to trade. Then enter the results of the optimisation into the code and prepare it for automatic trading. I suggest you test it forward first before committing real money.
I found a wonderful site for the procedures involved in creating and testing a strategy at https://trading.prorealtime.com/en/create-a-trading-system, for those of you who haven’t found it already.
I have also attached the results from 4 tests, of which the DAX was the most spectacular, with 2000% gain in about 15 weeks. However it had the largest drawdown.
So have fun playing with this. I look forward to your suggestions for improvements.
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 |
DEFPARAM CumulateOrders = true // Cumulating positions activated // Indicators COI = WEIGHTEDAVERAGE[10](ROC[14] +ROC[11]) MAC = MACDline[12,26,9](close) STO = Stochastic[14,3](close) ST = Supertrend[a,b] // Conditions to enter long positions c1 = COI > COI[1] AND COI < 0 c2 = MAC > MAC[1] AND MAC < 0 c3 = STO > 20 AND STO < 40 IF Not ShortOnMarket AND c1 AND c2 AND c3 THEN BUY 1 CONTRACT AT MARKET ENDIF // Conditions to exit long positions c5 = close crosses over ST IF c5 THEN SELL AT MARKET ENDIF // Conditions to enter short positions c11 = COI < COI[1] AND COI > 0 c12 = MAC < MAC[1] AND MAC > 0 c13 = STO < 80 AND STO > 60 IF Not LongOnMarket AND c11 AND c12 AND c13 THEN SELLSHORT 1 CONTRACT AT MARKET ENDIF // Conditions to exit short positions c15 = close crosses under ST IF c15 THEN EXITSHORT AT MARKET ENDIF |
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
Hello Mike,
Thank you so much for the nice strategy and for your nice work, i install and I have make a lot Backtest ( with the Dax at 1 euro ) the result is very good !
I have one question wen i look my backtest i see time to time : Buy 30 contrat or sell 30 contrat I dont understand why because your code specifies one contrat.
I wish you a good start to week
Jo
Hi Lepori Joël, larouedegann is correct. If you set “cumulateorders” to false, it will only initiate one contract. But that will reduce the return. One needs to “make hay while the sun shines” and get the best of a long trend.
HELLO joel
I think because DEFPARAM CUMULATEORDERS = TRUE
bonjour Mike j utilise TrendChaser V2.0 et quand il prend position cela ne programme pas le SL chez le brooker? que se passe t il? merci
CumulateOrders = FALSE // Cumulating positions activated
// IndicatorsCOI = WEIGHTEDAVERAGE[10](ROC[14] +ROC[11])MAC = MACDline[12,26,9](close)STO = Stochastic[14,3](close)ST = Supertrend[A,B]
// Conditions to enter long positionsc1 = COI > COI[1] AND COI < 0c2 = MAC > MAC[1] AND MAC < 0c3 = STO > 20 AND STO < 40
IF c1 AND c2 AND c3 THENBUY 1 CONTRACT AT MARKETENDIF
// Conditions to exit long positionsc5 = close crosses over ST
IF c5 THENSELL AT MARKETENDIF
// Conditions to enter short positionsc11 = COI < COI[1] AND COI > 0c12 = MAC < MAC[1] AND MAC > 0c13 = STO < 80 AND STO > 60
IF c11 AND c12 AND c13 THENSELLSHORT 1 CONTRACT AT MARKETENDIF
// Conditions to exit short positionsc15 = close crosses under ST
IF c15 THENEXITSHORT AT MARKETENDIF
Hi Lepori Joël, larouedegann is correct. If you set “cumulateorders” to false, it will only initiate one contract. But that will reduce the return. One needs to “make hay while the sun shines” and get the best of a long trend.
Hello Mike and larouedegann,
Thank you so much for your help and fast answer.
I wish you a good start to week
jo
Hi MikeGC,
Thanks for your sharing. I tried it on DAX
Overall the probability winning trades seems good but it can be risky without SL. Have you try to putting SL to avoid large drawdown? I tried but result is not good
Br
CKW
Hi CKW,
The SuperTrend is the stop loss and exit. That is why it is important to optimise the variables for the ST for the instrument you are trading. For instance, I have the ST set at 4,42 for the DAX. I set it up to auto trade on Monday at the open and it is currently showing a profit of some EUR 11,000 using an account of EUR 10,000 to start, with a spread of 2 points and no fees.
I agree with you that the drawdowns during testing have been high, but it is a trade-off. The higher the drawdown risk, the more room the system has to “breathe”. However, I will be looking at ways to introduce money management rules to limit the drawdown. Any ideas?
Cheers,
Mike
Hi Mike and thanks for sharing. It looks very promising -on the back test. I took a quick test on DAX mini £1 and I gained around 2000% from aug2012 until now. The problem is that it looks like a martingale code(?) I’m no expert but lets say that jan 2015 to apr 2015 it keeps selling on a rising trend- it of cause gets “rescued” in the end and only looses 46000 euro – however if this was on a live trade with IG and you put 92 contracts up with a P/L around -100000 euro and 50000 left in your account you will almost get a margin call. Same with all the other cycles of adding contracts- it’s balancing on a margin call from time to time(without having tested it in depth). Rule of thumb at least what I’ve heard, you should always manage your money and only trade for 1-2% of what you can afford to loose. this means that max2% with a P/L on -46000 euro you should have 2.3 mill euro on the account. One day in the future we might not be that lucky and getting stopped out by a margin call. However IG will only close some of the position until you have the required margin again so it will properly never loose the entire amount in the account- only prolonging the emotional pain. Think about if you sat and watched you equity fall from 156000 to 50000 euro live you would not be able to sleep, eat or think about anything else for 4 month, you would be max stressed out not knowing where this would end. Just saying 🙂
Many thanks, Elsborgtrading, for your comments. The draw down is a major issue. Perhaps I should have labelled the code “beta” as there is still a lot of development to do. With Nicolas’ and cfta’s permission, I would like to incorporate their money management code. The post was “Grid orders with one combined stop loss and limit, can it be done?”.
The other work needed is to reduce the number of false trades by having the entries based on a divergence between the Coppock and price.
Hi Mike. Yes that was excatly my thought as well, that the cfta strategy proberly would do some good here:-) I will follow your progression. *thumbs-up*
Traders, I have managed to incorporate the money management code with the Trend Chaser code with excellent results. I’ll start a new thread with Trend Chaser v.3.0 with Money Management. Many thanks to all assistants and inspirers.
Hello!
Can someone please tell me why back testing DAX 4 h with the same data gives different results ?
I use Pro Real Time
Thanks -Morgan
You are probably testing this strategy on Futures contracts, not CFDs ones.
Thanks for your answer.
I’m new on trading. I really don’t know what you mean 🙂 But I tested on Germany 30 cach mini 1 euro.
/Morgan
It could be that you are trading mini contracts. I ran the tests on full contracts. Make sure that you are testing over the same time period. Let me know how you go.
Die folgende Variable ist nicht definiert: aDie folgende Variable ist nicht definiert: b
ST = Supertrend[a,b]
Was muss ich machen?
Danke!
Hi ToGast, I have left the variables in the code so that you can optimise them for the instrument and time-frame you will be trading. Simply enter the variables into the proper area of the back tester. Give a a range of 1 to 10 and b a range of 1 to 30 and optimise. If the top of a range of either is hit, increase the range and run again. You will need at least 50% winning trades and a reward/risk ratio of at least 2:1, with a minimum drawdown before you would run it live.
I have modified the code since posting v.2.0. You will find it in my post Trend Chaser v.3.0 with Money Management.
I have found the best results with a stop loss of some description as the three indicators can take the wrong trade, hence my suggestion that you do not trade a system with less than 50% winning trades.
Have fun. Please let me know how you go.
Hi Mike, I have a strategy that I would like to introduce you. Sorry, I can not send you pictures.
Can I write you an email?
Greeting Torsten.
Hi Mike, I have a strategy that I would like to introduce you. Sorry, I can not send you pictures.
Can I write you an email?
Greeting Torsten.
You can also open a new forum topic for this 🙂
Thank you Mike!
Hallo Mike, ich habe eine Strategie die ich Dir gerne Vorstellen möchte. Leider kann ich Dir keine Bilder senden.
Kann ich Dir eine Mail schreiben?
Gruß Torsten.
Hi Gruß, I’m afraid I can only read a very little German. Can you please repeat your comments in English?
OK, Gruß, I have had your message translated. My email is mikegchampion at gmail dot com. But I would prefer to use the forum so all can share our ideas. You can send pictures via the forum. If you are having troubles, go to the help section of this forum. Looking forward to hearing from you.
hi,
I’m trying real system on my Ig account, but constantly fails with this message: the trading system was shut down because of a negative offset or zero …how to solve it?
Hi @Gianpiero75,
Are you using the original code? If not, please send me a copy of the code you are using.
Hi @Gianpiero75,
Are you using the original code? If not, please send me a copy of the code you are using.
I have run the code on the AUDUSD and posted the results of the optimiser and backtest. I have also started the code running in ProOrder, all without and error messages. So please send me the code you used with details of the exact circumstances of the error so I can find the problem. Did it occur as soon as you started ProOrder or sometime later? Did it create any orders before the error? Please send me a copy of the message, and any other details you think might help.
hi @MikeGC
the code is original, I just changed the parameters of the indicators in order to adapt to 4 hours TF. It crashes every new candle of 4 hours. no place orders
it crasches even in Daily TF. I dont Know where’s the problem.
thanks a lot…
DEFPARAM CumulateOrders = false // Cumulating positions activated
// Indicators
COI = WEIGHTEDAVERAGE[58](ROC[81] +ROC[63])
MAC = MACDline[69,150,52](close)
STO = Stochastic[81,17](close)
ST = Supertrend[a,b]
a=17
// default 10
b=58
// Conditions to enter long positions
c1 = COI > COI[1] AND COI < 0
c2 = MAC > MAC[1] AND MAC < 0
c3 = STO > 20 AND STO < 40
IF Not ShortOnMarket AND c1 AND c2 AND c3 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
c5 = close crosses over ST
IF c5 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
c11 = COI < COI[1] AND COI > 0
c12 = MAC < MAC[1] AND MAC > 0
c13 = STO < 80 AND STO > 60
IF Not LongOnMarket AND c11 AND c12 AND c13 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Conditions to exit short positions
c15 = close crosses under ST
IF c15 THEN
EXITSHORT AT MARKET
ENDIF
Hi @gianpiero75,
I don’t believe in changing the parameters to suit the time frame. I believe that the parameters are universal and suit all time frames. For instance, the parameters for the Coppock refer to the bars, so regardless of the time frame, the number of bars won’t change. Try restoring the original parameters and see if it crashes then.
Cheers, Mike
Hi Mike...I found the error. It\'s a stupid mistake made by me, but hard to notice ...error
ST = Supertrend[a,b]
a=17
// default 10
b=58
correct
ST = Supertrend[a,b]
a=17
// default 10
b=58
sorry….now it’s correct
error
ST = Supertrend[a,b]
a=17
// default 10
b=58
correct
a=17
// default 10
b=58
ST = Supertrend[a,b]
was just a question of code position
I don’t know if you have used the variables a and b to optimise the parameters for the SuperTrend. This is their purpose and should be set for each time frame and each instrument .
I have not optimized, I multiplied the parameters for 6 (5,8), to use them on the 4 hoursTF. and works very well in the backtest, now I’m using it in real…