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

Implement Hurst Exponent (HE) indicator #8434

Conversation

JosueNina
Copy link
Contributor

Description

This pull request introduces the Hurst Exponent indicator, which measures the long-term memory or self-similarity in a time series. The indicator helps analyze the persistence or mean-reversion behavior of a time series, providing valuable insights into market trends and volatility.

Related Issue

Closes #3924

Motivation and Context

The Hurst Exponent indicator is essential for quantitative analysis as it helps identify the nature of trends in financial time series data.

Requires Documentation Change

Yes, the documentation should be updated to include usage instructions for the Hurst Exponent indicator

How Has This Been Tested?

The Hurst Exponent indicator has been tested using unit tests that verify the calculation of the indicator over historical data. This includes testing edge cases and validating the computation of standard deviation and regression line slope.

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>

- Implemented Hurst Exponent indicator class
- Created unit tests to validate indicator functionality
- Added helper methods for standard deviation and regression line slope
- Removed redundat loops and unnecessary operations.
- Precomputed values fro time lag logarithms to avoid recalculation.
- Simplified logic in ComputeNextValue for better performance.
- Updated and clarified comments for improved readability.
@JosueNina JosueNina force-pushed the feature-3924-hurst-exponent-indicator branch from dab97e8 to 8cf0e1c Compare December 4, 2024 15:30
- Made _sumX and _sumX2 fields readonly.
- Updated loop for calculating time lag differences to avoid out of
  bound.
- Renamed lookbackPeriod with period.
- Replaced DateTime.Now with a fixed date.
Copy link
Member

@Martin-Molinero Martin-Molinero left a comment

Choose a reason for hiding this comment

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

Thank you! 🙌

@Martin-Molinero Martin-Molinero merged commit 8e5893b into QuantConnect:master Dec 5, 2024
7 checks passed
@ikamanu
Copy link

ikamanu commented Dec 5, 2024

Great to see this. Thanks team!

@ikamanu
Copy link

ikamanu commented Dec 5, 2024

How soon will this be available in the cloud IDE? currently I'm getting errors when i try to reference 'self.he' :
object has no attribute 'he' .

I think it's just an older build ( currently cloud IDE showing I am on this build master v16770 - 2024-12-04 22:19 )

@Martin-Molinero
Copy link
Member

Hey @ikamanu! Will be available starting from version 16771 (eta ~40min). Cloud autocomplete might delay little more but eod/tomorrow should be there

@ikamanu
Copy link

ikamanu commented Dec 5, 2024

Hey @ikamanu! Will be available starting from version 16771 (eta ~40min). Cloud autocomplete might delay little more but eod/tomorrow should be there

Got it now. looking good. thanks!

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.

Adds Hurst Exponent Indicator
3 participants