Matriks Destek ve Yardım Platformu

Matriks Ürünleri ile ilgili tüm sorularınız için bizlere buradan ulaşabilirsiniz. Daha önce sorulan soruları ve verilen cevapları ilgili sekmelerden ve arama üzerinden inceleyebilirsiniz. Sağ taraftaki kategoriler üzerinden İlgilendiğiniz özelliklerle ilgili soruları filtreleyebilirsiniz. Soru ve cevapları sosyal medyada paylaşabilirsiniz. Sorduğunuz ve cevapladığınız soruların ve yorumlarınızın aldığı oylar üzerinden puan kazanırsınız. Puan sistemine bağlı kampanyamızla ücretsiz kullanım avantajlarından faydalanabilirsiniz.

0

Time stamp hatası düzeltilemiyor

Soruldu
Görüntülenme
931 görüntülenme
Durum
Cevaplandı

örnek olarak verdiğiniz kodu uyguladım ancak hala time stamp hatası alıyorum acaba kodu yanlıs mı kullanıyorum. yardımcı olur musunuz?

alım emrinin tekrar gönderilmesi için 10 sn süre verdim ve 3 kere alım göndermesini ayarladım ancak gerçekleşmiyor.

using System;
using System.Collections.Generic;
using System.Linq;
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;

namespace Matriks.Lean.Algotrader
{
	public class DENEME : MatriksAlgo
	{
		[SymbolParameter("ftm_USDT_FBIN")]
		public string Symbol;

		[Parameter(SymbolPeriod.Min15)]
		public SymbolPeriod SymbolPeriod;

		[Parameter(10)]
			public int SuperPeriod;

		[Parameter(3)]
			public decimal Coeff;

		[Parameter(false)]
			public bool IsReduceOnly1;

		[Parameter(10)]
			public decimal Leverage1;

		[Parameter(false)]
			public bool IsReduceOnly2;

		[Parameter(CryptoLeverageType.Isolated)]
			public CryptoLeverageType LeverageType2;

		[Parameter(3)]
			public decimal BuyOrderQuantity;

		[Parameter(false)]
			public bool IsReduceOnly3;

		[Parameter(false)]
			public bool IsReduceOnly4;

		[Parameter(10)]
			public decimal Leverage4;

		[Parameter(false)]
			public bool IsReduceOnly5;

		[Parameter(CryptoLeverageType.Isolated)]
			public CryptoLeverageType LeverageType5;

		[Parameter(3)]
			public decimal SellOrderQuantity;

		[Parameter(false)]
			public bool IsReduceOnly6;

		[Parameter(5)]
		 public decimal ZararDurdur;

		SuperTrend superTrend;

		public override void OnDataUpdate(BarDataEventArgs barData)
		{
			// alış koşulu
			var barDataModel = GetBarData();

			if (CrossAbove(barDataModel, superTrend, OHLCType.Close))
			{
				// Gerekli açığa satış
				FX_Alis(Symbol, BuyOrderQuantity);
				StopLoss(Symbol, SyntheticOrderPriceType.Percent, ZararDurdur);

				// #Gerekli açığa satış
			}

			// satış koşulu
			if (CrossBelow(barDataModel, superTrend, OHLCType.Close))
			{
				// Gerekli açığa satış
				FX_Satis(Symbol, SellOrderQuantity);
				StopLoss(Symbol, SyntheticOrderPriceType.Percent, ZararDurdur);
				// #Gerekli açığa satış
			}
		}

		public override void OnInit()
		{
			AddSymbol(Symbol, SymbolPeriod);
			superTrend = SuperTrendIndicator(Symbol, SymbolPeriod, SuperPeriod, Coeff);
			// Gerekli açığa satış
			WorkWithPermanentSignal(true);

			if (HangiIslemleBaslasin == yon.Alis)
			{
				SendOrderSequential(true, Side.Buy);
			}else if (HangiIslemleBaslasin == yon.Satis)
			{
				SendOrderSequential(true, Side.Sell);
			}else
			{
				SendOrderSequential(true, Side.All);
			}

			SendOrderSequentialForShort(true, Side.All);
			// #Gerekli açığa satış
		}

		// Gerekli açığa satış
		[Parameter(true)]
		public bool AcigaSatisYapilsin;

		[Parameter(false)]
		public bool AksamSeansiniDahilEt;

		[Parameter(yon.Farketmez)]
		public yon HangiIslemleBaslasin;

		public enum yon
		{
			Alis, Satis, Farketmez
		}

		public void FX_Alis(string sembol, decimal quantity)
		{
			decimal _quantity = 0;

			if (LastOrderSide.Obj != Side.Buy)
			{
				if (LastOrderSide.Obj == Side.All || !AcigaSatisYapilsin)
				{
					SendMarketOrder(Symbol, quantity, OrderSide.Buy, includeAfterSession:AksamSeansiniDahilEt);
					_quantity = quantity;
				}else
				{
					if (LastOrderSideForShort.Obj == Side.All)
					{
						SendMarketOrder(Symbol, quantity, OrderSide.Buy, includeAfterSession:AksamSeansiniDahilEt);
						_quantity = quantity;
					}else
					{
						SendMarketOrder(Symbol, quantity * 2, OrderSide.Buy, includeAfterSession:AksamSeansiniDahilEt);
						_quantity = quantity * 2;
					}
				}

				Debug("Alış emri gönderildi.[ " + _quantity + " adet ]");
				LastOrderSide.Obj = Side.Buy;
				LastOrderSideForShort.Obj = Side.Buy;
			}
		}

		public void FX_Satis(string sembol, decimal quantity)
		{
			decimal _quantity = 0;

			if (LastOrderSide.Obj != Side.Sell)
			{
				if (LastOrderSide.Obj == Side.All || !AcigaSatisYapilsin)
				{
					SendMarketOrder(Symbol, quantity, OrderSide.Sell, includeAfterSession:AksamSeansiniDahilEt);
					_quantity = quantity;
				}else
				{
					if (LastOrderSideForShort.Obj == Side.All)
					{
						SendMarketOrder(Symbol, quantity, OrderSide.Sell, includeAfterSession:AksamSeansiniDahilEt);
						_quantity = quantity;

					}else
					{
						SendMarketOrder(Symbol, quantity * 2, OrderSide.Sell, includeAfterSession:AksamSeansiniDahilEt);
						_quantity = quantity * 2;
					}
				}

				Debug("Satış emri gönderildi.[ " + _quantity + " adet ]");
				LastOrderSide.Obj = Side.Sell;
				LastOrderSideForShort.Obj = Side.Sell;
			}
			// Gerekli - Timestamp
			SetTimerInterval(1);
			// #Gerekli - Timestamp
		}

		public override void OnSyntheticOrderTriggered(SyntheticAlgoOrder sOrder)
		{
			if (sOrder.EnableOrderSending)
			{
				LastOrderSide.Obj = Side.All;
				Debug("Sentetik emir tetiklendi");
			}
		}
		// #Gerekli açığa satış
		
		
		
	// Gerekli - Timestamp
		public class OrderListTimestamp
		{
			public string ID;
			public string Sembol;
			public decimal Adet;
			public decimal Fiyat;
			public OrdType EmirTipi;
			public OrderSide orderSide;
			public string EmirYonu;
			public DateTime TetiklenmeZamani;
			public int Sayac;
			public bool AktifMI;
		}

		Dictionary<string, OrderListTimestamp> timestampDict = new Dictionary<string, OrderListTimestamp>();

		[Parameter(3)]
		public int AyniEmirKacSeferGonderilsin;

		[Parameter(10)]
		public int KacSaniyeSonraTekrarGonderilsin;

		public override void OnOrderUpdate(IOrder order)
		{
			if (order.OrdStatus.Obj == OrdStatus.Filled)
			{
				Debug("gerçekleşti");

				if (timestampDict.ContainsKey(order.CliOrdID))
				{
					timestampDict.Remove(order.CliOrdID);
					Debug("Timestamp hatasına takılan emriniz gerçekleşti.");
				}
			}

			if (order.OrdStatus.Obj == OrdStatus.Rejected)
			{
				if (!timestampDict.ContainsKey(order.CliOrdID))
				{
					OrderListTimestamp orderList = new OrderListTimestamp();
					orderList.ID = order.CliOrdID;
					orderList.Sembol = order.Symbol;
					orderList.Adet = order.OrderQty;
					orderList.Fiyat = order.Price;
					orderList.EmirTipi = order.OrdType;
					orderList.TetiklenmeZamani = DateTime.Now;
					orderList.Sayac = 0;
					orderList.AktifMI = false;

					if (order.Side.Obj == Side.Buy)
					{
						orderList.orderSide = OrderSide.Buy;
						orderList.EmirYonu = "Alış";
					}else
					{
						orderList.orderSide = OrderSide.Sell;
						orderList.EmirYonu = "Satış";
					}

					timestampDict[order.CliOrdID] = orderList;
				}

				if (order.Text.Contains("Timestamp"))
				{
					if (timestampDict.ContainsKey(order.CliOrdID))
					{
						if (timestampDict[order.CliOrdID].Sayac < AyniEmirKacSeferGonderilsin)
						{
							timestampDict[order.CliOrdID].TetiklenmeZamani = DateTime.Now.AddSeconds(KacSaniyeSonraTekrarGonderilsin);
							timestampDict[order.CliOrdID].Sayac++;
							timestampDict[order.CliOrdID].AktifMI = true;

							Debug("Emir Timestamp hatasından dolayı iptal oldu tekrar gönderilecek");
						}else
						{
							timestampDict.Remove(order.CliOrdID);
							Debug("Aynı emir üst üste " + AyniEmirKacSeferGonderilsin + " defa gönderildi.");
						}
					}
				}
			}
		}


		string orderIDTimestamp = string.Empty;

		public override void OnTimer()
		{
			var tutt = timestampDict.Where(x => x.Value.AktifMI == true && DateTime.Now >= x.Value.TetiklenmeZamani);

			if (tutt.Count() >0)
			{
				foreach (var deger in tutt)
				{
					LastOrderSide.Obj = deger.Value.orderSide == OrderSide.Buy? Side.Sell:Side.Buy;

					if (deger.Value.EmirTipi.Obj == OrdType.Limit)
					{
						orderIDTimestamp = SendLimitOrder(deger.Value.Sembol, deger.Value.Adet, deger.Value.orderSide, deger.Value.Fiyat);
						Debug(deger.Value.EmirYonu + " emri tekrar gönderildi.");
					}else if (deger.Value.EmirTipi.Obj == OrdType.Market)
					{
						orderIDTimestamp = SendMarketOrder(deger.Value.Sembol, deger.Value.Adet, deger.Value.orderSide);
						Debug(deger.Value.EmirYonu + " emri tekrar gönderildi.");
					}

					deger.Value.ID = orderIDTimestamp;
					deger.Value.AktifMI = false;
					timestampDict[orderIDTimestamp] = deger.Value;
					timestampDict.Remove(deger.Key);

				}
			}
		}
		// #Gerekli - Timestamp
	}
}

 

Paylaş

2 Cevap

0

Merhaba,

Timestamp yapısını stratejiye eksik eklemişsiniz. Resimde de görüldüğü üzere timestamp hatasını yakalamış ama 10sn sonra emri tekrar göndermemiş bunun sebebi OnInit() methoduna SetTimerInterval() fonksiyonunun eklenmemesi.

Aşağıdaki gibi düzenleme yapmalısınız.

public override void OnInit()
{
	AddSymbol(Symbol, SymbolPeriod);
	mov = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, MovPeriod, MovMethod.Exponential);
	mov2 = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, MovPeriod2, MovMethod.Exponential);

	SendOrderSequential(true, Side.All);
	WorkWithPermanentSignal(true);

	// Gerekli - Timestamp
	SetTimerInterval(1);
	// #Gerekli - Timestamp
}

 

Unblocked Games offering a wide range of experiences: action, puzzle, platform, racing, clicker mechanics, strategy, sports, even horror.
https://unblocked1games.github.io
BağlantıBayraklaKripexMatriks Destek16.499

Yorumlar (1)

Cevabınız

Cevap yazmak için giriş yapın.Giriş yapKayıt ol