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
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
Great! thank you. this will work fine. thanks a lot for your quick help!
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
What do you mean by “futur contract in points“?