0 beğenilme 0 beğenilmeme
252 kez görüntülendi
merhaba
tradingview de CryptoJJ - SSL indicator ü matrikste nasıl yazarız.
iyi çalışmalar diliyorum.

sitedeki formul bu şekilde

length=input(title="SSL length", defval=14)     //  Period for the moving avarages used, if you trade 1H/2H/4H timeframes, you might want to use lower setting.

smaHigh=ema(high, length)   //  Dafault moving avarage is sma, you can use ema for more agressive trading.
smaLow=ema(low, length)
Hlv = close > smaHigh ? 1 : close < smaLow ? -1 : Hlv[1]
sslDown = Hlv < 0 ? smaHigh: smaLow
sslUp   = Hlv < 0 ? smaLow : smaHigh

plot(sslDown, color = fuchsia, linewidth = 2)
plot(sslUp, color = aqua, linewidth = 2)       // Second line of SSL, I personally find it useless, having only one line keeps the chart easier to read.

color_bar = (close > sslDown)? ( open > close? #016e65 : #00ffea) : (close > open? #e100ff : #6c007a)
barcolor(color_bar)

///////////////////////////////////////////////////////////////////////////  ARROW  ////////////////////////////////////////////////////////////////////////////

plotshape(crossover(sslUp,sslDown),style = shape.labelup, location = location.belowbar, color = lime, size= size.small, title="Buy arrow")

plotshape(crossunder(sslUp,sslDown),style = shape.labeldown, location = location.abovebar, color = red, size= size.small, title="Sell arrow")
Indikator Builder kategorisinde (17 puan) tarafından | 252 kez görüntülendi

1 cevap

0 beğenilme 0 beğenilmeme
En İyi Cevap

Merhabalar,

İndikatör aşağıda paylaşılmıştır.

İyi çalışmalar. 

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("CryptoJJSSL", IndicatorDrawingArea.NewWindow)]
	//Indikatörün çizgilerinin isimleri
	[IndicatorLineInformationAttribute(new []
		{
			"CryptoJJSSL(0)", "CryptoJJSSL(1)"
		})]

	public class CryptoJJSSL : 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 Period
		{
			get; set;
		}

		EMA ema;
		EMA ema2;

		public sealed override void OnInit()
		{
			ema = EMAIndicator(Symbol, SymbolPeriod, OHLCType.High, Period);
			ema2 = EMAIndicator(Symbol, SymbolPeriod, OHLCType.Low, Period);


		}



		Dictionary<int, decimal> hlv = new Dictionary<int, decimal>();


		public override void OnDataUpdate(int currentBar, decimal inputValue, DateTime barDateTime)
		{
			var close = Instrument.SymbolBarData.Close[currentBar];
			var smaHigh = ema.CurrentValue;
			var smaLow = ema2.CurrentValue;

			if (currentBar < Period)
			{
				SetLine(0, currentBar, 0);
				SetLine(1, currentBar, 0);
				hlv[currentBar] = 0;
				return ;
			}


			hlv[currentBar] = close>smaHigh? 1: close<smaLow? -1:hlv[currentBar -1];
			var sslDown = hlv[currentBar] < 0 ? smaHigh: smaLow;
			var sslUp = hlv[currentBar] < 0 ? smaLow : smaHigh;

			SetLine(0, currentBar, sslDown);
			SetLine(1, currentBar, sslUp);
			return ;

		}


	}
}

 

(11,069 puan) tarafından
tarafından seçilmiş
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,509 soru
7,511 cevap
4,405 yorum
8,736 kullanıcı