TraderKevin
New member
- Joined
- Aug 6, 2020
- Messages
- 4
I am working on creating my first algorithm to trade on the stock market, and I am stumped in coming up with a formula to calculate the point of intersection between price and a 5 period Exponential Moving Average (EMA). Here are the details:
The formula to calculate an EMA is: EMA = Price * (2 / (period + 1)) + EMA(of the previous period) * (1 - (2 / period + 1))
To simplify this for my chosen period of 5, I've got: EMA = (Price + 2 * EMA(previous)) / 3
Now, I need to figure out what price would be required for price = EMA. The variables I will know at the time of calculation are the previous EMA and the current price. As price gets closer to the plot of the EMA, though, the EMA moves away from it at a slower rate (by the ratio given by the formula).
A formula based on the original EMA formula would be most helpful, but one based on the simplified formula using a period of 5 would be amazing as well. Any help at all is greatly appreciated!
The formula to calculate an EMA is: EMA = Price * (2 / (period + 1)) + EMA(of the previous period) * (1 - (2 / period + 1))
To simplify this for my chosen period of 5, I've got: EMA = (Price + 2 * EMA(previous)) / 3
Now, I need to figure out what price would be required for price = EMA. The variables I will know at the time of calculation are the previous EMA and the current price. As price gets closer to the plot of the EMA, though, the EMA moves away from it at a slower rate (by the ratio given by the formula).
A formula based on the original EMA formula would be most helpful, but one based on the simplified formula using a period of 5 would be amazing as well. Any help at all is greatly appreciated!