xoussamachoubix

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:
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

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.

Want to use this script on a chart?