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

son 100 gün içerisinde ortalamarı kesişenler - Explorer

Soruldu
Kategori
Explorer
Görüntülenme
1.389 görüntülenme
Durum
Cevaplandı

Merhaba...

Aşağıdaki Explorer kodu SON BAR'da 20 ve 200 günlük ortalamaları kesişen hisseleri listeliyor.

Bu kodu son 100 gün içerisinde herhangi bir zamanda ortalamaları kesişen hisseleri verecek şekilde nasıl modifiye edebilirim ? 

public class Mov20BuyukMov200 : Explorer
	{
  //   [Parameter(200)]
		public int p20 = 20 ;
		public int p200 = 200 ;

		MOV mov20;
		MOV mov200;

		public override void OnInit()
		{
			AddColumns(2);
			SetColumnText(0, "Mov20 değeri");
			SetColumnText(1, "Mov200 değeri");
			mov20 = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, p20, MovMethod.Simple);
			mov200 = MOVIndicator(Symbol, SymbolPeriod, OHLCType.Close, p200, MovMethod.Simple);
		}

		public override bool OnExplorer(List<BarDataEventArgs> bardatas)
		{
			var barData = bardatas.FirstOrDefault();
			var close = barData.BarData.Close;

			SetColumn(0, Math.Round(mov20.CurrentValue, 4));
			SetColumn(1, Math.Round(mov200.CurrentValue, 4));

			if (mov20.CurrentValue > mov200.CurrentValue) 
				return true;
			return false;
		}
	}

 

Paylaş

1 Cevap

2

Merhaba,

Son 100 barda kesişim olan sembollerin en son kaç bar önce kesiştiğini raporlayan explorer kodu aşağıdaki gibidir.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Matriks.Data.Symbol;
using Matriks.Engines;
using Matriks.Lean.Algotrader.AlgoBase;
using Matriks.Lean.Algotrader.Models;
using Matriks.Indicators;

namespace Matriks.Lean.Algotrader
{
	public class Son100Bar : Explorer
	{
		MOST most;
		public override void OnInit()
		{
			most = MOSTIndicator(Symbol, SymbolPeriod, OHLCType.Close, 3, 2, MovMethod.Exponential);

			AddColumns(5);
			SetColumnText(0, "Kaç Bar Önce");
			SetColumnText(1, "prev Most");
			SetColumnText(2, "prev Mov");
			SetColumnText(3, "Most");
			SetColumnText(4, "Mov");
		}

		int _kacBarOnce = 0;
		bool _islem = false;
		decimal _prevMost = 0, _most = 0, _prevMov = 0, _mov = 0;

		public override bool OnExplorer(List<BarDataEventArgs> bardatas)
		{
			var barDataModel = GetBarData();
			var _count = barDataModel.Close.Count;
			var index = bardatas.FirstOrDefault().BarDataIndex;
			for (var i = 100; i >= 1; i--)
			{
				if (most.Value[0][index - (i + 1)] >most.Value[1][index - (i + 1)] && most.Value[0][index - i] <most.Value[1][index - i])
				{
					_kacBarOnce = i;
					_islem = true;
					_prevMost = most.Value[0][index - (i + 1)];
					_prevMov = most.Value[1][index - (i + 1)];
					_most = most.Value[0][index - i];
					_mov = most.Value[1][index - i];
				}
			}
			
			if(CrossAbove(most.ExMOV, most)){
				_islem=true;
				_kacBarOnce=0;
			}
			SetColumn(0, _kacBarOnce);
			SetColumn(1, Math.Round(_prevMost, 2));
			SetColumn(2, Math.Round(_prevMov, 2));
			SetColumn(3, Math.Round(_most, 2));
			SetColumn(4, Math.Round(_mov, 2));
			if (_islem)
				return true;
			return false;
		}
	}
}

 

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