Zig Zag High Low

Zig Zag script that uses local minimums and maximums as pivot points . It can be used as a source for pattern recognition.
Remove from Favorite Scripts Add to Favorite Scripts


Does it account for different timeframes?
+4 Reply
Tr0sT Virking_online
@Virking_online, it uses only "current" timeframe
Will this change the final leg after price moves?
+3 Reply
Tr0sT colibribull
@colibribull, yes, it can
+2 Reply
Here's the Enhancement I made based on your ZigZag Script.

Thanks again for your help! I love the community... Strength in numbers!

Trade well, and trade Long!

+1 Reply
Hey, Tr0st! Great indicator...

I'm trying to get the RSI to appear at the Pivot highs, but I can't figure out how to do it... it's always offset... I'm trying to use the code:

rsiVal = rsi(close, 14)

to get the RSI and, na, text=tostring(rsiVal),, textcolor=color.white, style=label.style_label_up, yloc=yloc.belowbar)

to add the label.

Can you help me with the final piece to this puzzle?

Tr0sT ocaptain
@ocaptain, use this line as a guidance
timeHigh - length, lastHigh,
timeLow - length, lastLow,
xloc.bar_index, color=_li_color, width=2

It contains coordinates of pivot points
@Tr0sT, Thanks for your response! Yep, I figured out the offset problem with that very line of code you pointed out... Now I just have a problem displaying the right value... I'm trying to make a running variable asking "if the current high is greater than the recorded high, get the RSI. Then when your code prints the line, I print the value of the RSI (14 close) above it but it never matches the value of the built-in indicator.

After your declaration of the 6 var's, I added:

var rsiVal = 0.0
if high > lastHigh
rsiVal := round(rsi(close, 14))

Then under the 'if dirup' line I added this to display the label:, na, text=tostring(rsiVal),, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar)

It's weird because the value displayed in the label isn't even an RSI value anywhere within the vicinity of the pivot high - I don't know where that value is coming from.

Again, I appreciate your help! -Anthony
Tr0sT ocaptain
@ocaptain, you prints current bar's rsi value to previous bar's pivot point
you need to change rsiVal calculation to somethink like this
rsiVal := (rsi(close, 14))(length)
use square brackets around length (TV does not allow to use them in comment)
@Tr0sT, Thanks, man! That did it... I also had to move the label line to the next code block because each pivot high was displaying the value of the *previous* pivot high. A few more tweaks to the code and I'll publish it to the community. Take care!
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out