-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEMA and TEMA - early calculations #770
Comments
I’ll take a look. Thanks for finding/posting. Sounds like there may be a mathematical shortcut to the same/sooner result with a shorter warmup window. I usually source formulas from original authors, but suspect others may do it differently. These are on Wikipedia. Note to self, while looking at this one:
|
Check my validation tests here for DEMA/TEMA. They all pass (comparing my DEMA/TEMA with yours and with TA-LIB) - but I feed it 1,000 bars. Tests fail at 100-200 bars. |
Just took a look. I like the way you’re suggesting to shorten the warmup window. I’m simply reusing the existing EMA method to avoid duplicating code, but this improvement makes sense and still honors the fundamental math correctly. |
I'm running a convergence analysis on DEMA right now and starting earlier doesn't seem to improve the actual rate of convergence to accuracy at all. The only benefit is that you get more less-accurate warmup data. Though, it does run faster since this uses a single pass approach. I had two passes since I was just calling the EMA twice. The extra speed is probably worth the tradeoff. |
This will be available in the next version. |
Current implementation of DEMA/TEMA (Double and Triple EMAs) is unnecessarily laggy.
Implementation here is recalculating SMA of EMA (for DEMA), and SMA of EMA of EMA (for TEMA), generating usable bars 3*period later than it could. This same bug appears in TA-LIB, but is not present in Pandas-TA - or other libraries.
After about 60 bars (for DEMA) or 100 bars (for TEMA) both algos completely converge into a same series, so this issue is minor and visible only to users that would like to use TEMA as early as possible and not wait for 3*period of warmup data.
The text was updated successfully, but these errors were encountered: