Advertisement
Maurizio-Ciullo

Study Macd

Mar 30th, 2023
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © Maurizio-Ciullo
  3.  
  4. //@version=5
  5. indicator("Study Macd", overlay=false)
  6.  
  7. i_price_src     = input.source(title="Price Source", defval=close, group="g_macd")
  8. i_fast_length   = input.int(title="Fast Length", defval=12, group="g_macd")
  9. i_slow_length   = input.int(title="Slow Length", defval=26, group="g_macd")
  10. i_signal_length = input.int(title="Signal Smoothing", minval=1, maxval=50, defval=9, group="g_macd")
  11.  
  12.  
  13.  
  14. // Calculate MACD
  15. [macdLine, signalLine, histLine] = ta.macd(i_price_src, i_fast_length, i_slow_length, i_signal_length)
  16.  
  17. plot(macdLine, color=#2962FF)
  18. plot(signalLine, color=#FF6D00)
  19. plot(histLine, title="Histogram", style=plot.style_columns, color=(histLine>=0 ? (histLine[1] < histLine ? #26A69A : #B2DFDB) : (histLine[1] < histLine ? #FFCDD2 : #FF5252)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement