⭐ sherbaaz Posted April 23, 2021 Report Share Posted April 23, 2021 hi, all below is the code of zigzag high low. on selecting length to a high number of bars like 16 on 1 min time frame it compressed the chart vertically. any solution to remove the compression? kindly help if anybody is good in coding //@version=4 study("Zig Zag High Low", overlay = true) length = input(4, title = "High/Low length") h = highest(high, length * 2 + 1) l = lowest(low, length * 2 + 1) f_isMin(len) => l == low[len] f_isMax(len) => h == high[len] var dirUp = false var lastLow = high * 100 var lastHigh = 0.0 var timeLow = bar_index var timeHigh = bar_index var line li = na f_drawLine() => _li_color = dirUp ? color.teal : color.orange line.new( timeHigh - length, lastHigh, timeLow - length, lastLow, xloc.bar_index, color=_li_color, width=2 ) if dirUp if (f_isMin(length) and low[length] < lastLow) lastLow := low[length] timeLow := bar_index line.delete(li) li := f_drawLine() if (f_isMax(length) and high[length] > lastLow) lastHigh := high[length] timeHigh := bar_index dirUp := false li := f_drawLine() if not dirUp if (f_isMax(length) and high[length] > lastHigh) lastHigh := high[length] timeHigh := bar_index line.delete(li) li := f_drawLine() if f_isMin(length) and low[length] < lastHigh lastLow := low[length] timeLow := bar_index dirUp := true li := f_drawLine() if (f_isMax(length) and high[length] > lastLow) lastHigh := high[length] timeHigh := bar_index dirUp := false li := f_drawLine() Quote Link to comment Share on other sites More sharing options...
⭐ VON KRIEGER Posted April 25, 2021 Report Share Posted April 25, 2021 upload codes in Pastebin , here alignment get disturbed ⭐ sherbaaz 1 Quote Link to comment Share on other sites More sharing options...
⭐ VON KRIEGER Posted April 25, 2021 Report Share Posted April 25, 2021 https://ibb.co/PTFLC06 ⭐ sherbaaz 1 Quote Link to comment Share on other sites More sharing options...
⭐ VON KRIEGER Posted April 25, 2021 Report Share Posted April 25, 2021 Try this https://pastebin.com/4h7QruKj it should work properly , https://ibb.co/zJ5tW1b also keep the scale on auto ⭐ sherbaaz 1 Quote Link to comment Share on other sites More sharing options...
⭐ sherbaaz Posted April 25, 2021 Author Report Share Posted April 25, 2021 thanks a lot! ⭐ VON KRIEGER 1 Quote Link to comment Share on other sites More sharing options...
vollalaharsha Posted October 31, 2023 Report Share Posted October 31, 2023 Its useful bro Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.