peerchemist / finta

Common financial technical indicators implemented in Pandas.
GNU Lesser General Public License v3.0
2.13k stars 688 forks source link

Fixed STC calculation + test #99

Closed jamesyrose closed 4 years ago

jamesyrose commented 4 years ago

STC calculation is a double smoothed Stoch on the MACD. The source you were using (referenced in doc string) schaff equation makes no sense. This version aligns with what is produced on Yahoo Finance and TOS.

Calculation: MACD = macd("close", fast, slow) K_LINE, D_LINE = fastStoch(macd, k_period, d_period) STC = sma(D_LINE, d_period) // second smoothing on d line

Notes: Some sources use a default second smoothing period of 3. Some default to half the k_period. And some just let you choose the d_period.

Referenced Source: https://tlc.thinkorswim.com/center/reference/Tech-Indicators/studies-library/R-S/SchaffTrendCycle

peerchemist commented 4 years ago

Can you pls squash this into 1 commit?

jamesyrose commented 4 years ago

It's fixed Sorry if my commits and what not are bad, I am still learning git.

peerchemist commented 4 years ago

That is good, thank you for your effort. +1