Momentum-Range Differential Acceleration System

Viewing 15 posts - 1 through 15 (of 52 total)
  • Author
    Posts
  • #32581 quote
    Maz
    Participant
    Veteran

    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 here

    Thanks @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

    Nicolas, Henrik, Oskar Bergvall and 9 others thanked this post
    #32651 quote
    Oskar Bergvall
    Participant
    Average

    Yes this is back to Nov 2016 wit EURUSD. Haven’t changed your variables. Looks like it’s working very well 🙂 Losses seems to set it back alot though.

    ALE and Maz thanked this post
    eurusd.jpg eurusd.jpg
    #32752 quote
    Francesco78
    Participant
    Master

    hello, would it be possible to have some guidance on how to code also the version that goes short? Thanks!

    #32870 quote
    jonjon
    Participant
    Average

    Maz

    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:

    bc1 = 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

    #32873 quote
    Maz
    Participant
    Veteran

    Quick 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…

    if barIndex >= max(mcLongPeriod, rcLongPeriod) then
    
    mShort = 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
    

    Something along those lines would probably do the trick.

    All the best,

    M

    Elsborgtrading thanked this post
    #32874 quote
    Maz
    Participant
    Veteran

    It would be particularly useful to see people’s optimization suggestions for a variety of markets and asset classes. Please post back test results and variable optimization sets here

    #32875 quote
    victormork
    Participant
    Veteran

    Thank you Maz for clarifying. I’ll try to do my own testing and will come back when I have something useful.

    #32876 quote
    ALE
    Moderator
    Master

    Hi Maz, may have a detailed explanation of the concept, and what variations are possible to look for different market or time frame? 

    #32877 quote
    victormork
    Participant
    Veteran
    #32879 quote
    victormork
    Participant
    Veteran
    Closing 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:
    // ====================================== \\
    // :: Optimizations --
    // -------------------------------------- //
    
    // Static Optimization for DOW E1 Contract 1 hour
    // Jan 2013 - April 2017
    // Spread 3 points
    wintarget = 45       // Clip target to maximum of x points
    minTradeTime = 16     // stay in trade for at least x bars
    mcThreshold = 0.1    // Momentum coef or dif threshold
    rcThreshold = 0.1    // Range coef or dif threshold
    // try also 27
    mcShortPeriod = 4     // Short period momentum
    rcShortPeriod = 2     // Short period average range
    mcLongPeriod  = 100   // Long period momentum
    rcLongPeriod  = 70    // Long period average range
    
    mcThreshold = 0.1 // 0.5   // Momentum coefficient threshold
    rcThreshold = 0.55 // 1     // Range coefficient threshold
    
    maShortPeriod = 5    // Short term moving average
    maLongPeriod  = 20    // Long term moving average
    
    // ====================================== \\
    // :: Indicators --
    // -------------------------------------- //
    
    // Momentum Coefficient and Range Coefficient ============= \\
    if barIndex >= max(mcLongPeriod, rcLongPeriod) then
    
    mShort = 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 > open
    maShort = exponentialAverage[maShortPeriod](Close)
    maLong  = exponentialAverage[maLongPeriod](Close)
    // ----------------------------------- //
    
    // ====================================== \\
    // :: Entry Logic
    // -------------------------------------- //
    
    // long entry rules (buy condition)
    bc1 = not longOnMarket
    bc1 = bc1 and (mc >= mcThreshold)
    bc1 = bc1 and (rc >= rcThreshold)
    bc1 = bc1 and upBar
    bc1 = bc1 and maShort > maShort[1]
    
    // long exit rules (exit long conditions)
    le1 = longOnMarket
    le1 = le1 and ( barIndex >= barIndexAtBuy + minTradeTime)
    le1 = le1 and (maLong < maLong[4])
    
    // ====================================== \\
    // :: Execution Handlers
    // -------------------------------------- //
    if bc1 then
    buy 1 shares at market
    set target pprofit wintarget
    barIndexAtBuy = barIndex
    endif
    
    if le1 and longOnMarket then
    sell at market
    endif
    
    SET STOP pLOSS 70
    
    //trailing stop
    trailingstop = 30
    
    //resetting variables when no trades are on market
    if not onmarket then
    MAXPRICE = 0
    priceexit = 0
    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
    SELL AT priceexit STOP
    endif
    
    Nicolas, jonjon, ALE and Maz thanked this post
    #32883 quote
    GraHal
    Participant
    Master
    Default ‘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 endif I’ll post variable optimization sets for other markets also. Thanks GraHal
    ALE thanked this post
    #32888 quote
    zilliq
    Participant
    Master
    Hi 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
    2017-04-21_16h40_24.jpg 2017-04-21_16h40_24.jpg 2017-04-21_16h40_34.jpg 2017-04-21_16h40_34.jpg
    #32898 quote
    GraHal
    Participant
    Master
    Might 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
    ALE thanked this post
    #32929 quote
    Elsborgtrading
    Participant
    Veteran
    Hi. 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
    ALE thanked this post
    #32930 quote
    ALE
    Moderator
    Master
    @Zilliq can I test your version with 200.000 bars? Thanks
Viewing 15 posts - 1 through 15 (of 52 total)
  • You must be logged in to reply to this topic.

Momentum-Range Differential Acceleration System


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
Maz @eqmaz Participant
Summary

This topic contains 51 replies,
has 13 voices, and was last updated by victormork
8 years, 4 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/19/2017
Status: Active
Attachments: 9 files
Logo Logo
Loading...