Merhaba,
Timestamp hatası sonucu reddedilen emirden sonra emirler sıralı gitmeye devam ederek ikinci bir açığa satış yapmıştır. Böylece 2 adet açığa satış aktiftir. Ancak daha sonrasında sıralı gitmemiş ve emir 2 katı gerçekleşerek reddedileni de kapatmıştır. Eğer reddedilse dahi daha sonradan kapatılacaksa ikinci açığa satıştan önce kapanması gerekmezmiydi? Yada açığa satış kapatılırken biri açık kalması gerekmezmiydi? İşlemler aşağıdaki gibidir.


Merhabalar,
Kullandığım sistem şu şekildedir.
using System; using System.Collections.Generic; using System.Linq; using Matriks; using Matriks.Data.Symbol; using Matriks.Engines; using Matriks.Indicators; using Matriks.Symbols; using Matriks.Trader.Core; using Matriks.Trader.Core.Fields; using Matriks.Lean.Algotrader.AlgoBase; using Matriks.Lean.Algotrader.Models; using Matriks.Lean.Algotrader.Trading; using Matriks.AI; using Matriks.AI.AiParameters; using Matriks.AI.Data; using Matriks.Trader.Core.TraderModels; namespace Matriks.Lean.Algotrader { public class ShortSottTott2 : MatriksAlgo { // Strateji çalıştırılırken kullanacağımız parametreler. Eğer sembolle ilgili bir parametre ise, // "SymbolParameter" ile, değilse "Parameter" ile tanımlama yaparız. Parantez içindeki değerler default değerleridir. [SymbolParameter("SOL_USDT_FBIN")] public string Symbol1; [Parameter(SymbolPeriod.Min)] public SymbolPeriod SymbolPeriod1; [Parameter(41)] public int TottPeriod1; [Parameter(1.1)] public decimal TottOpt1; [Parameter(501)] public int SottPeriodK1; [Parameter(201)] public int SottPeriodSlowK1; [Parameter(42)] public int TottPeriod2; [Parameter(1.2)] public decimal TottOpt2; [Parameter(502)] public int SottPeriodK2; [Parameter(202)] public int SottPeriodSlowK2; [Parameter(43)] public int TottPeriod3; [Parameter(1.3)] public decimal TottOpt3; [Parameter(503)] public int SottPeriodK3; [Parameter(203)] public int SottPeriodSlowK3; [Parameter(44)] public int TottPeriod4; [Parameter(1.4)] public decimal TottOpt4; [Parameter(504)] public int SottPeriodK4; [Parameter(204)] public int SottPeriodSlowK4; [Parameter(0.0008)] public decimal TottTwinOttCoef1; [Parameter(0.35)] public decimal SottOttOpt1; [Parameter(0.0008)] public decimal TottTwinOttCoef2; [Parameter(0.35)] public decimal SottOttOpt2; [Parameter(0.0008)] public decimal TottTwinOttCoef3; [Parameter(0.35)] public decimal SottOttOpt3; [Parameter(0.0008)] public decimal TottTwinOttCoef4; [Parameter(0.35)] public decimal SottOttOpt4; [Parameter(30)] public int OttPeriod1; [Parameter(7)] public decimal OttOpt1; [Parameter(21)] public int HighlowBarSayisi1; [Parameter(22)] public int HighlowBarSayisi2; [Parameter(23)] public int HighlowBarSayisi3; [Parameter(24)] public int HighlowBarSayisi4; [Parameter(MovMethod.VAR)] public MovMethod TottMovMethod1; [Parameter(MovMethod.VAR)] public MovMethod TottMovMethod2; [Parameter(MovMethod.VAR)] public MovMethod TottMovMethod3; [Parameter(MovMethod.VAR)] public MovMethod TottMovMethod4; [Parameter(2)] public int SottOttPeriod1; [Parameter(MovMethod.VAR)] public MovMethod SottOttMethod1; [Parameter(MovMethod.VAR)] public MovMethod SottStosKMethod1; [Parameter(2)] public int SottOttPeriod2; [Parameter(MovMethod.VAR)] public MovMethod SottOttMethod2; [Parameter(MovMethod.VAR)] public MovMethod SottStosKMethod2; [Parameter(2)] public int SottOttPeriod3; [Parameter(MovMethod.VAR)] public MovMethod SottOttMethod3; [Parameter(MovMethod.VAR)] public MovMethod SottStosKMethod3; [Parameter(2)] public int SottOttPeriod4; [Parameter(MovMethod.VAR)] public MovMethod SottOttMethod4; [Parameter(MovMethod.VAR)] public MovMethod SottStosKMethod4; [Parameter(MovMethod.VAR)] public MovMethod OttMovMethod1; [Parameter(true)] public bool OttSupportLine1; [Parameter(false)] public bool IsReduceOnly1; [Parameter(CryptoLeverageType.Isolated)] public CryptoLeverageType LeverageType1; [Parameter(false)] public bool IsReduceOnly2; [Parameter(10)] public decimal Leverage2; [Parameter(10)] public decimal Leverage5; [Parameter(10)] public decimal Leverage8; [Parameter(10)] public decimal Leverage11; [Parameter(false)] public bool IsReduceOnly3; [Parameter(false)] public bool IsReduceOnly4; [Parameter(CryptoLeverageType.Isolated)] public CryptoLeverageType LeverageType4; [Parameter(false)] public bool IsReduceOnly5; [Parameter(false)] public bool IsReduceOnly6; [Parameter(false)] public bool IsReduceOnly7; [Parameter(CryptoLeverageType.Isolated)] public CryptoLeverageType LeverageType7; [Parameter(false)] public bool IsReduceOnly8; [Parameter(false)] public bool IsReduceOnly9; [Parameter(false)] public bool IsReduceOnly10; [Parameter(CryptoLeverageType.Isolated)] public CryptoLeverageType LeverageType10; [Parameter(false)] public bool IsReduceOnly11; [Parameter(7)] public decimal OrderQuantity3; [Parameter(7)] public decimal OrderQuantity6; [Parameter(7)] public decimal OrderQuantity9; [Parameter(7)] public decimal OrderQuantity12; [Parameter(false)] public bool IsReduceOnly12; [Parameter(2.4)] public decimal ZararDurdurYuzdesi; TOTT tott; TOTT tott2; TOTT tott3; TOTT tott4; SOTT sott; SOTT sott2; SOTT sott3; SOTT sott4; MatriksIndicator HighLow; MatriksIndicator HighLow2; MatriksIndicator HighLow3; MatriksIndicator HighLow4; OTT ott; public override void OnInit() { tott = TOTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, TottPeriod1, TottOpt1, TottTwinOttCoef1, TottMovMethod1); tott2 = TOTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, TottPeriod2, TottOpt2, TottTwinOttCoef2, TottMovMethod2); tott3 = TOTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, TottPeriod3, TottOpt3, TottTwinOttCoef3, TottMovMethod3); tott4 = TOTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, TottPeriod4, TottOpt4, TottTwinOttCoef4, TottMovMethod4); sott = SOTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, SottPeriodK1, SottPeriodSlowK1, SottOttPeriod1, SottOttOpt1, SottOttMethod1, SottStosKMethod1); sott2 = SOTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, SottPeriodK2, SottPeriodSlowK2, SottOttPeriod2, SottOttOpt2, SottOttMethod2, SottStosKMethod2); sott3 = SOTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, SottPeriodK3, SottPeriodSlowK3, SottOttPeriod3, SottOttOpt3, SottOttMethod3, SottStosKMethod3); sott4 = SOTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, SottPeriodK4, SottPeriodSlowK4, SottOttPeriod4, SottOttOpt4, SottOttMethod4, SottStosKMethod4); HighLow = new HighLow(); HighLow.SetIndicatorParameters("BarSayisi", HighlowBarSayisi1); RegisterUserIndicator(HighLow, Symbol1, SymbolPeriod1, OHLCType.Close, 5); HighLow2 = new HighLow(); HighLow2.SetIndicatorParameters("BarSayisi", HighlowBarSayisi2); RegisterUserIndicator(HighLow2, Symbol1, SymbolPeriod1, OHLCType.Close, 5); HighLow3 = new HighLow(); HighLow3.SetIndicatorParameters("BarSayisi", HighlowBarSayisi3); RegisterUserIndicator(HighLow3, Symbol1, SymbolPeriod1, OHLCType.Close, 5); HighLow4 = new HighLow(); HighLow4.SetIndicatorParameters("BarSayisi", HighlowBarSayisi4); RegisterUserIndicator(HighLow4, Symbol1, SymbolPeriod1, OHLCType.Close, 5); ott = OTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, OttPeriod1, OttOpt1, OttMovMethod1, OttSupportLine1); SetLeverageType(Symbol1, LeverageType1); SetLeverage(Symbol1, Leverage2); SetLeverageType(Symbol1, LeverageType4); SetLeverage(Symbol1, Leverage5); SetLeverageType(Symbol1, LeverageType7); SetLeverage(Symbol1, Leverage8); SetLeverageType(Symbol1, LeverageType10); SetLeverage(Symbol1, Leverage11); SendOrderSequential(true, Side.Sell); WorkWithPermanentSignal(true); //Alttaki fonksiyon açıldıktan sonra parametre olarak verilen saniyede bir OnTimer fonksiyonu tetiklenir. // SetTimerInterval(3600); //Alttaki fonksiyon ile tanımlanan sembol ile ilgili haber geldiğinde OnNewsReceived fonksiyonu tetiklenir. //AddNewsSymbol(Symbol); //Alttaki fonksiyon ile tanımlanan anahtar kelime ile ilgili haber geldiğinde OnNewsReceived fonksiyonu tetiklenir. //AddNewsKeyword("KAP"); } /// <summary> /// Init islemleri tamamlaninca, bardatalar kullanmaya hazir hale gelince bu fonksiyon tetiklenir. Data uzerinde bir defa yapilacak islemler icin kullanilir /// </summary> public override void OnInitCompleted() { } /// <summary> /// SetTimerInterval fonksiyonu ile belirtilen sürede bir bu fonksiyon tetiklenir. /// </summary> public override void OnTimer() { } /// <summary> /// AddNewsSymbol ve AddNewsKeyword ile haberlere kayit olunmuşsa bu fonksiyon tetiklenir. /// </summary> /// <param name="newsId">Gelen haberin id'si</param> /// <param name="relatedSymbols">Gelen haberin ilişkili sembolleri</param> public override void OnNewsReceived(int newsId, List<string> relatedSymbols) { } /// <summary> /// Eklenen sembollerin bardata'ları ve indikatorler güncellendikçe bu fonksiyon tetiklenir. /// </summary> /// <param name="barData">Bardata ve hesaplanan gerçekleşen işleme ait detaylar</param> public override void OnDataUpdate(BarDataEventArgs barData) { var barData1 = GetBarData(Symbol1, SymbolPeriod1); var ohlcData1 = GetSelectedValueFromBarData(barData1, OHLCType.Low); var ohlcData2 = GetSelectedValueFromBarData(barData1, OHLCType.High); if (ott.Value[1][ott.CurrentIndex] < ott.Value[0][ott.CurrentIndex] && tott.Value[0][tott.CurrentIndex] < tott.Value[2][tott.CurrentIndex] && sott.Value[0][sott.CurrentIndex] < sott.Value[1][sott.CurrentIndex] && HighLow.Value[1][HighLow.CurrentIndex - 1] > ohlcData1) { SendMarketOrder(Symbol1, OrderQuantity3, OrderSide.Sell, includeAfterSession:false, isReduceOnly : IsReduceOnly3); StopLoss(Symbol1, SyntheticOrderPriceType.Percent, ZararDurdurYuzdesi); } if (ott.Value[1][ott.CurrentIndex] > ott.Value[0][ott.CurrentIndex] && tott2.Value[0][tott2.CurrentIndex] < tott2.Value[2][tott2.CurrentIndex] && sott2.Value[0][sott2.CurrentIndex] < sott2.Value[1][sott2.CurrentIndex] && HighLow2.Value[1][HighLow2.CurrentIndex - 1] > ohlcData1) { SendMarketOrder(Symbol1, OrderQuantity6, OrderSide.Sell, includeAfterSession:false, isReduceOnly : IsReduceOnly6); StopLoss(Symbol1, SyntheticOrderPriceType.Percent, ZararDurdurYuzdesi); } if (ott.Value[1][ott.CurrentIndex] < ott.Value[0][ott.CurrentIndex] && tott3.Value[0][tott3.CurrentIndex] > tott3.Value[1][tott3.CurrentIndex] && sott3.Value[0][sott3.CurrentIndex] > sott3.Value[1][sott3.CurrentIndex] && HighLow3.Value[0][HighLow3.CurrentIndex - 1] < ohlcData2) { SendMarketOrder(Symbol1, OrderQuantity9, OrderSide.Buy, includeAfterSession:false, isReduceOnly : IsReduceOnly9); } if (ott.Value[1][ott.CurrentIndex] > ott.Value[0][ott.CurrentIndex] && tott4.Value[0][tott4.CurrentIndex] > tott4.Value[1][tott4.CurrentIndex] && sott4.Value[0][sott4.CurrentIndex] > sott4.Value[1][sott4.CurrentIndex] && HighLow4.Value[0][HighLow4.CurrentIndex - 1] < ohlcData2) { SendMarketOrder(Symbol1, OrderQuantity12, OrderSide.Buy, includeAfterSession:false, isReduceOnly : IsReduceOnly12); } } /// <summary> /// Gönderilen emirlerin son durumu değiştikçe bu fonksiyon tetiklenir. /// </summary> /// <param name="barData">Emrin son durumu</param> public override void OnOrderUpdate(IOrder order) { } /// <summary> /// Strateji durdurulduğunda bu fonksiyon tetiklenir. /// </summary> public override void OnStopped() { } } }