fix(simulation,technicals): fix EMA 200 warmup distortion, intrabar execution path, and zero slippage

This commit is contained in:
2026-09-01 17:38:34 +02:00
parent cb8a169043
commit d161efb370
5 changed files with 25 additions and 19 deletions
@@ -21,7 +21,6 @@ public class TrendPullbackFvgStrategy : ITechnicalStrategy
public StrategyResultDto? Evaluate(TechnicalContext context, IReadOnlyList<PatternResultDto> activePatterns)
{
var candles = context.PrimaryCandles;
if (candles.Count < 30) return null;
// Tunable for backtesting only (see TechnicalContext.ParameterOverrides doc comment) - defaults match
// this strategy's original hardcoded values, so live scanning behavior is unchanged.
@@ -30,13 +29,15 @@ public class TrendPullbackFvgStrategy : ITechnicalStrategy
int emaSlowPeriod = (int)context.GetParameter(StrategyKey, "EmaSlow", 200m);
decimal stopAtrMultiplier = context.GetParameter(StrategyKey, "StopAtrMultiplier", 1.2m);
if (candles.Count < emaSlowPeriod + 5) return null;
var current = candles.Last();
decimal ema20 = TechnicalIndicatorsEngine.CalculateEma(candles, emaFastPeriod);
decimal ema50 = TechnicalIndicatorsEngine.CalculateEma(candles, emaMidPeriod);
decimal ema200 = TechnicalIndicatorsEngine.CalculateEma(candles, emaSlowPeriod);
decimal atr = context.CurrentAtr > 0 ? context.CurrentAtr : TechnicalIndicatorsEngine.CalculateAtr(candles, 14);
if (atr <= 0) return null;
if (ema20 <= 0m || ema50 <= 0m || ema200 <= 0m || atr <= 0) return null;
// Long Setup: Bullish Trend (EMA20 > EMA50 > EMA200) + Bullish FVG retracement.
bool isBullishTrend = ema20 > ema50 && ema50 > ema200 && current.Close > ema50;