1 beğenilme 0 beğenilmeme
704 kez görüntülendi
Merhabalar.

 

 Aşağıda ki kodları destek platformunda örnek verilmiş algoritmalara göre, matriks IQ da yazmaya çalıştım ancak yazdığım algoritmayı backtest yaptığımda da şartlar sağlansa da işlemlerin gecikmeli yapıldığını farkettim ve bir türlü sebebini anlayamıyorum. İlgili C# ta yazdiğım satırları ve metastock dilinde ki formülleri aşağıda yazıyorum. Yardımlarınızı rica ederim. Şimdiden çok teşekkürler.

//AL

if(MOV(c, opt1, VAR) > OTT(C, opt1,7),
MOV(C, opt1, VAR) > OTT(C, opt1, opt2) AND
STOSK(opt3,opt4,111, VAR) > STOSD(opt3,opt4,111,VAR) AND
H> REF(HHV(H,20),-1)),
MOV(C, opt1, VAR) > OTT(C, opt1, opt2) AND
STOSK(opt3,opt4,111, VAR)> STOSD(opt3,opt4,111,VAR) AND
H> REF(HHV(H,20),-1)))

//SAT

if(MOV(c, opt1, VAR) > OTT(C, opt1,7),
MOV(C, opt1, VAR) < OTT(C, opt1, opt2) AND
STOSK(opt3,opt4,111, VAR) < STOSD(opt3,opt4,111,VAR) AND
L< REF(LLV(L,20),-1)),
MOV(C, opt1, VAR) < OTT(C, opt1, opt2) AND
STOSK(opt3,opt4,111, VAR) < STOSD(opt3,opt4,111,VAR) AND
L< REF(LLV(L,20),-1))

C#

public override void OnDataUpdate(BarDataEventArgs barData)

{

var barData1 = GetBarData(Symbol1, SymbolPeriod1);

var ohlcData1 = GetSelectedValueFromBarData(barData1, OHLCType.High);

var ohlcData2 = GetSelectedValueFromBarData(barData1, OHLCType.Low);

 

if (ott.Value[1][ott.CurrentIndex] > ott.Value[0][ott.CurrentIndex])

{

if (ott2.Value[1][ott2.CurrentIndex] > ott2.Value[0][ott.CurrentIndex] && stochasticSlow.Value[0][stochasticSlow.CurrentIndex] > stochasticSlow.Value[1][stochasticSlow.CurrentIndex] && highestHigh.Value[0][highestHigh.CurrentIndex - 1] < ohlcData1)

{

SendMarketOrder(Symbol1, OrderQuantity1, OrderSide.Buy, includeAfterSession:false);

}

}

 

else

{

if (ott.Value[1][ott.CurrentIndex] > ott.Value[0][ott.CurrentIndex] && ott2.Value[1][ott2.CurrentIndex] > ott2.Value[0][ott.CurrentIndex] && stochasticSlow.Value[0][stochasticSlow.CurrentIndex] > stochasticSlow.Value[1][stochasticSlow.CurrentIndex] && highestHigh.Value[0][highestHigh.CurrentIndex - 1] < ohlcData1)

{

SendMarketOrder(Symbol1, OrderQuantity1, OrderSide.Buy, includeAfterSession:false);

}

}

 

if (ott.Value[1][ott.CurrentIndex] > ott.Value[0][ott.CurrentIndex])

{

if (ott2.Value[1][ott2.CurrentIndex] < ott2.Value[0][ott.CurrentIndex] && stochasticSlow.Value[0][stochasticSlow.CurrentIndex] < stochasticSlow.Value[1][stochasticSlow.CurrentIndex] && lowestLow.Value[0][lowestLow.CurrentIndex - 1] > ohlcData2)

{

SendMarketOrder(Symbol1, OrderQuantity2, OrderSide.Sell, includeAfterSession:false);

}

}

 

else

{

if (ott.Value[1][ott.CurrentIndex] > ott.Value[0][ott.CurrentIndex] && ott2.Value[1][ott2.CurrentIndex] < ott2.Value[0][ott.CurrentIndex] && stochasticSlow.Value[0][stochasticSlow.CurrentIndex] < stochasticSlow.Value[1][stochasticSlow.CurrentIndex] && lowestLow.Value[0][lowestLow.CurrentIndex - 1] > ohlcData2)

{

SendMarketOrder(Symbol1, OrderQuantity2, OrderSide.Sell, includeAfterSession:false);

}

}

 

 

 

}

 

 

 

İyi çalışmalar,
Algoritmik Trading kategorisinde (19 puan) tarafından | 704 kez görüntülendi

1 cevap

0 beğenilme 0 beğenilmeme

Merhabalar,

 Şartlar sağlansa da işlemlerin gecikmeli yapıldığını fark ettim.

Bahsettiğiniz gecikmeli olan durumları/koşulları ekran görüntüsü ile paylaşabilirseniz test edelim. 

İyi çalışmalar.

(11,069 puan) tarafından
7,634 soru
7,640 cevap
4,448 yorum
10,859 kullanıcı