OPEN-SOURCE SCRIPT

MA

30
//version=5
indicator("MA20 và EMA9", overlay=true)

// === Input tham số ===
lengthMA = input.int(20, "Độ dài MA", minval=1)
lengthEMA = input.int(9, "Độ dài EMA", minval=1)

// === Tính toán đường trung bình ===
ma20 = ta.sma(close, lengthMA) // Simple Moving Average 20
ema9 = ta.ema(close, lengthEMA) // Exponential Moving Average 9

// === Vẽ ra biểu đồ ===
plot(ma20, color=color.red, linewidth=2, title="MA20")
plot(ema9, color=color.blue, linewidth=2, title="EMA9")

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.