Stc opti (#15)

* Optimize STC

* Optimize STC

* Add SuperTrendCrossEma
This commit is contained in:
Oda
2025-03-01 02:59:19 +07:00
committed by GitHub
parent c715da8a17
commit e16f0a2e5d
13 changed files with 485 additions and 51 deletions

View File

@@ -7,8 +7,6 @@ namespace Managing.Domain.Scenarios;
public static class ScenarioHelpers
{
public static IEnumerable<IStrategy> GetStrategiesFromScenario(Scenario scenario)
{
var strategies = new List<IStrategy>();
@@ -45,6 +43,10 @@ public static class ScenarioHelpers
strategy.SmoothPeriods.Value),
StrategyType.Stc => new STCStrategy(strategy.Name, strategy.CyclePeriods.Value,
strategy.FastPeriods.Value, strategy.SlowPeriods.Value),
StrategyType.LaggingStc => new LaggingSTC(strategy.Name, strategy.CyclePeriods.Value,
strategy.FastPeriods.Value, strategy.SlowPeriods.Value),
StrategyType.SuperTrendCrossEma => new SuperTrendCrossEma(strategy.Name,
strategy.Period.Value, strategy.Multiplier.Value),
_ => throw new NotImplementedException(),
};
@@ -101,6 +103,7 @@ public static class ScenarioHelpers
case StrategyType.ThreeWhiteSoldiers:
break;
case StrategyType.SuperTrend:
case StrategyType.SuperTrendCrossEma:
case StrategyType.ChandelierExit:
if (!period.HasValue || !multiplier.HasValue)
{
@@ -132,6 +135,7 @@ public static class ScenarioHelpers
break;
case StrategyType.Stc:
case StrategyType.LaggingStc:
if (!fastPeriods.HasValue || !slowPeriods.HasValue || !cyclePeriods.HasValue)
{
throw new Exception(
@@ -168,6 +172,8 @@ public static class ScenarioHelpers
StrategyType.StochRsiTrend => SignalType.Trend,
StrategyType.Stc => SignalType.Signal,
StrategyType.StDev => SignalType.Context,
StrategyType.LaggingStc => SignalType.Signal,
StrategyType.SuperTrendCrossEma => SignalType.Signal,
_ => throw new NotImplementedException(),
};
}