Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- ///\\===============================================================================//\\\
- //████████╗██████╗ █████╗ ██████╗ ██╗███╗ ██╗ ██████╗ ██╗ ██╗██╗███████╗██╗ ██╗\\
- //╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██║████╗ ██║██╔════╝ ██║ ██║██║██╔════╝██║ ██║\\
- // ██║ ██████╔╝███████║██║ ██║██║██╔██╗ ██║██║ ███╗██║ ██║██║█████╗ ██║ █╗ ██║\\
- // ██║ ██╔══██╗██╔══██║██║ ██║██║██║╚██╗██║██║ ██║╚██╗ ██╔╝██║██╔══╝ ██║███╗██║\\
- // ██║ ██║ ██║██║ ██║██████╔╝██║██║ ╚████║╚██████╔╝ ╚████╔╝ ██║███████╗╚███╔███╔╝\\
- // ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═══╝ ╚═╝╚══════╝ ╚══╝╚══╝ \\
- //\\==============================================================================//\\ \\
- // ----------------------------------------------------------------------------------- \\
- // INDICADOR CAVUCA ANALISE TÉCNICA: Desenvolvido por Cavuca-Trader \\
- // ----------------------------------------------------------------------------------- \\
- // ................................................................................... \\
- // Nome : Indicador Cavuca Análise Técnica \\
- // Apelido : Cavuca \\
- // Descrição : Setup de análise técnica \\
- // Info : Sinaliza entradas e saidas através de coloração técnica \\
- // Data de Criação : 20/11/2021 \\
- // Versão : 4 \\
- // ................................................................................... \\
- // v1.0 - release = TrandingView = Ok \\
- //=====================================================================================\\
- // © Cavuca-Trader
- //@version=5
- indicator(title='Cavuca Análise Técnica', shorttitle='Cavuca Análise Técnica', overlay=true)
- // Parametros para o zigzag
- length = input(4, title='High/Low length')
- h = ta.highest(high, length * 2 + 1)
- l = ta.lowest(low, length * 2 + 1)
- f_isMin(len) =>
- l == low[len]
- f_isMax(len) =>
- h == high[len]
- //Parametros
- MMR = input.int(9, minval=1, title='Média Móvel Rápida')
- MMM = input.int(21, minval=1, title='Média Móvel Média')
- MML = input.int(200, minval=1, title='Média Móvel Lenta')
- src = input(close, title='Source')
- offset = input.int(title='Offset', defval=0, minval=-500, maxval=500)
- //Calculo
- MM1 = ta.sma(src, MMR)
- MM2 = ta.sma(src, MMM)
- MM3 = ta.sma(src, MML)
- // Calculo para o ZigZag
- var dirUp = false
- var lastLow = high * 100
- var lastHigh = 0.0
- var timeLow = bar_index
- var timeHigh = bar_index
- var line li = na
- var topo = 0.0
- var fundo = high * 100
- f_drawLine() =>
- _li_color = dirUp ? color.teal : color.orange
- line.new(timeHigh - length, lastHigh, timeLow - length, lastLow, xloc.bar_index, color=_li_color, width=1)
- if dirUp
- if f_isMin(length) and low[length] < lastLow
- lastLow := low[length]
- timeLow := bar_index
- line.delete(li)
- li := f_drawLine()
- li
- if f_isMax(length) and high[length] > lastLow
- lastHigh := high[length]
- timeHigh := bar_index
- topo := lastHigh
- dirUp := false
- li := f_drawLine()
- li
- if not dirUp
- if f_isMax(length) and high[length] > lastHigh
- lastHigh := high[length]
- timeHigh := bar_index
- line.delete(li)
- li := f_drawLine()
- li
- if f_isMin(length) and low[length] < lastHigh
- lastLow := low[length]
- timeLow := bar_index
- fundo := lastLow
- dirUp := true
- li := f_drawLine()
- if f_isMax(length) and high[length] > lastLow
- lastHigh := high[length]
- timeHigh := bar_index
- dirUp := false
- li := f_drawLine()
- li
- //Regra de coloração dos candles
- Dgbar = close > topo
- Drbar = close < fundo
- Dwbar = close < topo and close > fundo
- //Coloração dos candles
- barcolor(Dgbar ? color.green : na)
- barcolor(Drbar ? color.red : na)
- barcolor(Dwbar ? color.white : na)
- // Plotagem
- plot(MM1, color=color.new(color.red, 0), title='MMR', offset=offset, linewidth=1)
- plot(MM2, color=color.new(color.blue, 0), title='MMM', offset=offset, linewidth=1)
- plot(MM3, color=color.new(color.white, 0), title='MML', offset=offset, linewidth=1)
- plot(fundo, color=color.new(color.green, 0), title='Fundo', offset=-length, style=plot.style_cross, linewidth=1)
- plot(topo, color=color.new(color.red, 0), title='Topo', offset=-length, style=plot.style_cross, linewidth=1)
Advertisement
Add Comment
Please, Sign In to add comment