Jump to content
  • 0

How is EMA50 and EMA200 being calculated on the charts as it looks non-standard?


mgwuk

Question

I downloaded historical data from the US 500 via the API. I verified that the 320 data points I downloaded match the UI on the graph. When I calculate the EMA50 and EMA200 on my dataset correctly I get a different result to what is shown on the IG charts. I thought it may a precision difference that could cause the small difference I'm seeing but I checked that and that looks okay to me. I checked my dataset and it's clean without missing data.

I'm doing my calculation in Python as follows:

# Apply the exponential moving averages
df_ta["ema50"] = df_ta["close"].ewm(span=50, adjust=False).mean()
df_ta["ema200"] = df_ta["close"].ewm(span=200, adjust=False).mean()


Just for interest sake I checked the SMA50 and SMA200 and they are an exact match.

There is something strange about the EMA calculation on the charts. Does anyone know what it is?
 

Link to comment

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

Hi mgwuk

Glad you posed this question as I have been trying for the last number of weeks to ask the same question of IG and am still waiting on a response. Did you come up with an answer?

My workings below on how to calculate EMA clearly does not match IG Chart using IG data and EMA indicator and the method provided by IG which can be calculated as follows for example for EMA21:
 
where:
k = smoothing parameter which is 2/(lookback period+1) or for EMA21 is 2/(21+1) = 0.0909091
EMAt = previous candle EMA21 value
 
Both formulae below result in same value
EMA21 = k * close price + (1-k) * EMAt
or
EMA21 = EMAt + k *(close price-EMAt)
 
The following values in blue are taken from the 5 minute interval Nikkei 225 Japan Cash from IG charts looking at EMA21.
 
You can see from the table below the difference in calculated values using the above formula versus the IG chart data.
 
Sydney Time
Close Price
calc_EMA21
IGchart_EMA21
11/04/2024 1:25
39282.2
11/04/2024 1:30
39252.2
11/04/2024 1:35
39192.2
11/04/2024 1:40
39167.2
11/04/2024 1:45
39172.2
 
Obviously, the chart data is using a different formula. The SMA values align perfectly as you found.
 
Edited by Bliz_23
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • image.png

  • Posts

    • Elliott Wave Analysis TradingLounge Daily Chart, Ripple/ U.S. dollar(XRPUSD) XRPUSD Elliott Wave Technical Analysis  Function: Counter Trend Mode: Corrective Structure: Triangle Position: Wave E Direction Next higher Degrees: wave 4 of Impulse Wave Cancel invalid level: 0.486 Details: Movement within the triangle pattern before the price Declines again in Wave 5. Ripple/ U.S. dollar(XRPUSD)Trading Strategy: Decreasing wave ((E)), which is the last wave in the Triangle pattern before prices re-enter the uptrend. So wait for the correction to complete to join the trend again. Ripple/ U.S. dollar(XRPUSD)Technical Indicators: The price is below the MA200 indicating a downtrend, The Wave Oscillator is a Bearish Momentum.   Elliott Wave Analysis TradingLounge H4 Chart, Ripple/ U.S. dollar(XRPUSD) XRPUSD Elliott Wave Technical Analysis  Function: Counter Trend Mode: Corrective Structure: Triangle Position: Wave E Direction Next higher Degrees: wave 4 of Impulse Wave Cancel invalid level: 0.486 Details: Movement within the triangle pattern before the price Declines again in Wave 5. Ripple/ U.S. dollar(XRPUSD)Trading Strategy: Decreasing wave ((E)), which is the last wave in the Triangle pattern before prices re-enter the uptrend. So wait for the correction to complete to join the trend again. Ripple/ U.S. dollar(XRPUSD)Technical Indicators: The price is below the MA200 indicating a downtrend, The Wave Oscillator is a Bearish Momentum.   Technical Analyst : Kittiampon Somboonsod Source : Tradinglounge.com get trial here!  
    • @KoketsoIG Thanks. How soon can we expect an update on the release date? It's been a couple of years with the same update: "we are currently waiting for the product team." We just want to make sure to have a rough estimate.
    • Blast sounds promising with its focus on faster transactions and native yield generation. I'm curious to see how it compares to Polygon and Arbitrum in terms of user experience and adoption. Excited for its listing on Bitget and its potential impact on DeFi scalability!
×
×
  • Create New...
us