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.