Discussing Matriciel EURUSD Dhigh Dlow
Forums › ProRealTime English forum › ProOrder support › Discussing Matriciel EURUSD Dhigh Dlow
- This topic has 118 replies, 33 voices, and was last updated 3 years ago by nonetheless.
-
-
12/05/2019 at 12:38 PM #114248
Hello community,
I open this topic to discuss and improve together Matriciel’s EURUSD HighLow strategy : https://www.prorealcode.com/prorealtime-trading-strategies/eurusd-15-minutes-timeframe-dhigh-dlow-strategy/
I think it has a great potential, and apparently we are struggling to communicate updates to each other through the comments.
12/05/2019 at 12:50 PM #114251This is the code :
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106DEFPARAM CumulateOrders = TrueDEFPARAM PRELOADBARS = 10000daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0Horaire = time >= 000000 and time <= 200000CloturePartielle = 1// 1 = ON, 0 = OFFPositionsizeA = 1PositionsizeV = 1MAXSHARES = abs(COUNTOFPOSITION) <= 19IF CloturePartielle THENPositionsizeA = 4PositionsizeV = 3ENDIFMM = Average[56,3](totalprice)Newhighest = max(DHigh(0),DHigh(1))Newlowest = min(DLow(0),DLow(1))Milieu = (Newhighest+Newlowest)/2Surachat = average[10,4]((Newhighest+Milieu)/2)Survente = average[10,4]((Newlowest+Milieu)/2)CA = (MM > Surachat) and (close crosses over Milieu)CV = (MM < Survente) and (close crosses under Milieu)// Long EntriesIF Horaire AND CA AND MAXSHARES AND not daysForbiddenEntry AND NOT SHORTONMARKET THENBUY PositionsizeA CONTRACTS AT MARKETENDIFIF CloturePartielle THENIF LONGONMARKET AND COUNTOFLONGSHARES <= 16 THENSELL 1 CONTRACTS AT TRADEPRICE + 40*pointsize LIMITENDIFIF LONGONMARKET AND COUNTOFLONGSHARES <= 4 THENSELL 1 CONTRACTS AT TRADEPRICE + 20*pointsize LIMITENDIFIF LONGONMARKET AND COUNTOFLONGSHARES <= 6 THENSELL 1 CONTRACTS AT TRADEPRICE + 18*pointsize LIMITENDIFENDIFIF LONGONMARKET AND summation[35](close < close[6]) = 35 THENSELL AT MARKETENDIF// Short EntriesIF Horaire AND CV AND MAXSHARES AND not daysForbiddenEntry AND NOT LONGONMARKET THENSELLSHORT PositionsizeV CONTRACTS AT MARKETENDIFIF CloturePartielle THENIF SHORTONMARKET AND COUNTOFSHORTSHARES <= 20 THENEXITSHORT 1 CONTRACTS AT TRADEPRICE - 78*pointsize LIMITENDIFIF SHORTONMARKET AND COUNTOFLONGSHARES <= 1 THENEXITSHORT 1 CONTRACTS AT TRADEPRICE - 40*pointsize LIMITENDIFENDIFIF SHORTONMARKET AND summation[32](close > close[6]) = 32 THENEXITSHORT AT MARKETENDIF//MFE//trailing stoptrailingstop = 33//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//case SHORT orderif shortonmarket thenMINPRICE = MIN(MINPRICE,close) //saving the MFE of the current tradeif tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price levelendifendif//case LONG orderif longonmarket thenMAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current tradeif MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price levelendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPendif//SET TARGET pPROFIT 46SET STOP pLOSS 20012/05/2019 at 1:54 PM #114253Don’t you just hate it when Nicolas does a refresh of the website between starting to write a message and posting it and then we end up not logged in and so the post is lost / not posted!?
Fortunately is was not a long post so I’ll do it again later.
Apologies for the moan @Nicolas , I know you have to do maintenance 🙂
I think I may copy posts to clipboard in future before posting?
This ‘moaning post’ is longer than the post I lost so I’d have been better keeping my mouth shut and re doing my original post! 🙂
12/05/2019 at 1:58 PM #114254This ‘moaning post’ is longer than the post I lost so I’d have been better keeping my mouth shut and re doing my original post! 🙂
We want the original post now ! 😛
12/05/2019 at 2:05 PM #114255I’ve had 2 trades only since 17 Oct 19 on Forward Test of this System … both in profit!
I didn’t Accumulate Orders (position size = 1) so only £58 profit, but 2 out of 2 in profit is a good start.
For whatever the reason, I am testing it on 10 min TF (eurusd)
Will Lines 41, 45, 61 and 64 (ish) work in real as they are partial exits?
I used, for example …
1SELL AT TRADEPRICE + 20*pointsize LIMIT12/05/2019 at 2:07 PM #114256Don’t you just hate it when Nicolas does a refresh of the website between starting to write a message and posting it and then we end up not logged in and so the post is lost / not posted!?
That wasn’t me, it happens sometimes automatically for security of your account, but not often!
1 user thanked author for this post.
12/05/2019 at 8:53 PM #11428712/05/2019 at 9:47 PM #114289how to overcome the partial close issue ?
Partial closure is only possible in back testing – not in live demo or live real trading unfortunately. There is no way round this except to ask IG when they plan to let us all partially close positions.
12/05/2019 at 10:10 PM #114290how to overcome the partial close issue ?
You mean you want to do partial closures or you want to eliminate partial closures?
If you want to eliminate then use …
123SELL AT TRADEPRICE + 20*pointsize LIMITExitShort AT TRADEPRICE + 20*pointsize LIMIT12/06/2019 at 8:38 AM #11430312/06/2019 at 9:07 PM #11437012/08/2019 at 12:51 PM #114421I modified the code a little bit to add a compounding effect. In back testing I noticed it started of with a loss the first 6 months, if you calculate position size based on your current capital, it will make for better risk management in my opinion. I took $10k as starting capital for this example.
Below my code.
dhighdlow 15m EURUSD compound123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109DEFPARAM CumulateOrders = TrueDEFPARAM PRELOADBARS = 10000//calculate position size based on capitalAMOUNT = (10000 + STRATEGYPROFIT) * 0.0001daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0Horaire = time >= 000000 and time <= 200000CloturePartielle = 1// 1 = ON, 0 = OFFPositionsizeA = 1 * AMOUNTPositionsizeV = 1 * AMOUNTMAXSHARES = abs(COUNTOFPOSITION) <= 19 * AMOUNTIF CloturePartielle THENPositionsizeA = 4 * AMOUNTPositionsizeV = 3 * AMOUNTENDIFMM = Average[56,3](totalprice)Newhighest = max(DHigh(0),DHigh(1))Newlowest = min(DLow(0),DLow(1))Milieu = (Newhighest+Newlowest)/2Surachat = average[10,4]((Newhighest+Milieu)/2)Survente = average[10,4]((Newlowest+Milieu)/2)CA = (MM > Surachat) and (close crosses over Milieu)CV = (MM < Survente) and (close crosses under Milieu)// Long EntriesIF Horaire AND CA AND MAXSHARES AND not daysForbiddenEntry AND NOT SHORTONMARKET THENBUY PositionsizeA CONTRACTS AT MARKETENDIFIF CloturePartielle THENIF LONGONMARKET AND COUNTOFLONGSHARES <= 16 THENSELL 1 CONTRACTS AT TRADEPRICE + 40*pointsize LIMITENDIFIF LONGONMARKET AND COUNTOFLONGSHARES <= 4 THENSELL 1 CONTRACTS AT TRADEPRICE + 20*pointsize LIMITENDIFIF LONGONMARKET AND COUNTOFLONGSHARES <= 6 THENSELL 1 CONTRACTS AT TRADEPRICE + 18*pointsize LIMITENDIFENDIFIF LONGONMARKET AND summation[35](close < close[6]) = 35 THENSELL AT MARKETENDIF// Short EntriesIF Horaire AND CV AND MAXSHARES AND not daysForbiddenEntry AND NOT LONGONMARKET THENSELLSHORT PositionsizeV CONTRACTS AT MARKETENDIFIF CloturePartielle THENIF SHORTONMARKET AND COUNTOFSHORTSHARES <= 20 THENEXITSHORT 1 CONTRACTS AT TRADEPRICE - 78*pointsize LIMITENDIFIF SHORTONMARKET AND COUNTOFLONGSHARES <= 1 THENEXITSHORT 1 CONTRACTS AT TRADEPRICE - 40*pointsize LIMITENDIFENDIFIF SHORTONMARKET AND summation[32](close > close[6]) = 32 THENEXITSHORT AT MARKETENDIF//MFE//trailing stoptrailingstop = 33//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0MINPRICE = closepriceexit = 0endif//case SHORT orderif shortonmarket thenMINPRICE = MIN(MINPRICE,close) //saving the MFE of the current tradeif tradeprice(1)-MINPRICE>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MINPRICE+trailingstop*pointsize //set the exit price at the MFE + trailing stop price levelendifendif//case LONG orderif longonmarket thenMAXPRICE = MAX(MAXPRICE,close) //saving the MFE of the current tradeif MAXPRICE-tradeprice(1)>=trailingstop*pointsize then //if the MFE is higher than the trailingstop thenpriceexit = MAXPRICE-trailingstop*pointsize //set the exit price at the MFE - trailing stop price levelendifendif//exit on trailing stop price levelsif onmarket and priceexit>0 thenEXITSHORT AT priceexit STOPSELL AT priceexit STOPendif//SET TARGET pPROFIT 46SET STOP pLOSS 20012/08/2019 at 9:45 PM #11445312/12/2019 at 2:26 PM #114744Thanks for sharing. Works great in test indeed, ever greater with EURCAD isn’t it ? Does somenone has the code without partial closure wich indeed prevent form pushing it towards ProOrder ? Don’t have yet the time to clean it. Without partial closure, are the results still good ? Thanks !
12/13/2019 at 12:29 PM #114815 -
AuthorPosts