Hi all,
Here is one of my simple strategies. With a little help from someone, here is the code with optimization.
The strategy is using Donchian breakout, with MACD, RSI and moving average as trending indicators.
The code is so simple that I won’t write a long description.
Seems to be effective !
Best regards,
This strategy is suitable for : DAX, H1 (1 point spread, tick by tick)
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 |
// ALLEMAGNE 30 // H1 DEFPARAM CumulateOrders = False // TAILLE DES POSITIONS N = 2 // MACD histogramme iMACD = MACD[12,26,9](close) // Donchian // Pour le DAX : A = 9 et V = 7 A= 9 V = 7 DonchianSupA = highest[A](high) DonchianInfA = lowest[A](low) DonchianSupV = highest[V](high) DonchianInfV = lowest[V](low) iRSI= RSI[4](close) // ACHAT ca1 = iMACD > iMACD[1] ca2 = iMACD >= 0 ca3 = close crosses over DonchianSupA[1] ca4 = iRSI > 63 ca5 = close >= average[50] IF ca1 AND ca2 AND ca3 and ca4 and ca5 THEN buy N shares at market ENDIF sell at DonchianInfA stop // VENTE cv1 = iMACD < iMACD[1] cv2 = iMACD <= 0 cv3 = close crosses under DonchianInfV[1] cv4 = iRSI < 31 cv5 = close <= average[500] IF cv1 AND cv2 AND cv3 and cv4 and cv5 THEN sellshort N shares at market ENDIF exitshort at DonchianSupV stop |
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 Doc! Where can you find a service for Dax with a 1 point spread?
Hello. I suggest you : ProRealTime CFD, or IG.
Best regards,
Hey Doctrading,
I tried your code, optimising the A and V and the RSI period, see below.
Seem to work very promising, but only for one year, from april 2017 to april 2018 It does NOT gain a profit for a period before that period, from april 2016 to april 2017 the net result is zero (1,8 point spread)
This poverly performance further back in the past happen very often with my algo models as well, —> how do you deal with this phenomenon ?
Looking forward for your thoughts,
Thanks, Jan
===============================
Your code optimised with 3 variables, speaks for itself:
//https://www.prorealcode.com/prorealtime-trading-strategies/dax-donchian-breakout-strategy/
// ALLEMAGNE 30
// H1
DEFPARAM CumulateOrders = False
// TAILLE DES POSITIONS
N = 1
// MACD histogramme
iMACD = MACD[12,26,9](close)
// Donchian
// Pour le DAX : A = 9 et V = 7
A= a1//9 default, variable optimization
V = v1//7default, variable optimization
DonchianSupA = highest[A](high)
DonchianInfA = lowest[A](low)
DonchianSupV = highest[V](high)
DonchianInfV = lowest[V](low)
iRSI= RSI[R](close) //4 default, variable optimization
OneTradePerDay = IntradayBarIndex iMACD[1]
ca2 = iMACD >= 0
ca3 = close crosses over DonchianSupA[1]
ca4 = iRSI > 63
ca5 = close >= average[50]
IF ca1 AND ca2 AND ca3 and ca4 and ca5 and OneTradePerDay THEN
buy N shares at market
ENDIF
sell at DonchianInfA stop
// VENTE
cv1 = iMACD < iMACD[1]
cv2 = iMACD <= 0
cv3 = close crosses under DonchianInfV[1]
cv4 = iRSI < 31
cv5 = close <= average[500]
IF cv1 AND cv2 AND cv3 and cv4 and cv5 and OneTradePerDay THEN
sellshort N shares at market
ENDIF
exitshort at DonchianSupV stop
This will work as there is plenty of room for the Target before the Stop, yet the Stop would be hit first far more frequently, hence the equity curve nothing at all as per real time.
I did a copy and paste of this code and PRT 10.3 returns a synthax mistake:
OneTradePerDay = IntradayBarIndex iMACD[1]
Can you clean this error please ?
Thanks.
Works like crazy on bitcoin. Use different timeframes. Thanks a lot Doc!!!
Hi, great code thanks. Very new to this forum. Is there a way to add a 100point target on any position taken?
Morning all, Just backtested on quite a few instruments, worked well on backtesting, but tell me – How do you then implement the cross strategy? it tells me which crossing strategy was best (For what i am looking for {Drawdown / gains / % winners etc}, but not what average that is.?? I see that that for example, MAType was 14 and MATypeV2 61 worked for me the best on the instrument i want to use it on, but – 14 i a Fractal Adaptive Moving Average and 61 is a Zero Lag BMT?? Do i copy and paste the chosen code for each strategy Number? I would love to chat about this a LOT more. Thanks.