Skip to content
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

Feature 4167 Schaff Trend Cycle indicator #4557

Conversation

C-SELLERS
Copy link
Contributor

@C-SELLERS C-SELLERS commented Jul 2, 2020

Description

Addition of a new indicator: Schaff Trend Cycle

Related Issue

Closes #4167

Motivation and Context

Add a new indicator that builds on previous ones. STC takes MACD further and is more responsive to momentum changes.

Requires Documentation Change

Yes, addition of this new indicator to the indicator documentation is required.

How Has This Been Tested?

External data has been added in this PR to run against the indicator using the CommonIndicatorTests. Reference Tests/Indicators/SchaffTrendCycleTests.cs for test setup.

Also in development I worked through the formula using an excel to compare it to a TradingView script's calculation to ensure accuracy of the algorithm. This particular indicator is extremely sensitive as it chains EMAs and Stochastics on top of a MACD calculation so the more data points processed the closer the values become. In the case of TradingView it was able to process data from before the start which leads the beginning STC values to differ greatly in the excel. You will notice after row 120 the variance becomes very minimal.

spy_stc_excel_vs_TV.txt

The test file I included (spy_stc.txt) in this PR goes even further with over 1700 points for an intraday comparison. Running my indicator against this show a very small max +/- 1 variance between the values. To reproduce run SchaffTrendCycleTests.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

@C-SELLERS
Copy link
Contributor Author

Looks like when it builds my test data in Tests/TestData/spy_stc.txt is not being transferred to the Release test bin.

See Travis build error here

Can whoever reviews this let me know how to get the test data into the correct directory?

@C-SELLERS
Copy link
Contributor Author

Closing to restart the test. Failed on something unrelated.

@C-SELLERS C-SELLERS closed this Jul 16, 2020
@C-SELLERS C-SELLERS reopened this Jul 16, 2020
Indicators/readme.md Outdated Show resolved Hide resolved
Copy link
Member

@jaredbroad jaredbroad left a comment

Choose a reason for hiding this comment

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

Please remove the docs and we can merge indicator and put docs in correct location.

@C-SELLERS C-SELLERS force-pushed the feature-4167-Schaff-Trend-Cycle-Indicator branch from 8c0ceff to 1eb40d0 Compare July 28, 2020 22:23
Copy link
Contributor Author

@C-SELLERS C-SELLERS left a comment

Choose a reason for hiding this comment

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

Reviewed and tested!

@jaredbroad jaredbroad merged commit 920e4cb into QuantConnect:master Jul 28, 2020
@jaredbroad
Copy link
Member

We forgot one thing! The shortcut helper in QCAlgorithm.Indicators.cs

STC(int cyclePeriod, int fastPeriod, int slowPeriod, MovingAverageType type)

@C-SELLERS
Copy link
Contributor Author

Uh oh, Ill take care of it!

@C-SELLERS C-SELLERS mentioned this pull request Aug 11, 2020
11 tasks
@C-SELLERS C-SELLERS deleted the feature-4167-Schaff-Trend-Cycle-Indicator branch July 29, 2021 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schaff Trend Cycle Indicator
2 participants