OPEN-SOURCE SCRIPT

Simple Moving Averge Strategy

Simple Vs. Exponential Moving Averages
Formula for Exponential Moving Average (EMA)
\begin{aligned} &\begin{aligned} EMA_{\text{Today}}=&\left(\text{Value}_{\text{Today}}\ast\left(\frac{\text{Smoothing}}{1+\text{Days}}\right)\right)\\ &+EMA_{\text{Yesterday}}\ast\left(1-\left(\frac{\text{Smoothing}}{1+\text{Days}}\right)\right)\end{aligned}\\ &\textbf{where:}\\ &EMA=\text{Exponential moving average} \end{aligned}


EMA
Today

=


(Value
Today

∗(
1+Days
Smoothing

))
+EMA
Yesterday

∗(1−(
1+Days
Smoothing

))


where:
EMA=Exponential moving average




While there are many possible choices for the smoothing factor, the most common choice is:

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.