Merhaba,
Aşağıdaki kodu deneyebilirsiniz.
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 PmaxCrossExp : Explorer
{
[Parameter(10)]
public int AtrPeriod;
[Parameter(10)]
public int MovPeriod;
[Parameter(3)]
public decimal Coeff;
PMaxIndicator pmax;
public override void OnInit()
{
pmax = PMaxIndicators(Symbol, SymbolPeriod, AtrPeriod, MovPeriod, Coeff, MovMethod.E);
AddColumns(3);
SetColumnText(0, "ST");
SetColumnText(1, "K");
SetColumnText(2, "EmirYönü");
}
public override bool OnExplorer(List<BarDataEventArgs> bardatas)
{
SetColumn(0, Math.Round(pmax.StLine.CurrentValue, 4));
SetColumn(1, Math.Round(pmax.KLine.CurrentValue, 4));
if (CrossAbove(pmax.KLine, pmax.StLine))
{
SetColumn(2, "AL");
return true;
}else if (CrossBelow(pmax.KLine, pmax.StLine))
{
SetColumn(2, "SAT");
return true;
}else
{
return false;
}
}
}
}