ZigZag with percent?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #174601 quote
    AnamaTrader
    Participant
    New

    Hi all,

    I am fairly new to these forms, but have been looking around for an indicator such as the ZigZag but that also prints the percent of the “rotation” as a bubble on the chart. as seem to be available in some other platforms. Basically, just the ZigZagPct rather than just ZigZag, where we choose a certain threshold for a rotation up or down, and the line is drawn etc, but also when is passes the threshold prints (and updates) the actual percent change no the chart. Much like what for example Brian Watt is using. i have been think of constructing it myself, but I figured someone here is likely to have already done this perhaps. Any tip os help is welcome!

    I am attaching a screenshot of an exmple what it might look like

    ZigZagPct-example.jpg ZigZagPct-example.jpg
    #174627 quote
    robertogozzi
    Moderator
    Master

    There you go, simply add it to your chart as well as built-in ZigZag:

    //DEFPARAM DrawOnLastBarOnly = true
    //ONCE p       = 200
    ONCE LastPeak  = 0
    ONCE Up        = 1
    ONCE Down      = -Up
    ONCE PeakUP1   = close
    ONCE PeakUP2   = close
    ONCE PeakDN1   = close
    ONCE PeakDN2   = close
    X              = average[100,0](range) / 3    //offset to plot percentages
    ZZ             = ZigZagPoint[p](close)
    PeakUP         = (ZZ[1] > ZZ[2]) AND (ZZ < ZZ[1])
    PeakDN         = (ZZ[1] < ZZ[2]) AND (ZZ > ZZ[1])
    IF PeakUP AND ((LastPeak = Down) OR (LastPeak = 0)) THEN
       LastPeak    = Up
       PeakUPprice = close[1]
       PerCent     = (PeakUPprice * 100 / PeakDNprice) - 100
       DrawText("#PerCent#",BarIndex[1],high[1] + X,Dialog,Bold,12) coloured(0,128,0,140)
    ELSIF PeakDN AND ((LastPeak = Up) OR (LastPeak = 0)) THEN
       LastPeak    = Down
       PeakDNprice = close[1]
       PerCent     = (PeakDNprice * 100 / PeakUPprice) - 100
       DrawText("#PerCent#",BarIndex[1],low[1] - X,Dialog,Bold,12) coloured(255,0,0,255)
    ENDIF
    RETURN
    AnamaTrader thanked this post
    x-5.jpg x-5.jpg MyZigZag.itf
    #174635 quote
    AnamaTrader
    Participant
    New

    Great! thank you. this will work fine. thanks a lot for your quick help!

    #176709 quote
    thebaron
    Participant
    Average

    hello

    is it possible to have it in value also (exemple for futur contract in points) to have the choice betwen percent and value ?

    sincerely eric

    #176775 quote
    robertogozzi
    Moderator
    Master

    What do you mean by “futur contract in points“?

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

ZigZag with percent?


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 4 replies,
has 3 voices, and was last updated by robertogozzi
4 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 08/03/2021
Status: Active
Attachments: 3 files
Logo Logo
Loading...