//@version=5 indicator(title='Maestro - Crescendo', shorttitle='Maestro - Crescendo', timeframe='') smma(src, length) => smma = 0.0 curr_smma = ta.sma(src, length) smma := na(smma[1]) ? curr_smma : (smma[1] * (length - 1) + src) / length smma // Getting inputs fast_length = input(title='Fast', defval=10) slow_length = input(title='Slow', defval=50) src = input(title='Calculation', defval=close) ma_offset = input(title='MA Offset', defval=0) sma_source = input.string(title='Oscillator Type', defval='EMA', options=['SMA', 'EMA', 'SMMA']) // Plot colors col_grow_above = color(#26A69A50) col_fall_above = color(#B2DFDB50) col_grow_below = color(#FFCDD250) col_fall_below = color(#FF525250) // Calculating fast_ma = sma_source == 'SMA' ? ta.sma(src, fast_length) : sma_source == 'EMA' ? ta.ema(src, fast_length) : smma(src, fast_length) slow_ma = sma_source == 'SMA' ? ta.sma(src, slow_length) : sma_source == 'EMA' ? ta.ema(src, slow_length) : smma(src, slow_length) speed = fast_ma - slow_ma lineColor = color.green if speed <= 0 lineColor := color.red x1 = plot(speed, title='Upper', color=lineColor, linewidth=4, offset=ma_offset, editable=false) speedm = speed * -1 x2 = plot(speedm, title='Lower', color=lineColor, linewidth=4, offset=ma_offset, editable=false) fill(x1, x2, editable=false, color=speed >= 0 ? speed[1] < speed ? col_grow_above : col_fall_above : speed[1] < speed ? col_grow_below : col_fall_below)