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.

2

anıl özekşi if bloku içerisinde ott stratejisinin matriksiq dilinde yazılması

Soruldu
Görüntülenme
2.718 görüntülenme
Durum
Cevaplandı
AL:

IF(OTTSUP(C,2,1)>OTT(C,2,1),

CROSS(OTTSUP(2,1),OTT(2,1)),

CROSS(OTTSUP(2,1),OTT(2,1)))

 

SAT:

IF(OTT(C,2,1)<OTT(C,2,1),

CROSS(OTT(2,1),OTTSUP(2,1)),

CROSS(OTT(2,1),OTTSUP(2,1)))

 

BU FORMÜL VE YAPI ANIL ÖZEKŞİ STRATEJİSİ OLUP MATRİKSPRİME AL-SAT FORMÜLÜDÜR.

BUNU MATRİKSIQ İÇİN AL-SAT, AÇIĞA SAT-AÇIK POZİSYONU KAPAT ŞEKLİNDE YAZILIRSA SEVİNİRİM.
Paylaş

1 Cevap

2

Merhaba,

Aşağıdaki stratejiyi deneyebilirsiniz.

Strateji adının OttByAnilOzeksi olmasına dikkat ediniz.

***STRATEJİLERİ TEST/DENEME ORTAMINDA SINAMADAN VE SİZİN İSTEDİĞİNİZ ŞEKİLDE ÇALIŞTIĞINA EMİN OLMADAN GERÇEK ORTAMDA HİÇBİR ZAMAN ÇALIŞTIRMAYINIZ ***

Matriks veri terminali kodu:

AL
	if(OTTSup(c,opt1,opt2)>OTT(c,opt1,opt2),
	cross(OTTSup(c,opt3,opt4),OTT(c,opt3,opt4)),
	cross(OTTSup(c,opt5,opt4),OTT(c,opt5,opt6)))
				
SAT				
	if(OTTSup(c,opt1,opt2)>OTT(c,opt1,opt2),
	cross(OTT(c,opt3,opt4),OTTSup(c,opt3,opt4)),
	cross(OTT(c,opt5,opt6),OTTSup(c,opt5,opt6)))

 

IQ kodu:

using System;
using System.Collections.Generic;
using System.Linq;
using Matriks.Data.Symbol;
using Matriks.Engines;
using System.Windows.Media;
using Matriks.Indicators;
using Matriks.Symbols;
using Matriks.AlgoTrader;
using Matriks.Trader.Core;
using Matriks.Trader.Core.Fields;
using Matriks.Trader.Core.TraderModels;
using Matriks.Lean.Algotrader.AlgoBase;
using Matriks.Lean.Algotrader.Models;
using Matriks.Lean.Algotrader.Trading;

namespace Matriks.Lean.Algotrader
{
	public class OttByAnilOzeksi : 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("GARAN")]
		public string Symbol;

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

		[Parameter(1)]
		public decimal Quantity;

		[Parameter(2)]
		public int OttPeriod1;

		[Parameter(1.4)]
		public decimal OttOpt1;

		[Parameter(2)]
		public int OttPeriod2;

		[Parameter(1.4)]
		public decimal OttOpt2;

		[Parameter(2)]
		public int OttPeriod3;

		[Parameter(1.4)]
		public decimal OttOpt3;

		OTT ott1, ott2, ott3;

		int FirstRun = 0;
		
		[Parameter(true)]
        public bool AcigaSatisYapilsin;

		/// <summary>
		/// Strateji ilk çalıştırıldığında bu fonksiyon tetiklenir. Tüm sembole kayit işlemleri,
		/// indikator ekleme, haberlere kayıt olma işlemleri burada yapılır. 
		/// </summary>
		public override void OnInit()
		{
			ott1 = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, OttPeriod1, OttOpt1, MovMethod.VAR, true);
			ott2 = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, OttPeriod2, OttOpt2, MovMethod.VAR, true);
			ott3 = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, OttPeriod3, OttOpt3, MovMethod.VAR, true);

			AddSymbol(Symbol, SymbolPeriod);

			//Eger backtestte emri bir al bir sat seklinde gonderilmesi isteniyor bu true set edilir. 
			//Alttaki satırı silerek veya false geçerek emirlerin sirayla gönderilmesini engelleyebilirsiniz. 
			SendOrderSequential(!AcigaSatisYapilsin);

			WorkWithPermanentSignal(true);
		}

		/// <summary>
		/// Init islemleri tamamlaninca, bardatalar kullanmaya hazir hale gelince bu fonksiyon tetiklenir. Data uzerinde bir defa yapilacak islemler icin kullanilir
		/// </summary>
		public override void OnInitComplated()
		{

		}


		/// <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(BarDataCurrentValues barDataCurrentValues)
		{
			if (!AcigaSatisYapilsin) FirstRun = 0;
			/*
				AL
				if(OTTSup(c,opt1,opt2)>OTT(c,opt1,opt2),
				cross(OTTSup(c,opt3,opt4),OTT(c,opt3,opt4)),
				cross(OTTSup(c,opt5,opt4),OTT(c,opt5,opt6)))
				
				SAT				
				if(OTTSup(c,opt1,opt2)>OTT(c,opt1,opt2),
				cross(OTT(c,opt3,opt4),OTTSup(c,opt3,opt4)),
				cross(OTT(c,opt5,opt6),OTTSup(c,opt5,opt6)))
			*/

			// AL
			if (ott1.ottSupportLine.CurrentValue>ott1.ottLine.CurrentValue)
			{
				if (CrossAbove(ott2.ottSupportLine, ott2.ottLine))
				{
					if (FirstRun == 0)
	                {
	                    SendMarketOrder(Symbol, Quantity, (OrderSide.Buy));
	                    Debug("Alış emri gonderildi.");
	                    FirstRun = 1;
	                }
	                else
	                {
	                    SendMarketOrder(Symbol, Quantity * 2, (OrderSide.Buy));
	                    Debug("Alış emri gonderildi.");
	                }
				}
			}else
			{
				if (CrossAbove(ott3.ottSupportLine, ott3.ottLine))
				{
					if (FirstRun == 0)
	                {
	                    SendMarketOrder(Symbol, Quantity, (OrderSide.Buy));
	                    Debug("Alış emri gonderildi.");
	                    FirstRun = 1;
	                }
	                else
	                {
	                    SendMarketOrder(Symbol, Quantity * 2, (OrderSide.Buy));
	                    Debug("Alış emri gonderildi.");
	                }
				}
			}

			// SAT
			if (ott1.ottSupportLine.CurrentValue>ott1.ottLine.CurrentValue)
			{
				if (CrossBelow(ott2.ottSupportLine, ott2.ottLine))
				{
					if (FirstRun == 0)
	                {
	                    SendMarketOrder(Symbol, Quantity, OrderSide.Sell);
						Debug("Satış Emri Gönderildi");
	                    FirstRun = 1;
	                }
	                else
	                {
	                    SendMarketOrder(Symbol, Quantity * 2, OrderSide.Sell);
						Debug("Satış Emri Gönderildi");
	                }				
				}
			}else
			{
				if (CrossBelow(ott3.ottSupportLine, ott3.ottLine))
				{
					if (FirstRun == 0)
	                {
	                    SendMarketOrder(Symbol, Quantity, OrderSide.Sell);
						Debug("Satış Emri Gönderildi");
	                    FirstRun = 1;
	                }
	                else
	                {
	                    SendMarketOrder(Symbol, Quantity* 2, OrderSide.Sell);
						Debug("Satış Emri Gönderildi");
	                }	
				}
			}
		}

		/// <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)
		{
			if (order.OrdStatus.Obj == OrdStatus.Filled)
			{

			}
		}
	}
}

 

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

Cevabınız

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