0 beğenilme 0 beğenilmeme
338 kez görüntülendi

Merhaba ,

 

Anıl bey'in son eğitiminde kullandığı strateji içinde çalışma saati bilgilerini IQ da nasıl girebiliriz

Kırmızı kutu içerisindeki diğer kodlama satırı Ref ile ilgili olan sanırım HOTT-LOTT olarak verildi.

 

iyi çalışmalar

 

 

Algoritmik Trading kategorisinde (24 puan) tarafından | 338 kez görüntülendi

1 cevap

0 beğenilme 0 beğenilmeme

Merhabalar,

Dilerseniz aşağıdaki linki lütfen inceleyebilirsiniz.

https://destek.matriksdata.com/?qa=9921/iq-emir-zamanlamalar%C4%B1

Yukarıdaki sistem içinse aşağıdaki yapıyı inceleyebilirsiniz.

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 SablonAnılOzeksi : MatriksAlgo
	{
		[SymbolParameter("FGARAN")]
		public string Symbol;

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

		[Parameter(5)]
		public decimal BuyOrderQuantity;

		[Parameter(5)]
		public decimal SellOrderQuantity;

		[Parameter(false)]
		public bool AcigaSatisYapilsin;

		[Parameter(false)]
		public bool AksamSeansiniDahilEt;

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

		[Parameter(3)]
			public int KaldiracOrani;

		[Parameter(20)]
			public int OttPeriod1;

		[Parameter(7.3)]
			public decimal OttOpt1;

		[Parameter(MovMethod.VAR)]
			public MovMethod OttMovMethod1;

		[Parameter(true)]
			public bool OttSupportLine1;

		[Parameter(30)]
			public int OttPeriod2;

		[Parameter(0.4)]
			public decimal OttOpt2;

		[Parameter(500)]
			public int StochasticslowPeriodK1;

		[Parameter(111)]
			public int StochasticslowPeriodD1;

		[Parameter(300)]
			public int StochasticslowPeriodSlowK1;

		[Parameter(MovMethod.VAR)]
			public MovMethod StochasticslowMovMethod1;

		[Parameter(20)]
			public int H1;

		[Parameter(30)]
			public int OttPeriod3;

		[Parameter(3.4)]
			public decimal OttOpt3;

		[Parameter(30)]
			public int OttPeriod4;

		[Parameter(0.9)]
			public decimal OttOpt4;

		[Parameter(500)]
			public int StochasticslowPeriodK2;

		[Parameter(111)]
			public int StochasticslowPeriodD2;

		[Parameter(300)]
			public int StochasticslowPeriodSlowK2;

		[Parameter(10)]
			public int H2;

		[Parameter(40)]
			public int OttPeriod5;

		[Parameter(0.6)]
			public decimal OttOpt5;

		[Parameter(500)]
			public int StochasticslowPeriodK3;

		[Parameter(111)]
			public int StochasticslowPeriodD3;

		[Parameter(200)]
			public int StochasticslowPeriodSlowK3;

		[Parameter(10)]
			public int L1;

		[Parameter(30)]
			public int OttPeriod6;

		[Parameter(0.9)]
			public decimal OttOpt6;

		[Parameter(500)]
			public int StochasticslowPeriodK4;

		[Parameter(111)]
			public int StochasticslowPeriodD4;

		[Parameter(300)]
			public int StochasticslowPeriodSlowK4;

		[Parameter(10)]
			public int L2;

		OTT ott;
		OTT ott2;
		OTT ott3;
		OTT ott4;
		OTT ott5;
		OTT ott6;
		StochasticSlow stochasticSlow;
		StochasticSlow stochasticSlow2;
		StochasticSlow stochasticSlow3;
		StochasticSlow stochasticSlow4;


		HighestHigh HHV1;
		LowestLow LLV;
		LowestLow LLV1;
		HighestHigh HHV;

		public override void OnDataUpdate(BarDataEventArgs barData)
		{
			var barData1 = GetBarData(Symbol, SymbolPeriod);

			var h = GetSelectedValueFromBarData(barData1, OHLCType.High);
			var l = GetSelectedValueFromBarData(barData1, OHLCType.Low);

			if (ott.Value[1][ott.CurrentIndex] > ott.Value[0][ott.CurrentIndex])
			{
				if (ott2.Value[1][ott2.CurrentIndex] > ott2.Value[0][ott2.CurrentIndex]
					&& stochasticSlow.Value[0][stochasticSlow.CurrentIndex] > stochasticSlow.Value[1][stochasticSlow.CurrentIndex]
					&& h>HHV.Value[0][HHV.CurrentIndex -1])
				{
					FX_Alis(Symbol, BuyOrderQuantity);
				}
			}
			else
			{
				if (ott3.Value[1][ott3.CurrentIndex] > ott3.Value[0][ott3.CurrentIndex]
					&& ott4.Value[1][ott4.CurrentIndex] > ott4.Value[0][ott4.CurrentIndex]
					&& stochasticSlow2.Value[0][stochasticSlow2.CurrentIndex] > stochasticSlow2.Value[1][stochasticSlow2.CurrentIndex]
					&& h>HHV1.Value[0][HHV1.CurrentIndex -1])
				{
					FX_Alis(Symbol, BuyOrderQuantity);
				}
			}

			if (ott.Value[1][ott.CurrentIndex] > ott.Value[0][ott.CurrentIndex])
			{
				if (ott5.Value[1][ott5.CurrentIndex] < ott5.Value[0][ott5.CurrentIndex]
					&& stochasticSlow3.Value[0][stochasticSlow3.CurrentIndex] <stochasticSlow3.Value[1][stochasticSlow3.CurrentIndex]
					&& l<LLV.Value[0][LLV.CurrentIndex -1])
				{
					FX_Satis(Symbol, SellOrderQuantity);
				}
			}

			else
			{
				if (ott6.Value[1][ott6.CurrentIndex] < ott6.Value[0][ott6.CurrentIndex]
					&& stochasticSlow4.Value[0][stochasticSlow4.CurrentIndex] < stochasticSlow4.Value[1][stochasticSlow4.CurrentIndex]
					&& l<LLV1.Value[0][LLV1.CurrentIndex -1])
				{
					FX_Satis(Symbol, SellOrderQuantity);
				}
			}
		}



		public override void OnInit()
		{
			AddSymbol(Symbol, SymbolPeriod);
			ott = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, OttPeriod1, OttOpt1, OttMovMethod1, OttSupportLine1);
			ott2 = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, OttPeriod2, OttOpt2, OttMovMethod1, OttSupportLine1);
			stochasticSlow = StochasticSlowIndicator(Symbol, SymbolPeriod, OHLCType.Close, StochasticslowPeriodK1, StochasticslowPeriodD1, StochasticslowPeriodSlowK1, StochasticslowMovMethod1);
			stochasticSlow2 = StochasticSlowIndicator(Symbol, SymbolPeriod, OHLCType.Close, StochasticslowPeriodK2, StochasticslowPeriodD2, StochasticslowPeriodSlowK2, StochasticslowMovMethod1);
			stochasticSlow3 = StochasticSlowIndicator(Symbol, SymbolPeriod, OHLCType.Close, StochasticslowPeriodK3, StochasticslowPeriodD3, StochasticslowPeriodSlowK3, StochasticslowMovMethod1);
			stochasticSlow4 = StochasticSlowIndicator(Symbol, SymbolPeriod, OHLCType.Close, StochasticslowPeriodK4, StochasticslowPeriodD4, StochasticslowPeriodSlowK4, StochasticslowMovMethod1);
			ott3 = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, OttPeriod3, OttOpt3, OttMovMethod1, OttSupportLine1);
			ott4 = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, OttPeriod4, OttOpt4, OttMovMethod1, OttSupportLine1);
			ott5 = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, OttPeriod5, OttOpt5, OttMovMethod1, OttSupportLine1);
			ott6 = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, OttPeriod6, OttOpt6, OttMovMethod1, OttSupportLine1);

			HHV = HighestHighIndicator(Symbol, SymbolPeriod, H1);
			HHV1 = HighestHighIndicator(Symbol, SymbolPeriod, H2);
			LLV = LowestLowIndicator(Symbol, SymbolPeriod, L1);
			LLV1 = LowestLowIndicator(Symbol, SymbolPeriod, L2);

			// 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ış

			// kaldıraç oranı
			SetLeverage(Symbol, KaldiracOrani);
			// kaldıraç tipi – true isolated, false cross
			SetLeverageType(Symbol, false);
			// Gerekli

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

		}

		// Gerekli açığa satış
		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;
			}
		}


		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;

		string orderIDTimestamp = string.Empty;
		// #Gerekli - Timestamp

		public override void OnTimer()
		{
			// Gerekli - Timestamp
			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
		}

		public override void OnOrderUpdate(IOrder order)
		{
			// Gerekli - Timestamp
			if (order.OrdStatus.Obj == OrdStatus.Filled)
			{
				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
(11,069 puan) tarafından
Hoş geldiniz, Matriks Destek Platformu sizlere sorularınızın hızlıca cevaplanması için bir ortam sağlar. 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.



7,637 soru
7,640 cevap
4,448 yorum
10,958 kullanıcı