//@version=4
study(title="Moving Average Example", shorttitle="MA Example", overlay=true)
// Thiết lập độ dài của Moving Average
length = input(20, minval=1, title="Length")
// Tính toán giá trị trung bình động
sma_value = sma(close, length)
// Hiển thị giá trị trung bình động trên biểu đồ
plot(sma_value, color=color.blue, linewidth=2, title="Moving Average")