TradeZoro
Notifications

Cookbook

Simple moving average

The classic smooth line.

//@zscript 1
indicator("SMA", overlay=true)
len = input.int(20, "Length", minval=1)
plot(ta.sma(close, len), "SMA", color=#03c988, linewidth=2)
50365042504850535059
Sample bars, not market data. SMA.

How it works

The average of the last len closes. Longer length, smoother and slower line. Try: switch close for hl2 to average the middle of each bar instead.

Education only. Not financial advice. Examples are teaching samples, not trading results.

Zscript is coming soon

The manual opens when Zscript launches.

Back to home