Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@version=5
- indicator(title='TSI MACD by Jwammo12', shorttitle='TSI_MACD_JW')
- // Getting inputs
- fast_length = input(title='Fast Length', defval=8)
- slow_length = input(title='Slow Length', defval=21)
- First_R = input(title='First R', defval=8)
- Second_S = input(title='Second S', defval=5)
- src = input(title='Source', defval=close)
- signal_length = input.int(title='Signal Smoothing', minval=1, maxval=50, defval=9)
- sma_signal = input(title='Simple MA(Signal Line)', defval=false)
- // Plot colors
- col_grow_above = #26A69A
- col_grow_below = #FFCDD2
- col_fall_above = #B2DFDB
- col_fall_below = #EF5350
- col_macd = #0094ff
- col_signal = #ff6a00
- // Calculating
- fast_ma = ta.ema(src, fast_length)
- slow_ma = ta.ema(src, slow_length)
- macd = fast_ma - slow_ma
- MTM = macd - macd[1]
- ABSMTM = math.abs(MTM)
- EMA_MTM = ta.ema(MTM, First_R)
- EMA_ABSMTM = ta.ema(ABSMTM, First_R)
- EMA2_MTM = ta.ema(EMA_MTM, Second_S)
- EMA2_ABSMTM = ta.ema(EMA_ABSMTM, Second_S)
- TSI = 100.0 * EMA2_MTM / EMA2_ABSMTM
- signal = sma_signal ? ta.sma(TSI, signal_length) : ta.ema(TSI, signal_length)
- hline(0)
- plot(TSI, title='TSI_MACD', color=color.new(col_macd, 0))
- plot(signal, title='Signal', color=color.new(col_signal, 0))
Advertisement
Add Comment
Please, Sign In to add comment