From d045f9b082d9d2d3c0907a9bb3f22cac49d4efd8 Mon Sep 17 00:00:00 2001 From: vlad zverzhkhovskiy Date: Wed, 3 Sep 2025 07:05:06 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D1=87=D0=B8=D1=81=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KLHZ.Trader.Core.Math/Common/Lines.cs | 2 +- KLHZ.Trader.Core.Math/Declisions/Utils/MovingAverage.cs | 6 +++--- KLHZ.Trader.Core/Exchange/Services/Trader.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/KLHZ.Trader.Core.Math/Common/Lines.cs b/KLHZ.Trader.Core.Math/Common/Lines.cs index f932781..7b4b7ca 100644 --- a/KLHZ.Trader.Core.Math/Common/Lines.cs +++ b/KLHZ.Trader.Core.Math/Common/Lines.cs @@ -25,7 +25,7 @@ if (k1 != k2) { var cross = LinesCrossing(k1, b1, k2, b2); - if (cross.x>=0 && cross.x <= dtime) + if (cross.x >= 0 && cross.x <= dtime) { var crossingTimestamp = time1.AddSeconds((double)cross.x); return crossingTimestamp >= time1 && crossingTimestamp <= time2; diff --git a/KLHZ.Trader.Core.Math/Declisions/Utils/MovingAverage.cs b/KLHZ.Trader.Core.Math/Declisions/Utils/MovingAverage.cs index 7c76e29..c82feee 100644 --- a/KLHZ.Trader.Core.Math/Declisions/Utils/MovingAverage.cs +++ b/KLHZ.Trader.Core.Math/Declisions/Utils/MovingAverage.cs @@ -18,7 +18,7 @@ namespace KLHZ.Trader.Core.Math.Declisions.Utils return (startTime, sum / count); } - public static TradingEvent CheckByWindowAverageMean(DateTime[] timestamps, decimal[] prices, int size,int smallWindow, int bigWindow, decimal meanfullStep = 3m) + public static TradingEvent CheckByWindowAverageMean(DateTime[] timestamps, decimal[] prices, int size, int smallWindow, int bigWindow, decimal meanfullStep = 3m) { var res = TradingEvent.None; if (timestamps.Length < size) @@ -29,8 +29,8 @@ namespace KLHZ.Trader.Core.Math.Declisions.Utils var twavss = new decimal[size]; var twavbs = new decimal[size]; var times = new DateTime[size]; - - + + for (int shift = 0; shift < size; shift++) { var twavs = CalcTimeWindowAverageValue(timestamps, prices, smallWindow, shift); diff --git a/KLHZ.Trader.Core/Exchange/Services/Trader.cs b/KLHZ.Trader.Core/Exchange/Services/Trader.cs index ef8e063..7493050 100644 --- a/KLHZ.Trader.Core/Exchange/Services/Trader.cs +++ b/KLHZ.Trader.Core/Exchange/Services/Trader.cs @@ -141,10 +141,10 @@ namespace KLHZ.Trader.Core.Exchange.Services } - var result = MovingAverage.CheckByWindowAverageMean(data.timestamps, data.prices, 100,15,120); + var result = MovingAverage.CheckByWindowAverageMean(data.timestamps, data.prices, 100, 15, 120); if ((result & TradingEvent.StopBuy) == TradingEvent.StopBuy) { - var stopTo = (message.IsHistoricalData?message.Time: DateTime.UtcNow).AddMinutes(_buyStopLength); + var stopTo = (message.IsHistoricalData ? message.Time : DateTime.UtcNow).AddMinutes(_buyStopLength); BuyStops.AddOrUpdate(message.Figi, stopTo, (k, v) => stopTo); declisionsForSave.Add(new Declision() {