Advertisement
NKactive

Untitled

Aug 17th, 2023
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 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. // © NKactive
  3.  
  4. //@version=5
  5. indicator("MACD Indicator NK v1.0", overlay=true)
  6. // ****************************************************************************************************************************************************************
  7. macdFast = input.int(defval = 12, title="macdFast")
  8. macdSlow = input.int(defval = 26, title="macdSlow")
  9. sigLen = input.int(defval = 9, title="macdSig")
  10.  
  11.  
  12. [macdFastPlot, macdSlowPlot, sigLenPlot] = ta.macd(close, macdFast, macdSlow, sigLen)
  13. plot(macdFastPlot, color = color.fuchsia, linewidth = 2)
  14. plot(macdSlowPlot, color = color.lime, linewidth = 2)
  15. plot(sigLenPlot, color = color.blue, linewidth = 2)
  16.  
  17. buySignal = ta.crossover(sigLenPlot, macdFastPlot) // blue over pink
  18. sellSignal = ta.crossunder(sigLenPlot, macdFastPlot) // blue under pink
  19.  
  20. // buySignal = ta.crossover(sigLenPlot, macdFastPlot) or ta.crossover(sigLenPlot, macdSlowPlot) // blue over green or pink
  21. // sellSignal = ta.crossunder(sigLenPlot, macdFastPlot) or ta.crossunder(sigLenPlot, macdSlowPlot)// blue under green or pink
  22.  
  23. plotshape(buySignal ? close : na, title="Buy", style=shape.triangleup, color=color.green, location=location.belowbar, size = size.small)
  24. plotshape(sellSignal ? close : na, title="Sell", style=shape.triangledown, color=color.red, size = size.small)
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement