Skip to content

How are EMA's calculated on charts up to the previous candle. #528

Answered by DaveSkender
CyberNomadDev asked this question in Q&A
Discussion options

You must be logged in to vote

If you examine the formula for EMA you'll see this concept of historical "smoothing". In a nutshell:

EMAtoday = EMAyesterday + SmoothingMultiplier × (CloseToday - EMAyesterday)

where

SmoothingMultiplier = 2 / (lookbackPeriods + 1)

EMA(12) would have SM = 1/(12+1) = 0.091

If you read it carefully, EMA value is mostly derived from historical EMAs.

The library is quite fast, so I'd suggest recalculating the whole results series instead of trying to do incremental EMA values if that was your goal. See #396 for more discussion on incremental calculations. I'll be looking at the streaming and incremental use cases in v2 of the library, where we'll add a method like GetEmaIncrement(..). See #…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@DaveSkender
Comment options

@CyberNomadDev
Comment options

@DaveSkender
Comment options

@CyberNomadDev
Comment options

Answer selected by DaveSkender
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants