Breakout next 5 Bars

Viewing 15 posts - 31 through 45 (of 47 total)
  • Author
    Posts
  • #207851 quote
    killerplatuze
    Participant
    New

    Thx, dont know whats wrong yesterday. Now it works if the first bar behind the popgun breaks out. Do you have any solution for the last 4 bars?

    #207852 quote
    GraHal
    Participant
    Master

    Now it works if the first bar behind the popgun breaks out. Do you have any solution for the last 4 bars?

    If you are using a low value for  A4 and A6 then likely bar 1 after the popgun will be the bar where a trade is entered.

    Please post a screenshot showing an example of where bars 2 to 4 after popgun should enter a trade but do not.

    #207887 quote
    JohnScher
    Participant
    Veteran
    //...................................................................................
    // PopGunSystem with Tradingzone
    // timeframes : all
    // timezone : all
    // instuments : all
    // here dax40 1H
    // here timezone europe, berlin
    // coded in january 2023
    // coded by JohnScher
    //...................................................................................
    
    
    defparam cumulateorders = true
    once ordersize = 1
    once tradeon = 0
    
    
    //...................................................................................
    // indicator PopGun
    PG = High[2]>High[1] and Low[2]<Low[1] and High>High[1] and Low<Low[1]
    // the second outsidecandle determins the possible trade direction
    PGLong  = PG and close > open
    PGShort = PG and close < open
    
    
    //...................................................................................
    // percentrangestart = support or resistance from the range High-Low in percent, possible entry into a trade
    percentrangestart = 25
    startlongtrade  = (High-Low)*percentrangestart/100
    startshorttrade = (High-Low)*percentrangestart/100
    slt = startlongtrade*pipsize
    sst = startshorttrade*pipsize
    
    
    //...................................................................................
    // percentrangestart = support or resistance from the range High-Low in percent, possible exit from a trade
    percentrangeend = 50
    endlongtrade  = (High-Low)*percentrangeend/100
    endshorttrade = (High-Low)*percentrangeend/100
    elt = endlongtrade*pipsize
    est = endshorttrade*pipsize
    
    
    //...................................................................................
    // time_window to  trade the PopGun, kick off in daily or higher timeframes
    tstart = 110000  // attention it needs 3 candles for PopGun! - so e.g. in dax40 and timeframe 1H starttime ideal tstart = 110000
    tend   = 210000  // attention the spread in case of an overnightclose
    
    
    //...................................................................................
    // maincode
    // determine time
    IF time >= tstart  and time <= tend  then
    // case longtrade
    IF not longonmarket and PGLong Then
    tradeon = 1
    Entry = slt
    Endif
    IF tradeon >5 or longonmarket then
    tradeon = 0
    Elsif tradeon[1] > 0 then
    tradeon = tradeon + 1
    Endif
    If tradeon then
    buy ordersize contracts at Entry Stop
    set stop loss  low
    set target profit  elt
    Endif
    //case shorttrade
    IF not shortonmarket and PGShort Then
    tradeon = 1
    Entry = sst
    Endif
    IF tradeon >5 or shortonmarket then
    tradeon = 0
    Elsif tradeon[1] > 0 then
    tradeon = tradeon + 1
    Endif
    If tradeon then
    sellshort ordersize contracts at Entry Stop
    set stop loss  high
    set target profit  est
    Endif
    
    Endif
    
    killerplatuze and GraHal thanked this post
    #207888 quote
    killerplatuze
    Participant
    New

    Hi, heres an example. The third bar should be fill the buy order.

    PG6.jpg PG6.jpg
    #207891 quote
    JohnScher
    Participant
    Veteran

    The trade starts at entry stop
    the entry stop = high + 25 percent from the range high-low
    you can change the entry stop auf 0 percent, so the trade start at high stop
    // schönen Gruß an tippi
    // und korrigiere mal deinen Namen Killerplautze

    #207894 quote
    GraHal
    Participant
    Master

    The third bar should be fill the buy order.

    What value were you using for A4?

    #207906 quote
    killerplatuze
    Participant
    New

    I have tried out 1, 5 and 10.

    #207911 quote
    GraHal
    Participant
    Master

    Please say what instrument and timeframe and values of A4 to A7 and at exactly what date and time you are analysing then I will set up exactly the same conditions and we can compare notes etc?

    If anybody can spot something I’ve missed or you wish to tweak the code further (or rewrite code from scratch) then please feel free.

    #207920 quote
    JohnScher
    Participant
    Veteran

    A popgun is a well-known chart pattern consisting of 3 candles. 2 outside candles that completely enclose an inside candle with its highs and lows.

    For the sake of simplicity, the breakout is traded in the trend direction which is determined by the 2nd outside candle. This is where the impulse wave according to the Elliot Wave Theory comes into play. The breakout is determined when the high or low of the 2nd outside candle is exceeded within the next 5 candles. There is a little or no dispute about this.

    The difficulties are determining in the target!
    The question arises whether to use points in general or points or a percentage of the price of the value or as a percentage of the 2nd outside or even as a percentage of the 1st outside candle or even more so according to some other target profit or a trailings stop or or or….

    Here we worked with percentages of the 2nd outside.
    The author means that one jumps into the impulse coming from the 2nd outside and then takes the impulse over a certain “distance”, e.g. from 25% of the range of the 2nd outside to 50% of the range of the 2nd outside. Cause PopGuns can be traded in all markets and all time frames, so you can take this “distance” very often with gains.

    PeterSt thanked this post
    #207922 quote
    JohnScher
    Participant
    Veteran

    see attached

    //...................................................................................
    // PopGunIndicator with Tradingzone
    // timeframes : all
    // timezone : all
    // instuments : all
    // here dax40 1H
    // coded in january 2023
    // coded by JohnScher
    //...................................................................................
    
     
    //..................................................................................
    // for the graphics
    PIP=10*pipsize  //default
    LIN=5          //default
     
    rl=0
    gl=250
    bl=0
    
    rs=250
    gs=0
    bs=0
    
    rts = 136
    gts = 0
    bts = 255
    
    
    //...................................................................................
    // indicator PopGun
    PG = High[2]>High[1] and Low[2]<Low[1] and High>High[1] and Low<Low[1]
    // the second outsidecandle determins the possible trade direction
    PGLong  = PG and close > open
    PGShort = PG and close < open
    
    
    //...................................................................................
    // percentrangestart = support or resistance from the range High-Low in percent, possible entry into a trade
    percentrangestart = 25
    startlongtrade  = (High-Low)*percentrangestart/100
    // startlongtrade = High+PIP  //alternativ in pips instead  percent
    startshorttrade = (High-Low)*percentrangestart/100
    // startshorttrade = Low-PIP  //alternativ in pips instead  percent
    slt = startlongtrade*pipsize
    sst = startshorttrade*pipsize
    
    
    //...................................................................................
    // percentrangestart = support or resistance from the range High-Low in percent, possible entry into a trade
    percentrangeend = 50
    endlongtrade  = (High-Low)*percentrangeend/100
    // startlongtrade = High+PIP  //alternativ in pips instead  percent
    endshorttrade = (High-Low)*percentrangeend/100
    // startshorttrade = Low-PIP  //alternativ in pips instead  percent
    elt = endlongtrade*pipsize
    est = endshorttrade*pipsize
    
    //....................................
    
    
    //...................................................................................
    // time_window to show and trade the PopGun
    tstart = 080000  // attention it needs 3 candles for PopGun! - so e.g. in dax40 and timeframe 1H starttime ideal tstart = 110000
    tend   = 220000  // attention the spread in case of an overnightclose
    
    
    //...................................................................................
    // maincode
    IF time >= tstart  and time <= tend  then
    IF PGLong Then
    DRAWARROWUP(barindex,Low-PIP)coloured(rl,gl,bl)
    DRAWSEGMENT(barindex,High,barindex+LIN,High)coloured(rl,gl,bl)
    DRAWSEGMENT(barindex,Low,barindex+LIN,Low)coloured(rl,gl,bl)
    DRAWSEGMENT(barindex,High+slt,barindex+LIN, High+slt)coloured(rts,gts,bts) //possible entry into a trade
    DRAWSEGMENT(barindex,High+elt,barindex+LIN, High+elt)coloured(rts,gts,bts) //possible exit from a trade
    Endif
    IF PGShort then
    DRAWARROWDOWN(barindex,High+PiP)coloured(rs,gs,bs)
    DRAWSEGMENT(barindex,High,barindex+LIN, High)coloured(rs,gs,bs)
    DRAWSEGMENT(barindex,Low,barindex+LIN,Low)coloured(rs,gs,bs)
    DRAWSEGMENT(barindex,Low-sst,barindex+LIN,Low-sst)coloured(rts,gts,bts) //possible entry into a trade
    DRAWSEGMENT(barindex,Low-est,barindex+LIN,Low-est)coloured(rts,gts,bts) //possible exit from a trade
    Endif
    Endif
    
    
    //...................................................................................
    return
    //until then
    
    GraHal thanked this post
    Screenshot_5-1.png Screenshot_5-1.png PopGunIndicator-Tradingzone.itf
    #207927 quote
    JohnScher
    Participant
    Veteran

    correction…

    line 50
    // percentrangestart = support or resistance from the range High-Low in percent, possible exit from a trade

    #207928 quote
    JohnScher
    Participant
    Veteran

    correction…

    line 50
    // percentrangeend = support or resistance from the range High-Low in percent, possible exit from a trade

    so, now but…………….

    #207929 quote
    JohnScher
    Participant
    Veteran

    gl and lg at all
    i m off to next weekend

    #207935 quote
    JohnScher
    Participant
    Veteran

    I’m sorry.
    I need to revise the code again. The stop does not work correctly yet.
    Will done next weekend.

    Midlanddave and killerplatuze thanked this post
    #208499 quote
    Chrisinobi
    Participant
    Senior

    I’m a bit confused now, are you guys talking about an indicator or an algo now???? Find the popgun interesting as an indicator. Even better in Algo, of course ??? Is there a ready made algo as Itf. ????

Viewing 15 posts - 31 through 45 (of 47 total)
  • You must be logged in to reply to this topic.

Breakout next 5 Bars


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 46 replies,
has 5 voices, and was last updated by Chrisinobi
3 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 01/15/2023
Status: Active
Attachments: 11 files
Logo Logo
Loading...