Zigzag Code does not update automatically

Forums ProRealTime English forum ProBuilder support Zigzag Code does not update automatically

Viewing 10 posts - 1 through 10 (of 10 total)
  • #216565

    Hello,

    I need to fix a problem I have with this code. The cumulative Histogram does not update the zigzag, to update I have to reset the indicator on the Intraday chart.

    Thank you very much, waiting for an answer.

     

    //PRC_CumulativeVolume ZigZag | indicator

    // — parameters
    percentVariation = 0.04

    zz = ZigZag[percentVariation](close)

    peak = zz<zz[1] and zz[1]>zz[2]
    tough = zz>zz[1] and zz[1]<zz[2]

    cumV = cumV+volume

    if peak then
    text = cumV/1000
    //drawtext(“#text#K”,barindex[1],cumV[1]+0.17*cumV[1],Dialog,Bold,12) coloured(0,200,0)
    //drawsegment(barindex[1],cumV[1]+0.20*cumV[1],previousX,previousY)
    cumV = Volume
    color = -1
    previousX = barindex[1]
    previousY = cumV[1]+0.20*cumV[1]
    elsif tough then
    text = cumV/1000
    //drawtext(“#text#K”,barindex[1],cumV[1]+0.23*cumV[1],Dialog,Bold,12) coloured(200,0,0)
    //drawsegment(barindex[1],cumV[1]+0.20*cumV[1],previousX,previousY)
    cumV = Volume
    color = 1
    previousX = barindex[1]
    previousY = cumV[1]+0.20*cumV[1]
    endif

    return cumV coloured by color

    #216577

    Try increasing the units on the graph, 1000 or more.

    #216626

    Thanks! But it’s already at 10k. Zigzag does not update, it continues with a normal histogram, but when I apply the indicator again in modify indicator yes, then it resumes the correct zig zag calculation

    #216631

    Sorry, I can’t figure out why.

     

    1 user thanked author for this post.
    #216649

    Because the zigzag is repainting, you want the indicator calculated upon it to recalculate the past datas also. With that code, it is not possible, that would need a complete rewrite of it.

    1 user thanked author for this post.
    #216655

    Hi Nicolas, thanks for the reply. (I guess the code is not strange for you right = ) ..) By the way, your indicators are great, they are amazing, thanks for sharing.
    The code works very well, I like it a lot, it’s very useful for me. Only that, on intraday I often (not always) have to enter “Modify indicator” and click on “Apply to…” so that the indicator “updates” the calculation. This often plots a different current histogram than it was…

    What is the path, what should I do, how would this rewrite be possible?

    best regards,
    Gustavo

    #216657

    Here are two examples, in the second screenshot after I entered Modify Incadtor and clicked Apply to… the indicator plotted the corrected cumulative histogram

    #216771

    Ok, so the below version will plot all the volumes accumulation from any top or bottom of the zigzag variation of “percentVariation”, from the current candle in the past of the chart, so it will repaint the whole indicator on each tick and therefore no need to reload it from time to time.

    I introduced a setting “BarsLimit” to fix how many volumes bars to be plotted in the past.

    #216779

    For reference, just added the indicator into the library: Cumulative Volume ZigZag (live version)

    1 user thanked author for this post.
    #218173

    Hello Nicolas,

    thank you very much!!! I will test this! Tks!

Viewing 10 posts - 1 through 10 (of 10 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login