Merhaba,
Daha iyi anlamanız için stratejiye açıklama satırları ekledim ve matriks kodundaki değişkenlerin aynısını kullandım.
Aşağıdaki kodu inceleyebilirsiniz.
using System;
using System.Collections.Generic;
using System.Linq;
using Matriks.Data.Symbol;
using System.Windows.Media;
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
{
public class Ornek : MatriksAlgo
{
[SymbolParameter("GARAN")]
public string Symbol;
[Parameter(SymbolPeriod.Min5)]
public SymbolPeriod SymbolPeriod;
[Parameter(5)]
public decimal BuyOrderQuantity;
[Parameter(5)]
public decimal SellOrderQuantity;
[Parameter(123456)]
public int StratejiCalistirilirkenParametreAlma;
RSI a;
MOV b, c, d, e;
MOV al, all;
DI di;
public override void OnInit()
{
a = RSIIndicator(Symbol, SymbolPeriod, OHLCType.Close, 1);
b = MOVIndicator(a, 3, MovMethod.Exponential);
c = MOVIndicator(a, 4, MovMethod.Exponential);
d = MOVIndicator(a, 5, MovMethod.Exponential);
e = MOVIndicator(a, 30, MovMethod.Exponential);
al = MOVIndicator(di, 1, MovMethod.WW);
all=MOVIndicator(al, 5, MovMethod.WW);
di = DIIndicator(Symbol, SymbolPeriod, OHLCType.Close, 14);
AddSymbol(Symbol, SymbolPeriod);
WorkWithPermanentSignal(true);
SendOrderSequential(true);
}
public override void OnInitComplated()
{
}
public override void OnTimer()
{
}
public override void OnNewsReceived(int newsId, List<string> relatedSymbols)
{
}
Dictionary<int, decimal> _llv3 = new Dictionary<int, decimal>();
Dictionary<int, decimal> _llv1 = new Dictionary<int, decimal>();
decimal y1, y3, yy, yyy, Prev,alll;
decimal ai, bi, ci, d1;
public override void OnDataUpdate(BarDataEventArgs barData)
{
var barDataModel = GetBarData();
var Index = barData.BarDataIndex;
var CurrentClose = barData.BarData.Close;
_llv1[Index] = LowestLow(barDataModel, OHLCType.Low, 1);
_llv3[Index] = LowestLow(barDataModel, OHLCType.Low, 3);
y1 = LowestLow(barDataModel, OHLCType.Low, 3);
y3 = _llv1[Index -1];
if (y1>_llv3[Index -1])
yy = y3;
yy = Prev;
if (CurrentClose>yy)
yyy = 1;
yyy = -1;
if(al.CurrentValue>all.CurrentValue)
alll=1;
alll=-1;
if(a>e)
ai=1;
ai=-1;
if(b>e)
bi=1;
bi=-1;
if(c>e)
ci=1;
ci=-1;
if(d>e)
d1=1;
d1=-1;
Prev=ai+bi+ci+d1+yyy+alll;
}
public override void OnOrderUpdate(IOrder order)
{
if (order.OrdStatus.Obj == OrdStatus.Filled)
{
}
}
}
}
Unblocked Games offering a wide range of experiences: action, puzzle, platform, racing, clicker mechanics, strategy, sports, even horror.
https://unblocked1games.github.io