Optimze worker for backtest
This commit is contained in:
@@ -75,7 +75,10 @@ public static class TradingBox
|
||||
Dictionary<IndicatorType, IndicatorsResultBase> preCalculatedIndicatorValues)
|
||||
{
|
||||
var signalOnCandles = new List<LightSignal>();
|
||||
var limitedCandles = newCandles.ToList().TakeLast(600).ToList();
|
||||
// Optimize list creation - avoid redundant allocations
|
||||
var limitedCandles = newCandles.Count <= 600
|
||||
? newCandles.OrderBy(c => c.Date).ToList()
|
||||
: newCandles.OrderBy(c => c.Date).TakeLast(600).ToList();
|
||||
|
||||
foreach (var indicator in lightScenario.Indicators)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user