Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Fixed STC calculation + test #99

Merged
merged 1 commit into from Oct 20, 2020
Merged

Conversation

jamesyrose
Copy link
Contributor

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

@jamesyrose jamesyrose closed this Oct 20, 2020
@jamesyrose jamesyrose reopened this Oct 20, 2020
finta/finta.py Outdated
STOD_DoubleSmooth = STOD.rolling(window=d_period).mean() # "double smoothed"

# Name the series
if name is None:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not standard, it is not used anywhere else in the library.

@peerchemist
Copy link
Owner

Can you pls squash this into 1 commit?

@jamesyrose
Copy link
Contributor Author

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

@peerchemist
Copy link
Owner

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

@peerchemist peerchemist merged commit cc3385b into peerchemist:master Oct 20, 2020
@jamesyrose jamesyrose deleted the fix_stc branch October 20, 2020 22:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants