Breakout M5 / H4 Nasdaq

Viewing 15 posts - 76 through 90 (of 97 total)
  • Author
    Posts
  • #182475 quote
    phoentzs
    Participant
    Master

    So weit bin ich heute nicht. Ich denke, M3 auch, oder M2 würde auch funktionieren. Gleicher Zeithorizont, nur schneller. Die Langversion von M3 funktioniert am besten an der Nasdaq. M1 auf SP500 und Dax. Ich habe Dow Jones noch nicht ausprobiert.

    I’m not that far today. I think M3 too, or M2 would work too. Same time horizon, only faster. The long version of M3 works best on the Nasdaq. M1 on SP500 and Dax. I haven’t tried Dow Jones yet.

     

    #182476 quote
    phoentzs
    Participant
    Master

    @nonethless: Sorry, I misspelled you.

    #182477 quote
    murre87
    Participant
    Senior

    I Combined Phonetzs code and made a long/short-version

    How to make i better?

    //Break-H4 Nasdaq M3
    //================================================
    
    DEFPARAM CUMULATEORDERS = false
    defparam preloadbars = 5000
    
    
    //Risk Management
    PositionSize=1
    
    timeframe(4hour, updateonclose)
    barCount = barIndex
    
    c1 = high
    D1 = low
    c2 = (Close > Open) //green
    c3 = (Close < Open) //red
    c4 = (high < high[1])//lowerhigh
    c5 = (high > high[1])//higherhigh
    //MACDLiniex = MACDline[12,26,9](close) > 0
    MA5xx  = Average[3,1](typicalprice) //close
    MA10xx  = Average[10,1](typicalprice) //close
    MA15xx = Average[15,1](typicalprice) //15,1 close
    mylongx   = MA15xx > MA15xx[1] //and MA5xx > MA15xx// and MA10xx > MA15xx
    
    MA5xxs  = Average[19,1](typicalprice) //close
    //MA10xx  = Average[m2,1](typicalprice)
    MA15xxs = Average[20,1](typicalprice) //15,1...40,6 close
    //MA100xx  = Average[m3,1](typicalprice) //close
    myshortx   = MA15xxs < MA15xxs[1] and MA5xxs < MA15xxs //and MA10xx < MA15xx
    //mylongx2   = MA100xx > MA100xx[1]
    shortcond = myshortx
    
    timeframe(default)
    once tradeOn = 1
    if intradayBarIndex = 0 then
    tradeOn = 1
    endif
    tradeBar = barCount
    if  not onMarket and tradeBar<>tradeBar[1] then
    tradeOn = 1
    endif
    
    
    //Volaititätfilter
    AvgRange = average[20,0](range)
    TradeOFF  = range > (AvgRange * 3) //no trading if the current range > twice its average //3
    
    
    //myshort = MA < MA[1]
    
    // trading window
    ONCE BuyTime  = 080000
    ONCE SellTime = 215500
     
    // position management
    IF Time >= BuyTime AND Time <= SellTime THEN
    
    If not onmarket and close crosses over c1 and mylongx and c3 and tradeOn Then //and not c5
    Buy PositionSize CONTRACTS AT MARKET
    SET STOP %LOSS 0.9 //100
    SET TARGET %PROFIT 1 //125
    
    tradeOn = 0
    ENDIF
    
    If not onmarket and close crosses over c1 and mylongx and c2 and tradeOn Then //and not TradeOFF and c3  close crosses over c1
    Buy PositionSize CONTRACTS AT MARKET
    SET STOP %LOSS 0.8 //100
    SET TARGET %PROFIT 1 //125
    
    tradeOn = 0
    ENDIF
    
    If not onmarket and close crosses under D1 and shortcond and tradeOn Then
    sellshort PositionSize CONTRACTS AT MARKET
    SET STOP %LOSS 0.7 //0.8
    SET TARGET %PROFIT 0.8 //1
    
    tradeOn = 0
    ENDIF
    
    endif
    
    
    if time = 220000 and dayofweek=5 and (PositionPerf * PositionPrice / PipSize) >= 5 then  //
    sell at market
    exitshort at market
    endif
    
    ////////////////////////////////////////
    // %trailing stop function incl. cumulative positions
    once trailingstoptype = 1
    if trailingstoptype then
    //====================
    trailingpercentlong  = 0.32 // %
    trailingpercentshort = 0.55 // %
    once acceleratorlong = 0.015 // typically tst*0.1
    once acceleratorshort= 0.025 // typically tss*0.1
    ts2sensitivity  = 2 // [1] close [2] high/low [3] low/high [4] typicalprice
    //====================
    once steppercentlong  = (trailingpercentlong/10)*acceleratorlong
    once steppercentshort = (trailingpercentshort/10)*acceleratorshort
    if onmarket then
    trailingstartlong = positionprice*(trailingpercentlong/100)
    trailingstartshort = positionprice*(trailingpercentshort/100)
    trailingsteplong = positionprice*(steppercentlong/100)
    trailingstepshort = positionprice*(steppercentshort/100)
    endif
    
    if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then
    newsl           = 0
    mypositionprice = 0
    endif
    positioncount = abs(countofposition)
    if newsl > 0 then
    if positioncount > positioncount[1] then
    if longonmarket then
    newsl = max(newsl,positionprice * newsl / mypositionprice)
    else
    newsl = min(newsl,positionprice * newsl / mypositionprice)
    endif
    endif
    endif
    if ts2sensitivity=1 then
    ts2sensitivitylong=close
    ts2sensitivityshort=close
    elsif ts2sensitivity=2 then
    ts2sensitivitylong=high
    ts2sensitivityshort=low
    elsif ts2sensitivity=3 then
    ts2sensitivitylong=low
    ts2sensitivityshort=high
    elsif ts2sensitivity=4 then
    ts2sensitivitylong=(typicalprice)
    ts2sensitivityshort=(typicalprice)
    endif
    if longonmarket then
    if newsl=0 and ts2sensitivitylong-positionprice>=trailingstartlong then
    newsl = positionprice+trailingsteplong + 0.2
    endif
    if newsl>0 and ts2sensitivitylong-newsl>=trailingsteplong then
    newsl = newsl+trailingsteplong
    endif
    endif
    if shortonmarket then
    if newsl=0 and positionprice-ts2sensitivityshort>=trailingstartshort then
    newsl = positionprice-trailingstepshort
    endif
    if newsl>0 and newsl-ts2sensitivityshort>=trailingstepshort then
    newsl = newsl-trailingstepshort
    endif
    endif
    if barindex-tradeindex>1 then
    if longonmarket then
    if newsl>0 then
    sell at newsl stop
    endif
    if newsl>0 then
    if low crosses under newsl then
    sell at market
    endif
    endif
    endif
    if shortonmarket then
    if newsl>0 then
    exitshort at newsl stop
    endif
    if newsl>0 then
    if high crosses over newsl then
    exitshort at market
    endif
    endif
    endif
    endif
    mypositionprice = positionprice
    endif
    
    if (shortonmarket and newsl > 0) or (longonmarket and newsl>0) then
    if positioncount > positioncount[1] then
    if longonmarket then
    newsl = max(newsl,positionprice * newsl / mypositionprice)
    endif
    if shortonmarket then
    newsl = min(newsl,positionprice * newsl / mypositionprice)
    endif
    endif
    endif
    //////////////////////////////////////////////////////////////
    3Mbreak.jpg 3Mbreak.jpg
    #182479 quote
    phoentzs
    Participant
    Master

    Mein Plan wäre, beide Versionen, lang und kurz, einzeln laufen zu lassen. Ohne eine Vollversion daraus zu machen.

    My plan would be to run both versions, long and short, individually. Without making a full version out of it.

    #182483 quote
    robertogozzi
    Moderator
    Master

    @phoentzs

    Only post in the language of the forum that you are posting in. For example English only in the English speaking forums and French only in the French speaking forums.

    Thank you 🙂

    #182484 quote
    robertogozzi
    Moderator
    Master

    Maybe one more question for the great masters … Nicolas? Robertogozzi? If you manage entries from large time units with a trailing stop … which TF is best used for this? M1… 5? Is more data history better or faster reaction to a trailing stop?

    I usually use 5-minute or 10-minute TFs for the trailing stop, mainly because they grants more data history, compared to smaller TFs.

    phoentzs thanked this post
    #182488 quote
    nonetheless
    Participant
    Master

    I made a quick attempt to add short to this but it didn’t seem worth it, I’ll have another try when I get time.

    This is a minor revision to my long version, trying to get the DD as low as poss (positionsize = 0.5)

    These are the key changes:

    timeframe(4 hour, updateonclose)
    H4 = high
    
    MA = Average[p,t](close)
    cb1   = MA > MA[1]
    
    timeframe(15 minutes)
    mb = average[p1,t1](typicalprice)
    cb4 = mb > mb[1]
    
    timeframe(default)
    ST = SuperTrend[m,n]
    STa = SAR[q,w,e]
    cb2 = (close > ST) or (close > STa)
    
    cb3 = close crosses over H4
    murre87 and phoentzs thanked this post
    NAS-5m-Breakout-v3.2.jpg NAS-5m-Breakout-v3.2.jpg NAS-5m-Breakout-v3.2.itf
    #182510 quote
    murre87
    Participant
    Senior

    an impressive piece of work, nonetheless.
    What if it would be possible to make a long/short version of this algo 🙂

    #182517 quote
    nonetheless
    Participant
    Master

    You can have a go if you have time to crunch the numbers. The core of it would look like this:

    timeframe(4 hour, updateonclose)
    H4 = high
    L4 = Low
     
    MA = Average[p,t](close)
    cb1   = MA > MA[1]
    MAs = Average[p2,t2](close)
    cs1   = MAs < MAs[1]
    
     
    timeframe(15 minutes)
    mb = average[p3,t3](typicalprice)
    cb2 = mb > mb[1]
    mbs = average[p4,t4](typicalprice)
    cs2 = mbs < mbs[1]
     
    timeframe(default)
    ST = SuperTrend[m,n]
    STa = SAR[q,w,e]
    cb3 = (close > ST) or (close > STa)
    cs3 = (close < ST) or (close < STa)
     
    cb4 = close crosses over H4
    cs4 = close crosses under L4
    phoentzs thanked this post
    #182520 quote
    nonetheless
    Participant
    Master

    If you haven’t used this syntax before

    Average[p,t]

    the ‘t’ represents the type of MA, can be 0 – 8
    ‘p’ I usually optimize from 5 – 50 in steps of 5

    (apologies if you know this already 😁)

    phoentzs and murre87 thanked this post
    #182728 quote
    murre87
    Participant
    Senior

    Thanks alot for the input nonetheless. I made an attempt for long/short-version.
    Do u guys see any improvements? nonetheless, robertogozzi, phoentzs?
    I want to get rid of the big drawdown in december 2021.

    Backtest with Size 0.5
    CUMULATEORDERS = false

    nonetheless thanked this post
    NAS-5m-Breakout-v3.3.itf nas3.3-2017.jpg nas3.3-2017.jpg nas3.3-2010.jpg nas3.3-2010.jpg
    #182736 quote
    nonetheless
    Participant
    Master

    In the itf both the % trail and ATR trail are active, which one did you want to use?

    #182737 quote
    murre87
    Participant
    Senior

    Using both gets better results then just one when i backtested

    #182739 quote
    phoentzs
    Participant
    Master

    I am not sure if the idea is a good one. Isn’t that what affects each other? Unfortunately, due to the sudden drop in the Nasdaq over the last few days, the SL had to take action. That’s why the last few days lost in long mode. I personally help myself with this by splitting the risk over several systems. In that case I use half a position in TF M3 and a half position in TF M1. M1 made a profit from the faster trailing stop, M3 a loss.

    #182741 quote
    nonetheless
    Participant
    Master

    that sounds weird to me, I think there will be conflicts in the code, I’ll have a closer look at it later.

Viewing 15 posts - 76 through 90 (of 97 total)
  • You must be logged in to reply to this topic.

Breakout M5 / H4 Nasdaq


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
phoentzs @phoentzs Participant
Summary

This topic contains 96 replies,
has 9 voices, and was last updated by murre87
4 years, 2 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 11/03/2021
Status: Active
Attachments: 21 files
Logo Logo
Loading...