TradingView
lmatl
7 de Fev de 2021 19:13

zigzag support&resistance levels [LM] 

Bitcoin / TetherUSBinance

Descrição

Hello Traders,

I would like to introduce you zigzag support&resistance levels. It is based on the ZigZag semafor script made by DevLucem so shout out to him

The Semafor is used to spot future multi-level Supports and Resistance zones.
It is also useful to spot HL or LL or HH or LH zones at different Depth settings.

The red zones are the extreme places where the market has a higher chance of reversing while the green zones have the lowest setting with lower chances of the market reversal

I have refactored script and extended it with the horizontals.

The lines can be extended like so if you want to see


The lines also can expire when the price will reach it you can change this in general settings:


Also you can use view from the original script with just label circles



Enjoy!

Notas de Lançamento

added alert on confirmation of new level, add it to your alarms and you will start getting alerts New level have been confirmed and details about which ones

Notas de Lançamento

alert is now shown only for visible levels

Notas de Lançamento

fix of alert behavior

Notas de Lançamento

update to version 5
Comentários
iamlearner
@vinikumar72 Price labels are displaying on left side. Most of labels are overlapping on chart and difficult to read levels.
Is it possible to plot all price label on right side where lines are ending. This will very helpful to read prices.
Looking for new updated version on my master script.
Thank you for sharing great script with users.
lmatl
@iamlearner, I have today released new script that includes multi timeframe behavior
abkssj5
Very clean :)
Script 💖
hoanghung90
Hello lmatl, Thank you for sharing many indicators. I'm trying to edit the code to make it multi-timeframe tool but still don't know how. What I mean is that when I am on the current timeframe it will show the lines on the larger timeframe that I want. Hope to get help from you.
hoanghung90
//@version=5

indicator('zigzag support&resistance levels [LM]', shorttitle='Zigzag S/R [LM]', overlay=true)

_1 = input(false, '══════ general setting ══════════════════════════════')
i_drawLines = input(true, 'Draw lines or just labels')
i_lineCount = input(10, 'Line count')
i_extendLines = input(true, 'Extend lines')

_2 = input(false, '══════ zigzag setting 1 ══════════════════════════════')
i_showFirst = input(false, 'Show first')
i_firstDepth = input(12, 'Depth')
i_firstDeviation = input(5, 'Deviation')
i_firstColor = input(color.red, 'Color')

var zigZagArray = array.new_line()
var zigZagLabelArray = array.new_label()

f_zigzag(_depth, _deviation) =>
var lw = 1
var hg = 1
lw += 1
hg += 1
lowestValue = -ta.lowestbars(_depth)
highestValue = -ta.highestbars(_depth)
lowing = lw == lowestValue or low - low[lowestValue] > _deviation * syminfo.mintick
highing = hg == highestValue or high[highestValue] - high > _deviation * syminfo.mintick
lh = ta.barssince(not highing)
ll = ta.barssince(not lowing)
down = lh > ll
lower = low[lw] > low[lowestValue]
higher = high[hg] < high[highestValue]
if lw != lowestValue and (not down[1] or lower)
lw := lowestValue < hg ? lowestValue : 0
lw
if hg != highestValue and (down[1] or higher)
hg := highestValue < lw ? highestValue : 0
hg
x1 = down ? lw : hg
y1 = down ? low[lw] : high[hg]
lb = down ? label.style_label_up : label.style_label_down
[down != down[1], x1, y1, lw, hg, down]

f_drawLine(_x1, _x2, _yValue, _lineColor) =>
line.new(x1=_x1, y1=_yValue, x2=_x2, y2=_yValue, color=_lineColor, style=line.style_dotted, width=2)

f_drawLabel(_x, _y, _textColor) =>
label.new(_x, _y, '         ' + str.tostring(_y), xloc.bar_index, yloc.price, #00000000, label.style_none, _textColor)

f_extendArray(_lineArray, _extendLines) =>
if array.size(_lineArray) > 0
for _i = array.size(_lineArray) - 1 to 0 by 1

x2 = line.get_x2(array.get(_lineArray, _i))
yValue = line.get_y1(array.get(_lineArray, _i))

if _extendLines or bar_index - 1 == x2 and not(high > yValue and low < yValue)
line.set_x2(array.get(_lineArray, _i), bar_index)

f_drawLabelSemafor(_switch, _x1, _y1, _lw, _hg, _down, _colorLine, _size) =>
label point = na
if _down != _down[1]
nx = _down ? _hg : _lw
point := label.new(bar_index - nx, _down ? high[nx] : low[nx], color=_colorLine, style=label.style_circle, size=_size)
point

f_addLine(_switch, _x1, _y1, _lw, _hg, _down, _colorLine) =>
if _switch
line l = na
label lab = na

nx = _down ? _hg : _lw
yValue = _down ? high[nx] : low[nx]
x1 = bar_index - nx
x2 = bar_index

if _down != _down[1]
l := f_drawLine(x1, x2, yValue, _colorLine)
lab := f_drawLabel(x1, yValue, _colorLine)
lab

if array.size(zigZagArray)
niknickt
Would it be possible to add BREAK alert if price cross over or under the zigzag support & resistance?
suhas316
This is D Best indicator I have used on Tradingview. I am using it from more than a month and after that I making a comment. Super script. I just want to know ... How I can add buy or sell label .... below or above d candle which breaks ( only for candle which close above or below, resistance or support )support or resistance ? Cau u please help...
Thanks alot :)
Alunova
Dear Indicator too good can you add daily, weekly and monthly Tf and also option for closing price line. So this indicator can plot all swing levels. Price label on right side or show on Scale .. Thanks in advance
shielavisuals
excellent script sir :) but how can we add the MTF function specially when using the orginal script semafor ?
Mais