//@version=5 indicator(title='Maestro - MA Module', shorttitle='Maestro - MA', timeframe='',overlay=true ) 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 src = input(title='Calculation', defval=close) sma_source = input.string(title='MA Type', defval='EMA', options=['SMA', 'EMA', 'SMMA']) fast_length = input(title='Fast Length', defval=10) fast_offset = input(title='Fast Offset', defval=0) mid_length = input(title='Mid Length', defval=20) mid_offset = input(title='Mid Offset', defval=0) slow_length = input(title='Slow Length', defval=50) slow_offset = input(title='Slow Offset', defval=0) fast_color = color.new(#70ccbd30,0) mid_color = color.new(#f0629230,0) slow_color = color.new(#2962ff30,0) bullishColor = input.color(color.rgb(0,188,212,70),'Bullish Color', inline='Above') bearishColor = input.color(color.rgb(236,64,122,70), 'Bearish Color', inline='Above') //Calculations slowSpeed = sma_source == 'SMA' ? ta.sma(src, slow_length) : sma_source == 'EMA' ? ta.ema(src, slow_length) : smma(src, slow_length) midSpeed = sma_source == 'SMA' ? ta.sma(src, mid_length) : sma_source == 'EMA' ? ta.ema(src, mid_length) : smma(src, mid_length) fastSpeed = sma_source == 'SMA' ? ta.sma(src, fast_length) : sma_source == 'EMA' ? ta.ema(src, fast_length) : smma(src, fast_length) //Plotting pidSlow = plot(slowSpeed, title="Slow", style=plot.style_line, color=slow_color, offset=slow_offset, linewidth=3) pidMid = plot(midSpeed, title="Mid", style=plot.style_line, color=mid_color, offset=mid_offset, linewidth=3) pidFast = plot(fastSpeed, title="Fast", style=plot.style_line, color=fast_color, offset=fast_offset, linewidth=3) currColor = bullishColor if fastSpeed > slowSpeed currColor := bullishColor else currColor := bearishColor fill(pidFast, pidSlow, color=currColor, editable=false)