Momentum-Range Differential Acceleration System
Forums › ProRealTime English forum › ProOrder support › Momentum-Range Differential Acceleration System
- This topic has 51 replies, 13 voices, and was last updated 6 years ago by victormork.
-
-
04/19/2017 at 12:45 PM #32581
Hi all,
As requested just creating a thread to discuss any suggestions, questions or forks of the strategy and indicator that I posted.
Strategy and info can be found here
Indicator and info can be found hereThanks @Oskar Bergvall for looking at USD/SEK. Feel free to post results here. Note that considerable re-optimization is required for every market and asset class.
Best,
Maz
Total of 12 users thanked author for this post. Here are last 10 listed.
04/19/2017 at 5:34 PM #3265104/20/2017 at 1:19 PM #32752hello, would it be possible to have some guidance on how to code also the version that goes short? Thanks!
04/21/2017 at 10:20 AM #32870Maz
Thank you for the code. I really feel like I learnt something from going through it which is what I love about this site. In particular many thanks for the time you spent adding the notes and making it user friendly.
Just a small FYI / beginners question: in the code for the coeff version the lines for mcThreshold and rcThreshold have a “//” to cancel them out however later on in the buy conditions you have:
12bc1 = bc1 and (mc >= mcThreshold)bc1 = bc1 and (rc >= rcThreshold)I see that you have optimised for mcThreshold and rcThreshold. Should the “//” be still in the code? I don’t think it matters as when I take the “//” out it gives the same result.
Thanks
04/21/2017 at 12:12 PM #32873Quick disclaimer
First off, please note the code is purely a PRT backtest. I don’t actually run our production systems in PRT! Again, please ensure you have added your necessary risk management and error handling code and done due diligence before running anything live. Any systems I post are more to open discussion and promote contribution of ideas around the general premise.@ jonjon : Yep, just un-comment them. They are required. They were commented due to backtesting with optimizer.
@ GraHal @ Victormork // Division by zero error
My guess is division by zero error happens due to indicator doing a divide before necessary number of periods have passed. So…12345678910111213if barIndex >= max(mcLongPeriod, rcLongPeriod) thenmShort = momentum[mcShortPeriod]mLong = momentum[mcLongPeriod]mc = max(0, (abs(mShort) / abs(mLong)) -1)r = abs(range)arLong = average[max(1, rcLongPeriod)](r)arShort = average[max(1, rcShortPeriod)](r)rc = max(0, (arShort / arLong) -1)//rc = max(0, arShort - arLong)endifSomething along those lines would probably do the trick.
All the best,
M
1 user thanked author for this post.
04/21/2017 at 12:19 PM #3287404/21/2017 at 12:51 PM #32875Thank you Maz for clarifying. I’ll try to do my own testing and will come back when I have something useful.
04/21/2017 at 12:59 PM #3287604/21/2017 at 1:11 PM #32877@ALE this might help https://www.prorealcode.com/prorealtime-indicators/range-coefficient/
1 user thanked author for this post.
04/21/2017 at 2:08 PM #32879Closing down for the weekend now. If anyone would like to try this system on DOW 1H (wall street cash E1), here’s a starting point:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101// ====================================== \\// :: Optimizations --// -------------------------------------- //// Static Optimization for DOW E1 Contract 1 hour// Jan 2013 - April 2017// Spread 3 pointswintarget = 45 // Clip target to maximum of x pointsminTradeTime = 16 // stay in trade for at least x barsmcThreshold = 0.1 // Momentum coef or dif thresholdrcThreshold = 0.1 // Range coef or dif threshold// try also 27mcShortPeriod = 4 // Short period momentumrcShortPeriod = 2 // Short period average rangemcLongPeriod = 100 // Long period momentumrcLongPeriod = 70 // Long period average rangemcThreshold = 0.1 // 0.5 // Momentum coefficient thresholdrcThreshold = 0.55 // 1 // Range coefficient thresholdmaShortPeriod = 5 // Short term moving averagemaLongPeriod = 20 // Long term moving average// ====================================== \\// :: Indicators --// -------------------------------------- //// Momentum Coefficient and Range Coefficient ============= \\if barIndex >= max(mcLongPeriod, rcLongPeriod) thenmShort = momentum[mcShortPeriod]mLong = momentum[mcLongPeriod]mc = max(0, (abs(mShort) / abs(mLong)) -1)r = abs(range)arLong = average[max(1, rcLongPeriod)](r)arShort = average[max(1, rcShortPeriod)](r)rc = max(0, (arShort / arLong) -1)//rc = max(0, arShort - arLong)endif// ----------------------------------- //// General Indicators ================= \\upBar = close > openmaShort = exponentialAverage[maShortPeriod](Close)maLong = exponentialAverage[maLongPeriod](Close)// ----------------------------------- //// ====================================== \\// :: Entry Logic// -------------------------------------- //// long entry rules (buy condition)bc1 = not longOnMarketbc1 = bc1 and (mc >= mcThreshold)bc1 = bc1 and (rc >= rcThreshold)bc1 = bc1 and upBarbc1 = bc1 and maShort > maShort[1]// long exit rules (exit long conditions)le1 = longOnMarketle1 = le1 and ( barIndex >= barIndexAtBuy + minTradeTime)le1 = le1 and (maLong < maLong[4])// ====================================== \\// :: Execution Handlers// -------------------------------------- //if bc1 thenbuy 1 shares at marketset target pprofit wintargetbarIndexAtBuy = barIndexendifif le1 and longOnMarket thensell at marketendifSET STOP pLOSS 70//trailing stoptrailingstop = 30//resetting variables when no trades are on marketif not onmarket thenMAXPRICE = 0priceexit = 0endif//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 thenSELL AT priceexit STOPendif04/21/2017 at 2:59 PM #32883Default ‘Pre-Load bars’ are 200, would increasing this to 500 / whatever get us ‘ready to trade’ straight off and not get the divide by zero error re your fix below??
if barIndex >= max(mcLongPeriod, rcLongPeriod) then
endifI’ll post variable optimization sets for other markets also.
Thanks
GraHal1 user thanked author for this post.
04/21/2017 at 3:51 PM #32888Hi Guys,
I do a Walk Forward on EUR/USD with the coef version (the other seems doesn’t work) and optimisation of wintarget, malongperiod and mashortperiod on 100 000 bars.
30 minutes after the results are not bad at all (It can probably optimized more)
WFE ratio =71 % (>50 % = Good)
WF efficacy >50 % for 2 of 5 periods (Normally 3/5)
And finish in Gain
Have a nice day
Zilliq
04/21/2017 at 4:42 PM #32898Might I suggest that we attach optimised .itf file still containing the variable sets / ranges used during optimisation (as per Maz’s file in the library?).
This enables those using the .itf file to see the range over which optimisation took place.
Or am I talking / asking a load of bs? You can say, it’s okay! 🙂
GraHal
1 user thanked author for this post.
04/22/2017 at 7:02 AM #32929Hi.
Like Zilliq and others I can’t get any trades when backetesting the Differential system on EURUSD mini 15 min TF.
what could be the problem?
Edit.. as I write- I ran the Coefficient backtest, and suddenly the as data in the Differential system
For the Coefficient system, how would you implement any MM systems when not running any stoploss?
Edit A quick optimization shows that a SL at 100 would be okay, but for an average gain of 20 it seem to be poor RR. Any suggestions?
Cheers Kasper
1 user thanked author for this post.
04/22/2017 at 7:41 AM #32930 -
AuthorPosts
Find exclusive trading pro-tools on