xmd79

Cavuca Análise Técnica

Nov 20th, 2021
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.69 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. ///\\===============================================================================//\\\
  3. //████████╗██████╗ █████╗ ██████╗ ██╗███╗ ██╗ ██████╗ ██╗ ██╗██╗███████╗██╗ ██╗\\
  4. //╚══██╔══╝██╔══██╗██╔══██╗██╔══██╗██║████╗ ██║██╔════╝ ██║ ██║██║██╔════╝██║ ██║\\
  5. // ██║ ██████╔╝███████║██║ ██║██║██╔██╗ ██║██║ ███╗██║ ██║██║█████╗ ██║ █╗ ██║\\
  6. // ██║ ██╔══██╗██╔══██║██║ ██║██║██║╚██╗██║██║ ██║╚██╗ ██╔╝██║██╔══╝ ██║███╗██║\\
  7. // ██║ ██║ ██║██║ ██║██████╔╝██║██║ ╚████║╚██████╔╝ ╚████╔╝ ██║███████╗╚███╔███╔╝\\
  8. // ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═══╝ ╚═╝╚══════╝ ╚══╝╚══╝ \\
  9. //\\==============================================================================//\\ \\
  10. // ----------------------------------------------------------------------------------- \\
  11. // INDICADOR CAVUCA ANALISE TÉCNICA: Desenvolvido por Cavuca-Trader \\
  12. // ----------------------------------------------------------------------------------- \\
  13. // ................................................................................... \\
  14. // Nome : Indicador Cavuca Análise Técnica \\
  15. // Apelido : Cavuca \\
  16. // Descrição : Setup de análise técnica \\
  17. // Info : Sinaliza entradas e saidas através de coloração técnica \\
  18. // Data de Criação : 20/11/2021 \\
  19. // Versão : 4 \\
  20. // ................................................................................... \\
  21. // v1.0 - release = TrandingView = Ok \\
  22. //=====================================================================================\\
  23. // © Cavuca-Trader
  24. //@version=5
  25. indicator(title='Cavuca Análise Técnica', shorttitle='Cavuca Análise Técnica', overlay=true)
  26.  
  27. // Parametros para o zigzag
  28. length = input(4, title='High/Low length')
  29. h = ta.highest(high, length * 2 + 1)
  30. l = ta.lowest(low, length * 2 + 1)
  31. f_isMin(len) =>
  32. l == low[len]
  33. f_isMax(len) =>
  34. h == high[len]
  35.  
  36. //Parametros
  37. MMR = input.int(9, minval=1, title='Média Móvel Rápida')
  38. MMM = input.int(21, minval=1, title='Média Móvel Média')
  39. MML = input.int(200, minval=1, title='Média Móvel Lenta')
  40. src = input(close, title='Source')
  41. offset = input.int(title='Offset', defval=0, minval=-500, maxval=500)
  42.  
  43. //Calculo
  44. MM1 = ta.sma(src, MMR)
  45. MM2 = ta.sma(src, MMM)
  46. MM3 = ta.sma(src, MML)
  47.  
  48. // Calculo para o ZigZag
  49. var dirUp = false
  50. var lastLow = high * 100
  51. var lastHigh = 0.0
  52. var timeLow = bar_index
  53. var timeHigh = bar_index
  54. var line li = na
  55. var topo = 0.0
  56. var fundo = high * 100
  57.  
  58. f_drawLine() =>
  59. _li_color = dirUp ? color.teal : color.orange
  60. line.new(timeHigh - length, lastHigh, timeLow - length, lastLow, xloc.bar_index, color=_li_color, width=1)
  61.  
  62. if dirUp
  63. if f_isMin(length) and low[length] < lastLow
  64. lastLow := low[length]
  65. timeLow := bar_index
  66. line.delete(li)
  67. li := f_drawLine()
  68. li
  69.  
  70. if f_isMax(length) and high[length] > lastLow
  71. lastHigh := high[length]
  72. timeHigh := bar_index
  73. topo := lastHigh
  74. dirUp := false
  75. li := f_drawLine()
  76. li
  77.  
  78. if not dirUp
  79. if f_isMax(length) and high[length] > lastHigh
  80. lastHigh := high[length]
  81. timeHigh := bar_index
  82. line.delete(li)
  83. li := f_drawLine()
  84. li
  85.  
  86. if f_isMin(length) and low[length] < lastHigh
  87. lastLow := low[length]
  88. timeLow := bar_index
  89. fundo := lastLow
  90. dirUp := true
  91. li := f_drawLine()
  92. if f_isMax(length) and high[length] > lastLow
  93. lastHigh := high[length]
  94. timeHigh := bar_index
  95. dirUp := false
  96. li := f_drawLine()
  97. li
  98.  
  99. //Regra de coloração dos candles
  100. Dgbar = close > topo
  101. Drbar = close < fundo
  102. Dwbar = close < topo and close > fundo
  103.  
  104. //Coloração dos candles
  105. barcolor(Dgbar ? color.green : na)
  106. barcolor(Drbar ? color.red : na)
  107. barcolor(Dwbar ? color.white : na)
  108.  
  109. // Plotagem
  110. plot(MM1, color=color.new(color.red, 0), title='MMR', offset=offset, linewidth=1)
  111. plot(MM2, color=color.new(color.blue, 0), title='MMM', offset=offset, linewidth=1)
  112. plot(MM3, color=color.new(color.white, 0), title='MML', offset=offset, linewidth=1)
  113. plot(fundo, color=color.new(color.green, 0), title='Fundo', offset=-length, style=plot.style_cross, linewidth=1)
  114. plot(topo, color=color.new(color.red, 0), title='Topo', offset=-length, style=plot.style_cross, linewidth=1)
  115.  
  116.  
  117.  
Advertisement
Add Comment
Please, Sign In to add comment