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

Birden Fazla SMA,WMA ve EMA indikatörü oluşturma

Soruldu
Kategori
İndikator
Görüntülenme
2.341 görüntülenme
Durum
Cevaplandı
Merhaba,

Matriksiq de 5 8 13 21 34 gibi birden fazla periyotları kapsayan tek bir indikatör nasıl oluşturabiliriz. Bir taslak var mı ? Çok fazla programlama diline hakim değilim, kendimce bi deneme yaptım ama başarılı olamadım. Şimdiden teşekkürler.
Paylaş

2 Cevap

0

Bir örnek vermek isterim;

using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using Matriks.Data.Identifiers;
using Matriks.Data.Symbol;
using Matriks.Engines;
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
{
	[IndicatorInformationAttribute("DD_Trend", IndicatorDrawingArea.OnDataSeries)]
	//Indikatörün çizgilerinin isimleri
	[IndicatorLineInformationAttribute(new []
		{
			"İz Süren(0,1,2)", "Direnç", "Destek"
		})]
	public class DD_Trend : MatriksIndicator
	{
		//Indicator opsiyon panelinde değerleri değiştirebildiğimiz parametreler. Int, Bool, Decimal ve Enum değerleri alabilir.Tüm değişken tiplerini DefaultValue ile tanımlarız.
		[DefaultValue(14)]
		public int EmaKisaPeriod
		{
			get; set;
		}

		[DefaultValue(100)]
		public int EmaUzunPeriod
		{
			get; set;
		}

		[DefaultValue(60)]
		public int SmaPeriod
		{
			get; set;
		}

		EMA ema;

		SMA sma1, sma2;
		EMA ema1, ema2, ema3, ema4;

		public override void OnInit()
		{
			ema1 = EMAIndicator(Symbol, SymbolPeriod, OHLCType.High, EmaKisaPeriod);
			ema2 = EMAIndicator(Symbol, SymbolPeriod, OHLCType.High, EmaUzunPeriod);
			ema3 = EMAIndicator(Symbol, SymbolPeriod, OHLCType.Low, EmaKisaPeriod);
			ema4 = EMAIndicator(Symbol, SymbolPeriod, OHLCType.Low, EmaUzunPeriod);

			sma1 = SMAIndicator(Symbol, SymbolPeriod, OHLCType.High, SmaPeriod);
			sma2 = SMAIndicator(Symbol, SymbolPeriod, OHLCType.Low, SmaPeriod);
/*
            Alternatif YÖNTEM:			
            sma1 = new SMA(SmaPeriod);
			sma2 = new SMA(SmaPeriod);
			ema1 = new EMA(EmaKisaPeriod);
			ema2 = new EMA(EmaUzunPeriod);
			ema3 = new EMA(EmaKisaPeriod);
			ema4 = new EMA(EmaUzunPeriod);
*/
			WorkWithPermanentSignal(true);
		}

		public override void OnDataUpdate(int currentBar, decimal inputValue, DateTime barDateTime)
		{
			if (currentBar < EmaUzunPeriod)
			{
				SetLine(0, currentBar, 0);
				SetLine(1, currentBar, 0);
				SetLine(2, currentBar, 0);
				return;
			}

			ema1.Update(Instrument.SymbolBarData.High[currentBar - 5], currentBar, barDateTime);
			ema2.Update(Instrument.SymbolBarData.High[currentBar - 5], currentBar, barDateTime);
			ema3.Update(Instrument.SymbolBarData.Low[currentBar - 5], currentBar, barDateTime);
			ema4.Update(Instrument.SymbolBarData.Low[currentBar - 5], currentBar, barDateTime);

			sma1.Update(Instrument.SymbolBarData.High[currentBar - 5], currentBar, barDateTime);
			sma2.Update(Instrument.SymbolBarData.Low[currentBar - 5], currentBar, barDateTime);

			SetLine(0, currentBar, Instrument.SymbolBarData.HLC3[currentBar]);
			SetLine(1, currentBar, (ema1.CurrentValue + sma1.CurrentValue + ema2.CurrentValue) / 3);
			SetLine(2, currentBar, (ema3.CurrentValue + sma2.CurrentValue + ema4.CurrentValue) / 3);
		}
	}
}

 

1

Merhabalar,

Aynı anda birden fazla indikatörü grafik üzerine ekleyebilirsiniz.

Ayrıca aşağıdaki yapıyı da kullanabilirsiniz.

using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using Matriks.Data.Identifiers;
using Matriks.Data.Symbol;
using Matriks.Engines;
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
{
	//Ilk parametre indikatörün adı, sınıfın adıyla aynı olmalıdır.
	//Ikinci parametre indikatörün Dataserisinin üzerine mi yeni pencereye mi ekleneceğini belirtir. Yeni pencere için ->IndicatorDrawingArea.NewWindow , Data Serisi için IndicatorDrawingArea.OnDataSeries
	[IndicatorInformationAttribute("fatihsahin", IndicatorDrawingArea.OnDataSeries)]
	//Indikatörün çizgilerinin isimleri
	[IndicatorLineInformationAttribute(new []
		{
			"Mov1", "Mov2", "Mov3", "Mov4", "Mov5"
		})]

	public class fatihsahin : MatriksIndicator
	{

		//Indicator opsiyon panelinde değerleri değiştirebildiğimiz parametreler. Int, Bool, Decimal ve Enum değerleri alabilir.Tüm değişken tiplerini DefaultValue ile tanımlarız. 
		[DefaultValue(5)]
			public int Period1
		{
			get; set;
		}
		[DefaultValue(MovMethod.VAR)]
			public MovMethod MovMovMethod1
		{
			get; set;
		}
		[DefaultValue(8)]
			public int Period2
		{
			get; set;
		}
		[DefaultValue(MovMethod.VAR)]
			public MovMethod MovMovMethod2
		{
			get; set;
		}
		[DefaultValue(13)]
			public int Period3
		{
			get; set;
		}
		[DefaultValue(MovMethod.VAR)]
			public MovMethod MovMovMethod3
		{
			get; set;
		}
		[DefaultValue(21)]
			public int Period4
		{
			get; set;
		}
		[DefaultValue(MovMethod.VAR)]
			public MovMethod MovMovMethod4
		{
			get; set;
		}

		[DefaultValue(34)]
			public int Period5
		{
			get; set;
		}
		[DefaultValue(MovMethod.VAR)]
			public MovMethod MovMovMethod5
		{
			get; set;
		}

		MOV mov;
		MOV mov2;
		MOV mov3;
		MOV mov4;
		MOV mov5;




		public sealed override void OnInit()
		{
			mov = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, Period1, MovMovMethod1);
			mov2 = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, Period2, MovMovMethod2);
			mov3 = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, Period3, MovMovMethod3);
			mov4 = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, Period4, MovMovMethod4);
			mov5 = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, Period5, MovMovMethod5);



		}


		public override void OnDataUpdate(int currentBar, decimal inputValue, DateTime barDateTime)
		{


			SetLine(0, currentBar, mov.CurrentValue);
			SetLine(1, currentBar, mov2.CurrentValue);
			SetLine(2, currentBar, mov3.CurrentValue);
			SetLine(3, currentBar, mov4.CurrentValue);
			SetLine(4, currentBar, mov5.CurrentValue);


			return ;

		}


	}
}

İyi çalışmalar.

BağlantıBayraklaasiyangMatriks Destek11.113

Yorumlar (1)

  • ▲0
    hocam selam, bende başka bir alanda buna benzer bir şey istemiştim. bu isteğimin büyük bir kısmını karşılıyor. size zahmet bana sadece haftalık 20 peryot kıjunsen gerekli.bu konu da yardımcı olursanız sevinirim.

Cevabınız

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