StockSharp.Strategies.0240_MACD_Mean_Reversion.py
5.0.1
Prefix Reserved
dotnet add package StockSharp.Strategies.0240_MACD_Mean_Reversion.py --version 5.0.1
NuGet\Install-Package StockSharp.Strategies.0240_MACD_Mean_Reversion.py -Version 5.0.1
<PackageReference Include="StockSharp.Strategies.0240_MACD_Mean_Reversion.py" Version="5.0.1" />
<PackageVersion Include="StockSharp.Strategies.0240_MACD_Mean_Reversion.py" Version="5.0.1" />
<PackageReference Include="StockSharp.Strategies.0240_MACD_Mean_Reversion.py" />
paket add StockSharp.Strategies.0240_MACD_Mean_Reversion.py --version 5.0.1
#r "nuget: StockSharp.Strategies.0240_MACD_Mean_Reversion.py, 5.0.1"
#:package StockSharp.Strategies.0240_MACD_Mean_Reversion.py@5.0.1
#addin nuget:?package=StockSharp.Strategies.0240_MACD_Mean_Reversion.py&version=5.0.1
#tool nuget:?package=StockSharp.Strategies.0240_MACD_Mean_Reversion.py&version=5.0.1
MACD Mean Reversion Strategy (Python 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
= 12SlowMacdPeriod
= 26SignalPeriod
= 9AveragePeriod
= 20DeviationMultiplier
= 2mCandleType
= 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
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Move state reset to OnReseted for strategies 231-240