Breakout Long on Dax 1 hour

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #68606 quote
    Pier
    Participant
    Veteran

    Enter a long position when price break the highest within 4 bars

    i use as filter “trend continuation factor” when the green line is over and adx

    It provides a trailing stop and %stop loss

    I suggest to download the strategy with the link below, to get the complete code (strategy + indicator at the same time when importing it).

    bars = 21
    
    barsback = 4
    TcfL, TcfS = CALL "Trend Continuation Factor"[15]
    
    if high = highest[bars](close)  then
    bi = barindex
    hh = highest[bars](close)
    endif
    
    //conditions long
    l1 = close crosses over hh
    l1 = l1 and barindex < bi + barsback
    l1 = l1 and TcfL > TcfS
    l1 = l1 and adx[10] > 16
    
    //enter position
    if not onmarket and l1 then
    buy at market
    //SET TARGET PPROFIT AverageTrueRange[14](close)*6.5
    endif
    
    trailingstart = tradeprice/315 //trailing will start @trailinstart points profit
    trailingstep = 5 //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    
    SET STOP %LOSS 0.7
    GraHal thanked this post
    nuovo-opendocument-disegno-15239760838pl4c.jpg nuovo-opendocument-disegno-15239760838pl4c.jpg Breakout-Long-on-Dax-1-hour.itf
    #68649 quote
    Nicolas
    Keymaster
    Master

    Hi Pier, thanks a lot for sharing this strategy with the community. I appreciate a lot.

    I made a test over 200k bars and the first part of the history (OOS period) shows that the strategy is overfit over the last part (the one you develop and optimize the strategy on = screenshot attached).

    It doesn’t mean the strategy is bad, perhaps it could become more “robust” with new optimization made every X bars, the Walk Forward tool will help you find how and when to do it. Thank you again 🙂

    dax-overfit-on-100000-bars.png dax-overfit-on-100000-bars.png
    #68663 quote
    GraHal
    Participant
    Master

    Looks good!

    I like that it not drop below zero / still gains over the non-optimised 100k bars in Nicolas equity curve … shows plenty of potential!

    I’m setting it going in Demo right now! 🙂

    Let us know please if you make any changes after using WF etc.
    I will report back likewise.

    Thank You
    GraHal
    PS  Might you consider adding shorts also? I think the DAX is due a correction?

    #68671 quote
    Pier
    Participant
    Veteran
    bars = 21
    
    barsback = 4
    TcfL, TcfS = CALL "Trend Continuation Factor"[9]
    ac = CALL "accelerator adx"[5, 100]
    
    if high = highest[bars](close)  then
    bi = barindex
    hh = highest[bars](close)
    endif
    
    //conditions long
    l1 = close crosses over hh
    l1 = l1 and barindex < bi + barsback
    l1 = l1 and TcfL > TcfS
    l1 = l1 and adx[10] > 16
    l1 = l1 and ac > 0.9
    //enter position
    if not onmarket and l1 then
    buy at market
    //SET TARGET PPROFIT AverageTrueRange[14](close)*6.5
    endif
    
    ADX accelerator 
    
    mShort = adx[adShortPeriod]
    mLong  = adx[adLongPeriod]
    ad = max(0, (abs(mShort) / abs(mLong)) -1)
    return ad as "acd"
    

     

    Try to set It  in this way:  using  ADX accelerator too and tcf[9] .  It seems that it works better 

    Short position is not so good I don’t why

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Breakout Long on Dax 1 hour


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Pier
7 years, 10 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/18/2018
Status: Active
Attachments: 3 files
Logo Logo
Loading...