Merhaba;
Long/Short düzeni ile çalışmasını istediğim stratejim stop olduğunda sonraki emrin lot sayısında yanlışlık olması sebebiyle bozuluyor. Yardımlarınız için şimdiden teşekkürler.
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 SOTT_11_CROSS : MatriksAlgo
{
[SymbolParameter("BNB_USDT_FBIN")]
public string Symbol1;
[Parameter(SymbolPeriod.Min15)]
public SymbolPeriod SymbolPeriod1;
[Parameter(13)]
public int SottPeriodK1;
[Parameter(142)]
public int SottPeriodSlowK1;
[Parameter(10)]
public int SottOttPeriod1;
[Parameter(0.6)]
public decimal SottOttOpt1;
[Parameter(MovMethod.VAR)]
public MovMethod SottOttMethod1;
[Parameter(MovMethod.VAR)]
public MovMethod SottStosKMethod1;
[Parameter(1)]
public decimal OrderQuantity1;
[Parameter(false)]
public bool IsReduceOnly1;
[Parameter(false)]
public bool IsReduceOnly2;
[Parameter(20)]
public decimal Leverage2;
[Parameter(false)]
public bool IsReduceOnly3;
[Parameter(CryptoLeverageType.Isolated)]
public CryptoLeverageType LeverageType3;
[Parameter(1)]
public decimal OrderQuantity4;
[Parameter(false)]
public bool IsReduceOnly4;
[Parameter(false)]
public bool IsReduceOnly5;
[Parameter(20)]
public decimal Leverage5;
[Parameter(false)]
public bool IsReduceOnly6;
[Parameter(CryptoLeverageType.Isolated)]
public CryptoLeverageType LeverageType6;
SOTT sott;
int FirstRun = 0;
int realposition = 0;
public override void OnInit()
{
sott = SOTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, SottPeriodK1, SottPeriodSlowK1, SottOttPeriod1, SottOttOpt1, SottOttMethod1, SottStosKMethod1);
SetLeverage(Symbol1, Leverage2);
SetLeverageType(Symbol1, LeverageType3);
SetLeverage(Symbol1, Leverage5);
SetLeverageType(Symbol1, LeverageType6);
SendOrderSequential(true, Side.All);
WorkWithPermanentSignal(true);
}
public override void OnInitCompleted()
{
}
public override void OnTimer()
{
}
public override void OnNewsReceived(int newsId, List<string> relatedSymbols)
{
}
public override void OnDataUpdate(BarDataEventArgs barData)
{
if (CrossAbove(sott, sott, 0, 1))
{
if (FirstRun == 0)
{
SendMarketOrder(Symbol1, OrderQuantity1, OrderSide.Buy, includeAfterSession:false, isReduceOnly : IsReduceOnly1);
FirstRun = 1;
}
else
{
SendMarketOrder(Symbol1, OrderQuantity1 * 2, OrderSide.Buy, includeAfterSession:false, isReduceOnly : IsReduceOnly1);
}
}
if (CrossBelow(sott, sott, 0, 1))
{
if (FirstRun == 0)
{
SendMarketOrder(Symbol1, OrderQuantity4, OrderSide.Sell, includeAfterSession:false, isReduceOnly : IsReduceOnly4);
FirstRun = 1;
}
else
{
SendMarketOrder(Symbol1, OrderQuantity4 * 2, OrderSide.Sell, includeAfterSession:false, isReduceOnly : IsReduceOnly4);
}
}
}
}
}

