Skip to main content
Any Framework

MACD Mean Reversion Strategy (C#)

Published
Aug 7, 2025
1y ago
Total Downloads
2.1K
2,123

Install

dotnet add package StockSharp.Strategies.0240_MACD_Mean_Reversion --version 5.0.2

No framework information available.

README

MACD Mean Reversion Strategy (C# Version)

This method tracks the MACD histogram relative to its own average. Extreme histogram readings often revert once momentum subsides. By monitoring the difference between MACD and its signal line, the strategy finds overextended moves.

Testing indicates an average annual return of about 67%. It performs best in the stocks market.

A long position is entered when the MACD histogram falls below the mean by DeviationMultiplier standard deviations. A short position is opened when the histogram rises above the mean by the same amount. The trade is closed when the histogram crosses back through its average.

This approach caters to traders comfortable fading momentum extremes. A stop-loss measured as a percentage of entry price guards against trends that continue to strengthen.

Details

  • Entry Criteria:
    • Long: MACD Histogram < Avg - DeviationMultiplier * StdDev
    • Short: MACD Histogram > Avg + DeviationMultiplier * StdDev
  • Long/Short: Both sides.
  • Exit Criteria:
    • Long: Exit when Histogram > Avg
    • Short: Exit when Histogram < Avg
  • Stops: Yes, percent stop-loss.
  • Default Values:
    • FastMacdPeriod = 12
    • SlowMacdPeriod = 26
    • SignalPeriod = 9
    • AveragePeriod = 20
    • DeviationMultiplier = 2m
    • CandleType = TimeSpan.FromMinutes(5)
  • Filters:
    • Category: Mean Reversion
    • Direction: Both
    • Indicators: MACD
    • Stops: Yes
    • Complexity: Intermediate
    • Timeframe: Intraday
    • Seasonality: No
    • Neural networks: No
    • Divergence: No
    • Risk Level: Medium

Changes from Previous Version

No structural changes between v5.0.1 and v5.0.2.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.