☰
Login
Signup
Home
›
Algorithms and Strategies
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.9K
All Categories
0
Incidents
154
Node JS client
40
Go client
793
.Net API client
378
Kite Publisher
537
.Net / VBA / Excel (3rd party)
457
Algorithms and Strategies
994
Java client
1.1K
API clients
404
PHP client
4K
Python client
346
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
February 2022
anandn
January 2022
sujith
EMA calculation formula - Zerodha
renishkhunt
January 2022
edited January 2022
in
Algorithms and Strategies
Hello all,
I am trying to calculate the 5 days EMA calculation using code but I got the wrong output than Zerodha showing on the chart.
I take the EMA calculation formula from here
https://www.investopedia.com/terms/e/ema.asp
Here is my code for calculating the EMA formula.
$length = 5;
$multiplier = 2 / ( $length + 1 );
$todayPrice = 552.3;
// Wipro closing price 28 January 2022 15:00 to 28 January 2022 14:00
$averageSum = 551.2 + 555 + 555.25 + 553.75 + 553.6;
$average = $averageSum / $length;
print ($todayPrice * $multiplier) + ( $average * ( 1 - $multiplier ) );
I am getting the output 553.27 and Zerodha showing 553.4694 ( 2022/01/28 15:15:00 ).
Can you please help me where I did a mistake in calculating the EMA formula?
Thanks
Tagged:
php
EMA CALCULATION
sujith
January 2022
We don't do the calculations. We just use charting libraries. You can check out this
thread for curated list of things
.
anandn
February 2022
Hi,
You can check out my EMA tutorial. You can plug any broker into the final data
https://medium.com/p/5e029223ab01
Sign In
or
Register
to comment.
You can check out my EMA tutorial. You can plug any broker into the final data
https://medium.com/p/5e029223ab01