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

Algoritma sihirbazında mov 500 altında koşulları tam sağlamamasına rağmen üst üste açığa satış yapıyor ve açığa satış kapatmıyor. Problemi anlayamadım, bir bakabilir misiniz?

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;
using Matriks.AI;
using Matriks.AI.AiParameters;
using Matriks.AI.Data;
using Matriks.Trader.Core.TraderModels;

namespace Matriks.Lean.Algotrader
{
	public class supervortex2 : 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("BTC_USDT_BIN")]
			public string Symbol1;


		[Parameter(SymbolPeriod.Day)]
			public SymbolPeriod SymbolPeriod1;


		[Parameter(150)]
			public int MovPeriod1;

		[Parameter(MovMethod.S)]
			public MovMethod MovMethod1;

		[Parameter(8)]
			public int SupersmoothedmacdShortPeriod1;

		[Parameter(21)]
			public int SupersmoothedmacdLongPeriod1;

		[Parameter(8)]
			public int SupersmoothedmacdSmoothPeriod1;

		[Parameter(14)]
			public int VortexPeriod1;

		[Parameter(1)]
			public decimal OrderQuantity1;

		[Parameter(1)]
			public decimal OrderQuantity2;

		[Parameter(1)]
			public decimal OrderQuantity3;

		[Parameter(1)]
			public decimal OrderQuantity4;

		MOV mov;
		SuperSmoothedMACD superSmoothedMACD;
		VORTEX vortex;



		public override void OnInit()
		{
			mov = MOVIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, MovPeriod1, MovMethod1);
			superSmoothedMACD = SuperSmoothedMACDIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, SupersmoothedmacdShortPeriod1, SupersmoothedmacdLongPeriod1, SupersmoothedmacdSmoothPeriod1);
			vortex = VortexIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, VortexPeriod1);


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

			//Alttaki fonksiyon açıldıktan sonra parametre olarak verilen saniyede bir OnTimer fonksiyonu tetiklenir.
			// SetTimerInterval(3600);

			//Alttaki fonksiyon ile tanımlanan sembol ile ilgili haber geldiğinde OnNewsReceived fonksiyonu tetiklenir.
			//AddNewsSymbol(Symbol);

			//Alttaki fonksiyon ile tanımlanan anahtar kelime ile ilgili haber geldiğinde OnNewsReceived fonksiyonu tetiklenir.
			//AddNewsKeyword("KAP");
		}

		/// <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>
		/// SetTimerInterval fonksiyonu ile belirtilen sürede bir bu fonksiyon tetiklenir.
		/// </summary>
		public override void OnTimer()
		{

		}

		/// <summary>
		/// AddNewsSymbol ve AddNewsKeyword ile haberlere kayit olunmuşsa bu fonksiyon tetiklenir.
		/// </summary>
		/// <param name="newsId">Gelen haberin id'si</param>
		/// <param name="relatedSymbols">Gelen haberin ilişkili sembolleri</param>
		public override void OnNewsReceived(int newsId, List<string> relatedSymbols)
		{

		}

		/// <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(BarDataEventArgs barData)
		{
			var barData1 = GetBarData(Symbol1, SymbolPeriod1);
			var ohlcData1 = GetSelectedValueFromBarData(barData1, OHLCType.Close);
			if (mov.Value[0][mov.CurrentIndex] < ohlcData1 && vortex.Value[0][vortex.CurrentIndex] < vortex.Value[1][vortex.CurrentIndex] && CrossAbove(superSmoothedMACD, superSmoothedMACD, 0, 1))
			{
				SendMarketOrder(Symbol1, OrderQuantity1, OrderSide.Buy, includeAfterSession:false);
			}
			if (mov.Value[0][mov.CurrentIndex] < ohlcData1 && CrossBelow(superSmoothedMACD, superSmoothedMACD, 0, 1))
			{
				SendMarketOrder(Symbol1, OrderQuantity2, OrderSide.Sell, includeAfterSession:false);
			}
			if (mov.Value[0][mov.CurrentIndex] > ohlcData1 && vortex.Value[0][vortex.CurrentIndex] > vortex.Value[1][vortex.CurrentIndex] && CrossBelow(superSmoothedMACD, superSmoothedMACD, 0, 1))
			{
				SendShortSaleMarketOrder(Symbol1, OrderQuantity3);
			}
			if (mov.Value[0][mov.CurrentIndex] > ohlcData1 && CrossAbove(superSmoothedMACD, superSmoothedMACD, 0, 1))
			{
				SendMarketCloseShortOrder(Symbol1, OrderQuantity4);
			}

		}

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

	}
}

 

Indikator Builder kategorisinde (22 puan) tarafından | 446 kez görüntülendi

1 cevap

2 beğenilme 0 beğenilmeme

Merhaba, oncelikle BTC_USDT_BIN sembolu Binance spot piyasada islem gordugunden, aciga satis imkani yoktur. Ancak BTC_USDT_BIN sembolunde pozitif kosulunuz olustugunda BTCUP_BIN sembolu ile ALIS, BTC_USDT_BIN sembolunde negatif kosulunuz olustugunda ise BTCDOWN_BIN sembolu ile ALIS yaparsaniz istediginiz aciga satis kosullarini platformumuzda yine de saglayabilirsiniz. Orta vadede Binance Vadelileri de eklemeyi dusunuyoruz. Vadeliler acildiginda da aciga satis imkani dogacaktir.

Stratejinizle ilgili ise, alim/satim, aciga satis/kapama kosullarinin sorunsuz yazildigini farz edersek, SendOrderSequentialForShort(true, Side.Sell); satirini stratejinize eklemek aciga satis emirlerinin de sirali gitmesini saglayacaktir. Sanirim sorununuzu bu cozmekte.

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;
using Matriks.AI;
using Matriks.AI.AiParameters;
using Matriks.AI.Data;
using Matriks.Trader.Core.TraderModels;

namespace Matriks.Lean.Algotrader
{
	public class supervortex2 : 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("BTC_USDT_BIN")]
			public string Symbol1;

		[Parameter(SymbolPeriod.Day)]
			public SymbolPeriod SymbolPeriod1;


		[Parameter(150)]
			public int MovPeriod1;

		[Parameter(MovMethod.S)]
			public MovMethod MovMethod1;

		[Parameter(8)]
			public int SupersmoothedmacdShortPeriod1;

		[Parameter(21)]
			public int SupersmoothedmacdLongPeriod1;

		[Parameter(8)]
			public int SupersmoothedmacdSmoothPeriod1;

		[Parameter(14)]
			public int VortexPeriod1;

		[Parameter(1)]
			public decimal OrderQuantity1;

		[Parameter(1)]
			public decimal OrderQuantity2;

		[Parameter(1)]
			public decimal OrderQuantity3;

		[Parameter(1)]
			public decimal OrderQuantity4;

		MOV mov;
		SuperSmoothedMACD superSmoothedMACD;
		VORTEX vortex;



		public override void OnInit()
		{
			mov = MOVIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, MovPeriod1, MovMethod1);
			superSmoothedMACD = SuperSmoothedMACDIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, SupersmoothedmacdShortPeriod1, SupersmoothedmacdLongPeriod1, SupersmoothedmacdSmoothPeriod1);
			vortex = VortexIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, VortexPeriod1);


			SendOrderSequential(true, Side.Buy);
			SendOrderSequentialForShort(true, Side.Sell);
			WorkWithPermanentSignal(true);

			//Alttaki fonksiyon açıldıktan sonra parametre olarak verilen saniyede bir OnTimer fonksiyonu tetiklenir.
			// SetTimerInterval(3600);

			//Alttaki fonksiyon ile tanımlanan sembol ile ilgili haber geldiğinde OnNewsReceived fonksiyonu tetiklenir.
			//AddNewsSymbol(Symbol);

			//Alttaki fonksiyon ile tanımlanan anahtar kelime ile ilgili haber geldiğinde OnNewsReceived fonksiyonu tetiklenir.
			//AddNewsKeyword("KAP");
		}

		/// <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>
		/// SetTimerInterval fonksiyonu ile belirtilen sürede bir bu fonksiyon tetiklenir.
		/// </summary>
		public override void OnTimer()
		{

		}

		/// <summary>
		/// AddNewsSymbol ve AddNewsKeyword ile haberlere kayit olunmuşsa bu fonksiyon tetiklenir.
		/// </summary>
		/// <param name="newsId">Gelen haberin id'si</param>
		/// <param name="relatedSymbols">Gelen haberin ilişkili sembolleri</param>
		public override void OnNewsReceived(int newsId, List<string> relatedSymbols)
		{

		}

		/// <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(BarDataEventArgs barData)
		{
			var barData1 = GetBarData(Symbol1, SymbolPeriod1);
			var ohlcData1 = GetSelectedValueFromBarData(barData1, OHLCType.Close);
			if (mov.Value[0][mov.CurrentIndex] < ohlcData1 && vortex.Value[0][vortex.CurrentIndex] < vortex.Value[1][vortex.CurrentIndex] && CrossAbove(superSmoothedMACD, superSmoothedMACD, 0, 1))
			{
				SendMarketOrder(Symbol1, OrderQuantity1, OrderSide.Buy, includeAfterSession:false);
			}
			if (mov.Value[0][mov.CurrentIndex] < ohlcData1 && CrossBelow(superSmoothedMACD, superSmoothedMACD, 0, 1))
			{
				SendMarketOrder(Symbol1, OrderQuantity2, OrderSide.Sell, includeAfterSession:false);
			}
			if (mov.Value[0][mov.CurrentIndex] > ohlcData1 && vortex.Value[0][vortex.CurrentIndex] > vortex.Value[1][vortex.CurrentIndex] && CrossBelow(superSmoothedMACD, superSmoothedMACD, 0, 1))
			{
				SendShortSaleMarketOrder(Symbol1, OrderQuantity3);
			}
			if (mov.Value[0][mov.CurrentIndex] > ohlcData1 && CrossAbove(superSmoothedMACD, superSmoothedMACD, 0, 1))
			{
				SendMarketCloseShortOrder(Symbol1, OrderQuantity4);
			}

		}

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

	}
}

***STRATEJILERI TEST/DENEME ORTAMINDA CALISTIRMADAN VE SIZIN ISTEDIGINIZ SEKILDE CALISTIGINA EMIN OLMADAN GERCEK ORTAMDA HIC BIR ZAMAN CALISTIRMAYINIZ***

(8,035 puan) tarafından
1 0
Çok teşekkür ederim, emeğinize sağlık :)
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,591 soru
7,598 cevap
4,441 yorum
10,470 kullanıcı