PROTECTED SOURCE SCRIPT

Ultimate MTF

17
//version=5
indicator("Ultimate MTF", shorttitle="Ultimate MTF", overlay=true)

// ============== EMA 13 (Court Terme - Accélérateur) ==============
ema13_enabled = input(true, title="Enable EMA 13", group="EMA 13")
ema13_period = input.int(13, title="EMA 13 Period", minval=1, group="EMA 13")
ema13_color = input(color.new(#FF6B35, 0), title="EMA 13 Color", group="EMA 13")

// ============== EMA 21 (Court Terme - Signal) ==============
ema21_enabled = input(true, title="Enable EMA 21", group="EMA 21")
ema21_period = input.int(21, title="EMA 21 Period", minval=1, group="EMA 21")
ema21_color = input(color.new(#004E89, 0), title="EMA 21 Color", group="EMA 21")

// ============== SMA 50 (Moyen Terme - Zone de Vérité) ==============
sma50_enabled = input(true, title="Enable SMA 50", group="SMA 50")
sma50_period = input.int(50, title="SMA 50 Period", minval=1, group="SMA 50")
sma50_color = input(color.new(#F7931E, 0), title="SMA 50 Color", group="SMA 50")

// ============== SMA 200 (Long Terme - Juge de Paix) ==============
sma200_enabled = input(true, title="Enable SMA 200", group="SMA 200")
sma200_period = input.int(200, title="SMA 200 Period", minval=1, group="SMA 200")
sma200_color = input(color.new(#43A047, 0), title="SMA 200 Color", group="SMA 200")

// ============== FUNCTION TO CALCULATE MA ==============
calcMA(period, maType, source) =>
switch maType
"SMA" => ta.sma(source, period)
"EMA" => ta.ema(source, period)
=> ta.ema(source, period)

// ============== CALCULATE MOVING AVERAGES ==============
ema13_value = ta.ema(close, ema13_period)
ema21_value = ta.ema(close, ema21_period)
sma50_value = ta.sma(close, sma50_period)
sma200_value = ta.sma(close, sma200_period)

// ============== PLOT MOVING AVERAGES ==============
plot(ema13_enabled ? ema13_value : na, title="EMA 13", color=ema13_color, linewidth=2)
plot(ema21_enabled ? ema21_value : na, title="EMA 21", color=ema21_color, linewidth=2)
plot(sma50_enabled ? sma50_value : na, title="SMA 50", color=sma50_color, linewidth=2)
plot(sma200_enabled ? sma200_value : na, title="SMA 200", color=sma200_color, linewidth=2)

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.