PROTECTED SOURCE SCRIPT
MTF 5 Moving Averages

//version=5
indicator("Multi-Timeframe 5 Moving Averages", shorttitle="MTF MA x5", overlay=true)
// ============== MOVING AVERAGE 1 ==============
ma1_enabled = input(true, title="Enable MA1", group="Moving Average 1")
ma1_period = input.int(9, title="MA1 Period", minval=1, group="Moving Average 1")
ma1_type = input.string("EMA", title="MA1 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 1")
ma1_color = input(color.new(#FF6B35, 0), title="MA1 Color", group="Moving Average 1")
// ============== MOVING AVERAGE 2 ==============
ma2_enabled = input(true, title="Enable MA2", group="Moving Average 2")
ma2_period = input.int(20, title="MA2 Period", minval=1, group="Moving Average 2")
ma2_type = input.string("EMA", title="MA2 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 2")
ma2_color = input(color.new(#004E89, 0), title="MA2 Color", group="Moving Average 2")
// ============== MOVING AVERAGE 3 ==============
ma3_enabled = input(true, title="Enable MA3", group="Moving Average 3")
ma3_period = input.int(50, title="MA3 Period", minval=1, group="Moving Average 3")
ma3_type = input.string("SMA", title="MA3 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 3")
ma3_color = input(color.new(#F7931E, 0), title="MA3 Color", group="Moving Average 3")
// ============== MOVING AVERAGE 4 ==============
ma4_enabled = input(true, title="Enable MA4", group="Moving Average 4")
ma4_period = input.int(100, title="MA4 Period", minval=1, group="Moving Average 4")
ma4_type = input.string("SMA", title="MA4 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 4")
ma4_color = input(color.new(#1E88E5, 0), title="MA4 Color", group="Moving Average 4")
// ============== MOVING AVERAGE 5 ==============
ma5_enabled = input(true, title="Enable MA5", group="Moving Average 5")
ma5_period = input.int(200, title="MA5 Period", minval=1, group="Moving Average 5")
ma5_type = input.string("EMA", title="MA5 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 5")
ma5_color = input(color.new(#43A047, 0), title="MA5 Color", group="Moving Average 5")
// ============== FUNCTION TO CALCULATE MA ==============
calcMA(period, maType, source) =>
switch maType
"SMA" => ta.sma(source, period)
"EMA" => ta.ema(source, period)
"WMA" => ta.wma(source, period)
=> ta.sma(source, period)
// ============== CALCULATE MOVING AVERAGES (CHART TIMEFRAME ONLY) ==============
ma1_value = calcMA(ma1_period, ma1_type, close)
ma2_value = calcMA(ma2_period, ma2_type, close)
ma3_value = calcMA(ma3_period, ma3_type, close)
ma4_value = calcMA(ma4_period, ma4_type, close)
ma5_value = calcMA(ma5_period, ma5_type, close)
// ============== PLOT MOVING AVERAGES ==============
plot(ma1_enabled ? ma1_value : na, title="MA1", color=ma1_color, linewidth=2)
plot(ma2_enabled ? ma2_value : na, title="MA2", color=ma2_color, linewidth=2)
plot(ma3_enabled ? ma3_value : na, title="MA3", color=ma3_color, linewidth=2)
plot(ma4_enabled ? ma4_value : na, title="MA4", color=ma4_color, linewidth=2)
plot(ma5_enabled ? ma5_value : na, title="MA5", color=ma5_color, linewidth=2)
indicator("Multi-Timeframe 5 Moving Averages", shorttitle="MTF MA x5", overlay=true)
// ============== MOVING AVERAGE 1 ==============
ma1_enabled = input(true, title="Enable MA1", group="Moving Average 1")
ma1_period = input.int(9, title="MA1 Period", minval=1, group="Moving Average 1")
ma1_type = input.string("EMA", title="MA1 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 1")
ma1_color = input(color.new(#FF6B35, 0), title="MA1 Color", group="Moving Average 1")
// ============== MOVING AVERAGE 2 ==============
ma2_enabled = input(true, title="Enable MA2", group="Moving Average 2")
ma2_period = input.int(20, title="MA2 Period", minval=1, group="Moving Average 2")
ma2_type = input.string("EMA", title="MA2 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 2")
ma2_color = input(color.new(#004E89, 0), title="MA2 Color", group="Moving Average 2")
// ============== MOVING AVERAGE 3 ==============
ma3_enabled = input(true, title="Enable MA3", group="Moving Average 3")
ma3_period = input.int(50, title="MA3 Period", minval=1, group="Moving Average 3")
ma3_type = input.string("SMA", title="MA3 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 3")
ma3_color = input(color.new(#F7931E, 0), title="MA3 Color", group="Moving Average 3")
// ============== MOVING AVERAGE 4 ==============
ma4_enabled = input(true, title="Enable MA4", group="Moving Average 4")
ma4_period = input.int(100, title="MA4 Period", minval=1, group="Moving Average 4")
ma4_type = input.string("SMA", title="MA4 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 4")
ma4_color = input(color.new(#1E88E5, 0), title="MA4 Color", group="Moving Average 4")
// ============== MOVING AVERAGE 5 ==============
ma5_enabled = input(true, title="Enable MA5", group="Moving Average 5")
ma5_period = input.int(200, title="MA5 Period", minval=1, group="Moving Average 5")
ma5_type = input.string("EMA", title="MA5 Type", options=["SMA", "EMA", "WMA"], group="Moving Average 5")
ma5_color = input(color.new(#43A047, 0), title="MA5 Color", group="Moving Average 5")
// ============== FUNCTION TO CALCULATE MA ==============
calcMA(period, maType, source) =>
switch maType
"SMA" => ta.sma(source, period)
"EMA" => ta.ema(source, period)
"WMA" => ta.wma(source, period)
=> ta.sma(source, period)
// ============== CALCULATE MOVING AVERAGES (CHART TIMEFRAME ONLY) ==============
ma1_value = calcMA(ma1_period, ma1_type, close)
ma2_value = calcMA(ma2_period, ma2_type, close)
ma3_value = calcMA(ma3_period, ma3_type, close)
ma4_value = calcMA(ma4_period, ma4_type, close)
ma5_value = calcMA(ma5_period, ma5_type, close)
// ============== PLOT MOVING AVERAGES ==============
plot(ma1_enabled ? ma1_value : na, title="MA1", color=ma1_color, linewidth=2)
plot(ma2_enabled ? ma2_value : na, title="MA2", color=ma2_color, linewidth=2)
plot(ma3_enabled ? ma3_value : na, title="MA3", color=ma3_color, linewidth=2)
plot(ma4_enabled ? ma4_value : na, title="MA4", color=ma4_color, linewidth=2)
plot(ma5_enabled ? ma5_value : na, title="MA5", color=ma5_color, linewidth=2)
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip dilindungi
Skrip ini diterbitkan sebagai sumber tertutup. Akan tetapi, anda boleh menggunakannya secara bebas dan tanpa apa-apa had – ketahui lebih di sini.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.