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

OTT İNDİKATÖRÜ VE stochastic slow indikatörü- al-sat-açığa sat-pozisyon kapat seçeneği (bitmex)

Soruldu
Görüntülenme
1.663 görüntülenme
Durum
Çözüldü

merhabalar, sistemi site üzerindeki bilgilerden derledim. olmasını istediğim, hazırr kodlarda mevcut most_bitmex stratejisinde olduğu gibi çift yönlü işlem yapmasını sağlamak. alt bölümü bir türlü uyarlayamadım, yardımcı olabilirmisiniz. ott_stoch bitmex

 

using System;

using System.Collections.Generic;

using System.Linq;

using Matriks.Data.Symbol;

using System.Windows.Media;

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
{

	public class OTT_STOCHASTIC_SLOWINDIKATORU : 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("EKGYO")]

public string Symbol;





		[Parameter(SymbolPeriod.Min15)]

public SymbolPeriod SymbolPeriod;



		[Parameter(1)]

public decimal BuyOrderQuantity;



		[Parameter(1)]

public decimal SellOrderQuantity;



		[Parameter(2)]

public int Period;



		[Parameter(1)]

public decimal Percentage;



		[Parameter(500)]

public int StosPeriodK;



		[Parameter(300)]

public int StosPeriodD;



		[Parameter(500)]

public int StosPeriodSlowK;





		OTT ott;





		bool islemde = false;



		StochasticSlow stos;





		public override void OnInit()
		{

			stos = StochasticSlowIndicator(Symbol, SymbolPeriod, OHLCType.Close, StosPeriodK, StosPeriodD, StosPeriodSlowK, MovMethod.VAR);



			ott = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, Period, Percentage, MovMethod.VAR, true);





			AddSymbol(Symbol, SymbolPeriod);





			// Algoritmanın kalıcı veya geçici sinyal ile çalışıp çalışmayacağını belirleyen fonksiyondur.

			// true geçerseniz algoritma sadece yeni bar açılışlarında çalışır, bu fonksiyonu çağırmazsanız veya false geçerseniz her işlem olduğunda algoritma tetiklenir.

			WorkWithPermanentSignal(true);



			//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(false);

		}





		/// <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)
		{



			bool stosAlSignal = stos.StochasticSlowK.CurrentValue > stos.StochasticSlowD.CurrentValue ? true:false;



			bool buy = (stosAlSignal) ? true:false;





			//bool kanalustu =(ottH.ottSupportLine.CurrentValue>ottH.ottLine.CurrentValue && ottL.ottSupportLine.CurrentValue>ottL.ottLine.CurrentValue) ? true: false ;





			if (CrossAbove(ott.ottSupportLine, ott) && buy && !islemde)
			{



				SendMarketOrder(Symbol, BuyOrderQuantity, (OrderSide.Buy));

				Debug("Alış emri verildi.");

				Debug("OTT_SupportLine:" + ott.ottSupportLine.CurrentValue);

				Debug("OTTLine:" + ott.ottLine.CurrentValue);

				islemde = true;

			}





			if (CrossBelow(ott.ottSupportLine, ott) && !buy && islemde)
			{

				SendMarketOrder(Symbol, SellOrderQuantity, (OrderSide.Sell));

				Debug("Satış emri verildi.");

				Debug("OTT_SupportLine:" + ott.ottSupportLine.CurrentValue);

				Debug("OTTLine:" + ott.ottLine.CurrentValue);

				islemde = false;

			}

		}

	}

}

 

Paylaş

1 Cevap

2

Kabul edilen cevap

Merhaba,

Aşağıdaki stratejiyi deneyiniz.

***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 ***

using System;
using System.Collections.Generic;
using System.Linq;
using Matriks.Data.Symbol;
using System.Windows.Media;
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
{
	public class OTT_STOCHASTIC_SLOWINDIKATORU: 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("EKGYO")]
		public string Symbol;

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

		[Parameter(1)]
		public decimal BuyOrderQuantity;

		[Parameter(1)]
		public decimal SellOrderQuantity;

		[Parameter(2)]
		public int Period;

		[Parameter(1)]
		public decimal Percentage;

		[Parameter(500)]
		public int StosPeriodK;

		[Parameter(300)]
		public int StosPeriodD;

		[Parameter(500)]
		public int StosPeriodSlowK;

		OTT ott;

		bool islemde = false;

		StochasticSlow stos;

		int FirstRun = 0;
        int realposition = 0;
		
		[Output]
        public int IlkCalisma;

        [Output]
        public int Pozisyon;

		public override void OnInit()
		{
			stos = StochasticSlowIndicator(Symbol, SymbolPeriod, OHLCType.Close, StosPeriodK, StosPeriodD, StosPeriodSlowK, MovMethod.VAR);

			ott = OTTIndicator(Symbol, SymbolPeriod, OHLCType.Close, Period, Percentage, MovMethod.VAR, true);

			AddSymbol(Symbol, SymbolPeriod);

			// Algoritmanın kalıcı veya geçici sinyal ile çalışıp çalışmayacağını belirleyen fonksiyondur.
			// true geçerseniz algoritma sadece yeni bar açılışlarında çalışır, bu fonksiyonu çağırmazsanız veya false geçerseniz her işlem olduğunda algoritma tetiklenir.
			WorkWithPermanentSignal(true);

			//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(true,true);

		}

		/// <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)
		{
			bool stosAlSignal = stos.StochasticSlowK.CurrentValue > stos.StochasticSlowD.CurrentValue ? true:false;

			bool buy = (stosAlSignal) ? true:false;
			
			//bool kanalustu =(ottH.ottSupportLine.CurrentValue>ottH.ottLine.CurrentValue && ottL.ottSupportLine.CurrentValue>ottL.ottLine.CurrentValue) ? true: false ;

			if (CrossAbove(ott.ottSupportLine, ott) && buy)
			{
				if (FirstRun == 0)
                {
                    SendMarketOrder(Symbol, BuyOrderQuantity, (OrderSide.Buy));
                    Debug("Alış emri verildi.");
                    FirstRun = 1;
                }
                else
                {
                    SendMarketOrder(Symbol, BuyOrderQuantity * 2, (OrderSide.Buy));
                    Debug("Alış emri verildi.");
                }				

				Debug("OTT_SupportLine:" + ott.ottSupportLine.CurrentValue);
				Debug("OTTLine:" + ott.ottLine.CurrentValue);
				islemde = true;
			}

			if (CrossBelow(ott.ottSupportLine, ott) && !buy)
			{
				if (FirstRun == 0)
                {
                    SendMarketOrder(Symbol, SellOrderQuantity, (OrderSide.Sell));
                    Debug("Satış emri verildi.");
                    FirstRun = 1;
                }
                else
                {
                    SendMarketOrder(Symbol, SellOrderQuantity * 2, (OrderSide.Sell));
                    Debug("Satış emri verildi.");
                }			

				Debug("OTT_SupportLine:" + ott.ottSupportLine.CurrentValue);
				Debug("OTTLine:" + ott.ottLine.CurrentValue);
				islemde = false;
			}
			
			IlkCalisma = FirstRun;
            Pozisyon = realposition;
		}
		
		public override void OnOrderUpdate(IOrder order)
        {
            //Gercek zamanli pozisyon takibi
            if (order.OrdStatus.Obj == OrdStatus.Filled && order.Side.Obj == Side.Buy)
            {
                var positionChange = order.OrderQty;
                realposition += (int)positionChange;
                Debug("[ONORDERUPDATE]: Pozisyon = " + realposition);
            }
            if (order.OrdStatus.Obj == OrdStatus.Filled && order.Side.Obj == Side.Sell)
            {
                var positionChange = order.OrderQty;
                realposition -= (int)positionChange;
                Debug("[ONORDERUPDATE]: Pozisyon = " + realposition);
            }
        }
	}
}

 

Unblocked Games offering a wide range of experiences: action, puzzle, platform, racing, clicker mechanics, strategy, sports, even horror.
https://unblocked1games.github.io
BağlantıBayrakladüzenlendi · ALİ ÇETİNKripexMatriks Destek16.499

Yorumlar (3)

Cevabınız

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