Help with Higher Lows Price sync with Higher Low MACD when candle crosses MA

Viewing 15 posts - 46 through 60 (of 73 total)
  • Author
    Posts
  • #107033 quote
    Malend
    Participant
    Average

    I know the arrows and lines and segments… I was making it way to complicated.
    You make my day!!!!
    I keep you posted when all is done, the lows and the highs.

    #107038 quote
    Malend
    Participant
    Average

    So…the end result with cycle highs and lows :-).
    I tested it and it works for 90%. I just see one more last thing. See the attached image.
    I have some parameters which you can fill in yourself. like the MACD, Moving Average, and in the signal in the chart I have chosen to set 2 targets and 1 stoploss. So yo can see of the TA or SL will be reached first.
    .
    It would be great to have one green arrow up above the bar with the signal when the Target1 has reached first, to have 2 green arrows up when Target2 has been reached, and to have a red arrow down when the Stoploss has been reached first.
    .
    My gratitude is BIG. Thank you Vonasi

    DEFPARAM calculateonlastbars = 1000
    
    macdl = macdline[ShortTermMA,LongTermMA,Periods]
    macds = exponentialaverage[Periods](macdl)
    
     
    //start of cycle low
    If macdl =< macds and macdl[1] > macds[1] then
    macdlowest2 = macdlowest
    lowestprice2 = lowestprice
    incyclelow = 1
    macdlowest = macdl
    LowestPrice = low
    endif
     
    //End of cycle
    If macdl > macds and macdl[1] < macds[1] then
    incyclelow = 0
    endif
     
    //lowest macd and price in cycle
    if incyclelow then
    macdlowest = min(macdlowest, macdl)
    lowestPrice = min(lowestprice, low)
    c1 = open < average[ma]
    c2 = close > average[ma]
    c3 = macdlowest > macdlowest2
    c4 = lowestprice > lowestprice2
     
    if c1 and c2 and c3 and c4 then
    DRAWSEGMENT (barindex, close+target1, barindex, close+target2)COLOURED(0,250,0)
    DRAWSEGMENT (barindex, close+target1, barindex+1, close+target1)COLOURED(0,250,0)
    DRAWTEXT("TA1", barindex-1, close+target1, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWSEGMENT (barindex, close+target2, barindex+1, close+target2)COLOURED(0,250,0)
    DRAWTEXT("TA2", barindex-1, close+target2, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWSEGMENT (barindex, close-stoploss, barindex+1, close-stoploss)COLOURED(250,0,100)
    DRAWSEGMENT (barindex, close-(stoploss-0.25), barindex, close-stoploss)COLOURED(250,0,100)
    DRAWTEXT("SL", barindex-1, close-stoploss, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWTEXT("LH", barindex, close+target2+0.75, Dialog, Standard, 14) COLOURED(0,250,0)
    endif
    
    endif
    //start of cycle high
    If macdl => macds and macdl[1] < macds[1] then
    macdhighest2 = macdhighest
    highestprice2 = highestprice
    incyclehigh = 1
    macdhighest = macdl
    highestPrice = high
    endif
     
    //End of cycle
    If macdl < macds and macdl[1] > macds[1] then
    incyclehigh = 0
    endif
     
    //highest macd and price in cycle high
    if incyclehigh then
    macdhighest = min(macdhighest, macdl)
    highestPrice = min(highestprice, low)
    c1a = open > average[ma]
    c2a = close < average[ma]
    c3a = macdhighest < macdhighest2
    c4a = highestprice < highestprice2
    if c1a and c2a and c3a and c4a then
    DRAWSEGMENT (barindex, close-target1, barindex, close-target2)COLOURED(0,250,0)
    DRAWSEGMENT (barindex, close-target1, barindex+1, close-target1)COLOURED(0,250,0)
    DRAWTEXT("TA1", barindex-1, close-target1, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWSEGMENT (barindex, close-target2, barindex+1, close-target2)COLOURED(0,250,0)
    DRAWTEXT("TA2", barindex-1, close-target2, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWSEGMENT (barindex, close+stoploss, barindex+1, close+stoploss)COLOURED(250,0,100)
    DRAWSEGMENT (barindex, close+(stoploss-0.25), barindex, close+stoploss)COLOURED(250,0,100)
    DRAWTEXT("SL", barindex-1, close+stoploss, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWTEXT("HL", barindex, close-target2-0.75, Dialog, Standard, 14) COLOURED(250,0,0)
    endif
    endif
    return
    
    HL-LH-MACD-Price.jpg HL-LH-MACD-Price.jpg
    #107040 quote
    Malend
    Participant
    Average

    Do I need to add somthing like this?

    // end of cycle
    If macdl > macds and macdl[1] < macds[1] or macdl < macdlowest then
    incyclelow = 0
    endif

    #107042 quote
    Malend
    Participant
    Average

    Nope…. that doesn’t work.

    #107043 quote
    Malend
    Participant
    Average

    This needs to be added.
    .

    //End of cycle low
    If macdl > macds and macdl[1] < macds[1] or macdl < macdlowest2 then
    incyclelow = 0
    endif
    #107044 quote
    Malend
    Participant
    Average

    So here the last version.

    DEFPARAM calculateonlastbars = 1000
    
    macdl = macdline[ShortTermMA,LongTermMA,Periods]
    macds = exponentialaverage[Periods](macdl)
    
     
    //start of cycle low
    If macdl =< macds and macdl[1] > macds[1] then
    macdlowest2 = macdlowest
    lowestprice2 = lowestprice
    incyclelow = 1
    macdlowest = macdl
    LowestPrice = low
    endif
     
    //End of cycle
    If macdl > macds and macdl[1] < macds[1] or macdl < macdlowest2 then
    incyclelow = 0
    endif
     
    //lowest macd and price in cycle
    if incyclelow then
    macdlowest = min(macdlowest, macdl)
    lowestPrice = min(lowestprice, low)
    c1 = open < average[ma]
    c2 = close > average[ma]
    c3 = macdlowest > macdlowest2
    c4 = lowestprice > lowestprice2
     
    if c1 and c2 and c3 and c4 then
    DRAWSEGMENT (barindex, close+target1, barindex, close+target2)COLOURED(0,250,0)
    DRAWSEGMENT (barindex, close+target1, barindex+1, close+target1)COLOURED(0,250,0)
    DRAWTEXT("TA1", barindex-1, close+target1, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWSEGMENT (barindex, close+target2, barindex+1, close+target2)COLOURED(0,250,0)
    DRAWTEXT("TA2", barindex-1, close+target2, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWSEGMENT (barindex, close-stoploss, barindex+1, close-stoploss)COLOURED(250,0,100)
    DRAWSEGMENT (barindex, close-(stoploss-0.25), barindex, close-stoploss)COLOURED(250,0,100)
    DRAWTEXT("SL", barindex-1, close-stoploss, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWTEXT("LH", barindex, close+target2+0.75, Dialog, Standard, 14) COLOURED(0,250,0)
    endif
    
    endif
    //start of cycle high
    If macdl => macds and macdl[1] < macds[1] then
    macdhighest2 = macdhighest
    highestprice2 = highestprice
    incyclehigh = 1
    macdhighest = macdl
    highestPrice = high
    endif
     
    //End of cycle
    If macdl < macds and macdl[1] > macds[1] or macdl > macdhighest2 then
    incyclehigh = 0
    endif
     
    //highest macd and price in cycle high
    if incyclehigh then
    macdhighest = min(macdhighest, macdl)
    highestPrice = min(highestprice, low)
    c1a = open > average[ma]
    c2a = close < average[ma]
    c3a = macdhighest < macdhighest2
    c4a = highestprice < highestprice2
    if c1a and c2a and c3a and c4a then
    DRAWSEGMENT (barindex, close-target1, barindex, close-target2)COLOURED(0,250,0)
    DRAWSEGMENT (barindex, close-target1, barindex+1, close-target1)COLOURED(0,250,0)
    DRAWTEXT("TA1", barindex-1, close-target1, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWSEGMENT (barindex, close-target2, barindex+1, close-target2)COLOURED(0,250,0)
    DRAWTEXT("TA2", barindex-1, close-target2, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWSEGMENT (barindex, close+stoploss, barindex+1, close+stoploss)COLOURED(250,0,100)
    DRAWSEGMENT (barindex, close+(stoploss-0.25), barindex, close+stoploss)COLOURED(250,0,100)
    DRAWTEXT("SL", barindex-1, close+stoploss, Dialog, Standard, 10) COLOURED(0,0,0)
    DRAWTEXT("HL", barindex, close-target2-0.75, Dialog, Standard, 14) COLOURED(250,0,0)
    endif
    endif
    return
    #107047 quote
    Malend
    Participant
    Average

    I have shared it in the forum.

    #107048 quote
    Vonasi
    Moderator
    Master

    A lot of the setting variables that you use are not in the code. It might be a good idea to add them before we get lots of ‘it doesn’t work’ questions. Perhaps attaching the ITF file here might be useful too.

    #107049 quote
    Malend
    Participant
    Average

    You mean these ones?

    macdl = macdline[ShortTermMA,LongTermMA,Periods]
    
    macds = exponentialaverage[Periods](macdl)

     

    And how do I make/attach an ITF file?

    #107050 quote
    Malend
    Participant
    Average

    I took away all the DRAW things. I simplified it into 1 vertical line in the post.

    #107052 quote
    Malend
    Participant
    Average

    About the green and red arrows I want to see if it reaches target befor stoploss or stoploss befor target, I made this, but this isn’t right

    if Target1 < close + 10 and SL > close - 5 then // start cycle
    inposition = 1
    endif
    if Target1 => close + 10 or SL =< close - 5 then
    inposition = 0
    endif
    
    if inposition then
    c1 = close => target1
    c2 = close =< SL
    
    if c1 then
    drawarrowup(barindex,low)coloured(0,250,0)
    endif
    if c2 then
    drawarrowdown(barindex,low)coloured(250,0,0)
    endif
    endif
    return
    #107053 quote
    Vonasi
    Moderator
    Master

    The variables that I mean are target1, target2, stoploss etc

    Export indicator or strategy and then attach ITF as you would an image.

    Screenshot_17-2.png Screenshot_17-2.png
    #107057 quote
    Malend
    Participant
    Average

    Oh yes, I took the out allready at my first post, that didn’t add anything to the indicator itself. I changed it into a vertical line.

    #107281 quote
    Malend
    Participant
    Average

    Hi Vonasi,
    I still miss a lot of signals in the cycle high version and I really can’t see what is wrong. The cycle low version works great.
    I have checked over and over again, but I can’t see find the error.
    See the attachment.

    DEFPARAM calculateonlastbars = 1000
    
    macdl = macdline[ShortTermMA,LongTermMA,Periods]
    macds = exponentialaverage[Periods](macdl)
    
    
    //start of cycle high
    If macdl => macds and macdl[1] < macds[1] then
    macdhighest2 = macdhighest
    highestprice2 = highestprice
    incyclehigh = 1
    macdhighest = macdl
    HighestPrice = high
    endif
     
    //End of cycle high
    If macdl < macds and macdl[1] > macds[1] then
    incyclehigh = 0
    endif
     
    //highest macd and price in cycle high
    if incyclehigh then
    macdhighest = max(macdhighest, macdl)
    highestPrice = max(highestprice, high)
    c1 = open > average[ma]
    c2 = close < average[ma]
    c3 = macdhighest < macdhighest2
    c4 = highestprice < highestprice2
    
    if c1 and c2 and c3 and c4 then
    #107282 quote
    Malend
    Participant
    Average

    This is the cycle low verion which works perfect.

    DEFPARAM calculateonlastbars = 1000
    
    macdl = macdline[ShortTermMA,LongTermMA,Periods]
    macds = exponentialaverage[Periods](macdl)
    
     
    //start of cycle low
    If macdl =< macds and macdl[1] > macds[1] then
    macdlowest2 = macdlowest
    lowestprice2 = lowestprice
    incyclelow = 1
    macdlowest = macdl
    LowestPrice = low
    endif
     
    //End of cycle low
    If macdl > macds and macdl[1] < macds[1] then
    incyclelow = 0
    endif
     
    //lowest macd and price in cycle
    if incyclelow then
    macdlowest = min(macdlowest, macdl)
    lowestPrice = min(lowestprice, low)
    c1 = open < average[ma]
    c2 = close > average[ma]
    c3 = macdlowest > macdlowest2
    c4 = lowestprice => lowestprice2
     
    if c1 and c2 and c3 and c4 then
Viewing 15 posts - 46 through 60 (of 73 total)
  • You must be logged in to reply to this topic.

Help with Higher Lows Price sync with Higher Low MACD when candle crosses MA


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Malend @malend Participant
Summary

This topic contains 72 replies,
has 3 voices, and was last updated by GraHal
6 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/06/2019
Status: Active
Attachments: 12 files
Logo Logo
Loading...