
EMA value changed during zoom in/out 
Posted by Brian Hui on Feb052024 23:22 

Hi Peter,
We found that the EMA value of the finance chart is slightly changed during zoom in/out or drag the chart to left or right. It is no problem when EMA with smaller value (e.g. EMA 10, 20) but has problem on larger value (e.g. EMA 50). Do you have any idea? Thanks!
Regards,
Brian

Re: EMA value changed during zoom in/out 
Posted by Peter Kwan on Feb062024 01:17 

Hi Brian,
This is normal. I have just tried the charts in Yahoo Finance and it is the same behaviour  the EMA depends on the zoom level.
I believe most technical indicators are not invented by mathematician. As a result, many of the indicators are inconsistent. For the EMA, by definition, the 50 day EMA is computer using:
EMA(today) = ClosingPrice * 2/51 + EMA(yesterday) * 49/51
Thus to compute today's EMA, you must know yesterday's EMA. To computer yesterday's EMA, you must know the day before yesterday's EMA. This definition is an infinite recursion and is not possible to compute. We need to assume the EMA of a "starting date" to be the closing price itself, then we can start the computation from there onwards.
Because the starting date can depend on the zoom level, so the EMA can differ depending on the zoom level.
The inconsistency effect is less severe if the extra points is significantly larger than the EMA period. For example, if you have 50 days EMA, and you provide 100 extra points, although the EMA can still differ, it will be less than if only 30 extra points are used. It also explains why the effect is smaller for 10 or 20 days EMA.
Best Regards
Peter Kwan 
Re: EMA value changed during zoom in/out 
Posted by Brian Hui on Feb062024 18:32 

It's ok. Thanks for your reply! 
