Update precalculated indicators values
This commit is contained in:
@@ -45,13 +45,6 @@ public class TradingBotBase : ITradingBot
|
||||
public Candle LastCandle { get; set; }
|
||||
public DateTime? LastPositionClosingTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pre-calculated indicator values for backtesting optimization.
|
||||
/// Key is IndicatorType, Value is the calculated indicator result.
|
||||
/// </summary>
|
||||
public Dictionary<IndicatorType, IndicatorsResultBase> PreCalculatedIndicatorValues { get; set; }
|
||||
|
||||
|
||||
public TradingBotBase(
|
||||
ILogger<TradingBotBase> logger,
|
||||
IServiceScopeFactory scopeFactory,
|
||||
@@ -65,7 +58,6 @@ public class TradingBotBase : ITradingBot
|
||||
Positions = new Dictionary<Guid, Position>();
|
||||
WalletBalances = new Dictionary<DateTime, decimal>();
|
||||
PreloadSince = CandleHelpers.GetBotPreloadSinceFromTimeframe(config.Timeframe);
|
||||
PreCalculatedIndicatorValues = new Dictionary<IndicatorType, IndicatorsResultBase>();
|
||||
}
|
||||
|
||||
public async Task Start(BotStatus previousStatus)
|
||||
@@ -264,7 +256,7 @@ public class TradingBotBase : ITradingBot
|
||||
}
|
||||
|
||||
public async Task UpdateSignals(HashSet<Candle> candles,
|
||||
Dictionary<DateTime, LightSignal> preCalculatedSignals = null)
|
||||
Dictionary<IndicatorType, IndicatorsResultBase> preCalculatedIndicatorValues = null)
|
||||
{
|
||||
// Skip indicator checking if flipping is disabled and there's an open position
|
||||
// This prevents unnecessary indicator calculations when we can't act on signals anyway
|
||||
@@ -285,7 +277,7 @@ public class TradingBotBase : ITradingBot
|
||||
if (Config.IsForBacktest)
|
||||
{
|
||||
var backtestSignal = TradingBox.GetSignal(candles, Config.Scenario, Signals, Config.Scenario.LoopbackPeriod,
|
||||
PreCalculatedIndicatorValues);
|
||||
preCalculatedIndicatorValues);
|
||||
if (backtestSignal == null) return;
|
||||
await AddSignal(backtestSignal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user