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

Viewing 13 posts - 61 through 73 (of 73 total)
  • Author
    Posts
  • #107284 quote
    Vonasi
    Moderator
    Master

    The code looks fine. I didn’t see any errors when I tested this version which has standard MACD settings and 50 period average and simply returns a flag value. It all looked just fine along side a MACD and price chart. Are you sure that you are comparing the same MACD settings in the indicator compared to any separate MACD indicator that you are looking at?

    //DEFPARAM calculateonlastbars = 1000
     
    macdl = macdline[12,26,9]
    macds = exponentialaverage[9](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[50]
    c2 = close < average[50]
    c3 = macdhighest < macdhighest2
    c4 = highestprice < highestprice2
    endif
    
    flag = 0
    if c1 and c2 and c3 and c4 then
    flag = 1
    endif
    
    return flag
    #107291 quote
    Malend
    Participant
    Average

    I am looking at E-mini Russell, 200 ticks.
    This is a chart from today, from 20:20  untill 22:00
    I use sma 20 in the chart and I have that programmed as a fixed number, so not as and indicator parameter.
    I have a MACD_Vonasi_LOWS, your MACD and I made the MACD-Vonasi_highs out of that. You see both seperate in the chart. I use MACD[2,20,30]. This is also in the code for the cycle lows and highs.

    I Have included the Cycle Low and the Cycle Hig Indicator.

    SEE THE IMAGE FOR THE FALL OUTS

    //---CYCLE LOW MACD and PRICE INDICATOR
    
    DEFPARAM calculateonlastbars = 1000
    
    macdl = macdline[5,20,30]
    macds = exponentialaverage[30](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[20]
    c2 = close > average[20]
    c3 = macdlowest > macdlowest2
    c4 = lowestprice > lowestprice2
     
    if c1 and c2 and c3 and c4 then
    DRAWSEGMENT (barindex, close+target1, barindex, close+target3)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+target3, barindex+1, close+target3)COLOURED(0,250,0)
    DRAWTEXT("TA3", barindex-1, close+target3, 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("F1", barindex, close+target3+0.75, Dialog, Standard, 14) COLOURED(0,250,0)
    endif
    
    endif
    return
    
    // CYCLE HIGH MACD and PRICE INDICATOR
    
    DEFPARAM calculateonlastbars = 1000
    
    macdl = macdline[5,20,30]
    macds = exponentialaverage[30](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[20]
    c2 = close < average[20]
    c3 = macdhighest < macdhighest2
    c4 = highestprice < highestprice2
    
    if c1 and c2 and c3 and c4 then
    DRAWSEGMENT (barindex, close-target1, barindex, close-target3)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-target3, barindex+1, close-target3)COLOURED(0,250,0)
    DRAWTEXT("TA3", barindex-1, close-target3, 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-target3-0.75, Dialog, Standard, 14) COLOURED(250,0,0)
    endif
    
    endif
    return
    img-3.jpg img-3.jpg
    #107295 quote
    Malend
    Participant
    Average

    The Fall Outs you can see in the image, the white dashed arrows mark them.
    The target 1, target2, target3 and stoploss are indictor parameters, but don’t influence any syntax.
    Let me know if all is clear.

    #107296 quote
    Vonasi
    Moderator
    Master

    From some testing it appears to be due to the fact that you are using a tick chart rather than a time chart. It appears that the average is not correctly calculated.

    #107297 quote
    Malend
    Participant
    Average

    Hi again,

    It looks like the fall outs are after a cycle low or high where the candle with the PriceHighest2 of the MacdHighest2 or PriceLowest2 of the MacdLowest2 are falling together.
    When you look at the imag I included 2 posts before, you see only 1 line in a cycle in the MACD-Vonasi-Lows or MACD-Vonasi-Highs. That is where the  they fall together.
    After such a cycle the price and/or macd after that cycle don’t use it as a reference anymore.

    #107299 quote
    Vonasi
    Moderator
    Master

    Read my answer before your last post.

    I tested it with this code and on tick charts it shows the candle straddling the average when it isn’t. On time based charts everything works fine.

    //DEFPARAM calculateonlastbars = 1000
     
    macdl = macdline[5,20,30]
    macds = exponentialaverage[30](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[20]
    c2 = close < average[20]
    c3 = macdhighest < macdhighest2
    c4 = highestprice < highestprice2
    endif
    
    flag = 0
    if c1 and c2 and c3 and c4 then
    flag = 2
    endif
    
    return c1 as "open > ave",c2 as "close < ave",c3 as "lower macd",c4 as "lower price"  , flag as "flag"
    
    #107300 quote
    Malend
    Participant
    Average

    I see the same Fall Outs in the 1 minute charts with the same situations when the bars from the PriceHighest with MACDHighest or the PriceLowest with the MACDLowest fall together at the same time.

    #107301 quote
    Vonasi
    Moderator
    Master

    You keep posting little tiny snippets of information without actually apparently reading the answers that have already been given to you. Please gather a reasonable amount of useful information together and then post it in one post rather than firing off a million snippets!

    #107302 quote
    Malend
    Participant
    Average

    I was writing befor I saw your post coming in and then I send it 2 minutes after you posted it :-).
    But still, also in the 1 minute chart I have the same issue. See the Image attached

    img-4.jpg img-4.jpg
    #107305 quote
    Malend
    Participant
    Average

    Hi Vonasi,
    I am sorry for the amounts of posts. I will do my best to gather a reasanable amount of info.
    On the other hand, when I am busy to decribe my post and to attach the right images and paste the righ coding, I cannot see that you have posted just a few minutes befor. The platform needs te be reloaded in the browser to see that. When I do that,everything  have written for posting is gone. I read everything you have send immedeately when I see it.
    But again I will do my best.

    #107306 quote
    Vonasi
    Moderator
    Master

    My platform is closed now and I’m off to bed as it is 01215 here in Greece. My girlfriend returns to Greece tomorrow so my time for the forums will be more limited. You may need to be more patient for replies from me.

    #107307 quote
    Malend
    Participant
    Average

    Ah…that is good news for you. I know it is in the middle of the night for you. I am a night owl as well.
    Thanks for all your time.
    Sorry again for the many posts, I didn’t want to irritate you. I thought all was clear in the image of my 3rd post in the topic. But the indicator seemed harder then I expected. So therefor I sliced it in pieces.
    Sleep well. I go to bed as well. 1:25 here and tomorrow I will be on the road.
    Bye

    #107344 quote
    GraHal
    Participant
    Master

    The platform needs te be reloaded in the browser to see that. When I do that,everything  have written for posting is gone

    A good idea would be to have 2 tabs open showing the same Thread and then you can type away your answer in one tab. but before you send … refresh the other tab to check for more recent postings etc.  This way you will not lose what you have already typed.

    I may try and follow my own advice … especially on fast moving Topics! 🙂

Viewing 13 posts - 61 through 73 (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...