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 Mesa Adaptive Moving Average (MAMA) Indicator #8428

Conversation

JosueNina
Copy link
Contributor

Description

This pull request introduces the Mesa Adaptive Moving Average (MAMA) indicator, a dynamic moving average that adapts its period based on market volatility. The indicator is designed to adjust its speed for both trending and non-trending markets, making it more responsive in different market conditions.

Related Issue

Closes #2986

Motivation and Context

The change introduces the MAMA indicator, which improves market analysis by providing a more adaptive moving average.

Requires Documentation Change

Yes, the documentation needs to be updated to include usage instructions for the Mesa Adaptive Moving Average (MAMA), including its configuration parameters (fast and slow limits), as well as an explanation of the indicator's adaptive behavior.

How Has This Been Tested?

The MAMA indicator has been tested on historical price data.

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 the MAMA indicator.
- Created methods with overloads to support custom and default
  fastLimit/slowLimit
- Included necessary logic to calculate the mesa adaptive moving average
  based on John's formula.
- Created unit tests to validate MAMA's behaviour.
…ature-2986-mesa-adaptive-moving-average-indicator

# Conflicts:
#	Tests/QuantConnect.Tests.csproj
- Separated the logic into smaller functions for better maintainability.
- Improved variable names to reflec their purpose.
- Updated comments to reflect changes and improve readability.
- Consolidated MAMA method overlaod by using default parameters values.
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! Nice work 👍

@JosueNina JosueNina force-pushed the feature-2986-mesa-adaptive-moving-average-indicator branch from 2e0a201 to 1d234f3 Compare November 27, 2024 21:12
- Renamed variables for better clarity.
- Updated method to use 'IBaseDataBar' instead of 'TradeBar'
- Used 'MAMA({fastLimit}, {slowLimit}) instead of just 'MAMA'
@JosueNina JosueNina force-pushed the feature-2986-mesa-adaptive-moving-average-indicator branch from 1d234f3 to 2da32e3 Compare November 27, 2024 21:22
@Martin-Molinero Martin-Molinero merged commit 01734e1 into QuantConnect:master Nov 27, 2024
7 checks passed
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.

Add Mesa Adaptive Moving Average indicator
2 participants