Matriks Destek ve Yardım Platformu

Matriks Ürünleri ile ilgili tüm sorularınız için bizlere buradan ulaşabilirsiniz. Daha önce sorulan soruları ve verilen cevapları ilgili sekmelerden ve arama üzerinden inceleyebilirsiniz. Sağ taraftaki kategoriler üzerinden İlgilendiğiniz özelliklerle ilgili soruları filtreleyebilirsiniz. Soru ve cevapları sosyal medyada paylaşabilirsiniz. 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.

0

Strategy Yazımında TrailingStopLoss

Soruldu
Görüntülenme
88 görüntülenme
Durum
Cevaplandı
Merhaba TralingStopLoss noktasında BackTest yaptığımda anlamadığım bazı noktalar var. Konu hakkında yardımlarınızı rica ederim.

Aşağıdaki stratejide TrailingStopLoss(Symbol1, SyntheticOrderPriceType.Percent, StopLevel1, includeAfterSession:false)'i tek tek kullandığımda aynı sonuçları veriyor ama iki yerde de kullandığım zaman farklı sonuçlar veriyor arasında ki fark nedir?

public override void OnDataUpdate(BarDataEventArgs barData)

{

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

{

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

//TrailingStopLoss(Symbol1, SyntheticOrderPriceType.Percent, StopLevel1, includeAfterSession:false);

}

if (mov.Value[0][mov.CurrentIndex] < mov2.Value[0][mov2.CurrentIndex] && ott.Value[1][ott.CurrentIndex] < ott.Value[0][ott.CurrentIndex])

{

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

TrailingStopLoss(Symbol1, SyntheticOrderPriceType.Percent, StopLevel1, includeAfterSession:false);

}

}

public override void OnDataUpdate(BarDataEventArgs barData)

{

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

{

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

TrailingStopLoss(Symbol1, SyntheticOrderPriceType.Percent, StopLevel1, includeAfterSession:false);

}

if (mov.Value[0][mov.CurrentIndex] < mov2.Value[0][mov2.CurrentIndex] && ott.Value[1][ott.CurrentIndex] < ott.Value[0][ott.CurrentIndex])

{

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

TrailingStopLoss(Symbol1, SyntheticOrderPriceType.Percent, StopLevel1, includeAfterSession:false);

}

}

using System;

using System.Collections.Generic;

using System.Linq;

using Matriks;

using Matriks.Data.Symbol;

using Matriks.Data.Tick;

using Matriks.Engines;

using Matriks.Indicators;

using Matriks.Symbols;

using Matriks.Trader.Core;

using Matriks.Trader.Core.Fields;

using Matriks.Lean.Algotrader.AlgoBase;

using Matriks.Lean.Algotrader.Models;

using Matriks.Lean.Algotrader.Trading;

using Matriks.AI;

using Matriks.AI.AiParameters;

using Matriks.AI.Data;

using Matriks.Trader.Core.TraderModels;

using Matriks.Enumeration;

using Matriks.IntermediaryInstitutionAnalysis.Enums;

using Newtonsoft.Json;

 

namespace Matriks.Lean.Algotrader

{

public class emaott : MatriksAlgo

{

[SymbolParameter("GARAN")]

public string Symbol1;

 

[Parameter(SymbolPeriod.Min)]

public SymbolPeriod SymbolPeriod1;

 

[Parameter(Side.Buy)]

public Side orderSide;

 

[Parameter(5)]

public int MovPeriod1;

 

[Parameter(MovMethod.E)]

public MovMethod MovMovMethod1;

 

[Parameter(55)]

public int MovPeriod2;

 

[Parameter(MovMethod.E)]

public MovMethod MovMovMethod2;

 

[Parameter(2)]

public int OttPeriod1;

 

[Parameter(1.4)]

public decimal OttOpt1;

 

[Parameter(MovMethod.VAR)]

public MovMethod OttMovMethod1;

 

[Parameter(true)]

public bool OttSupportLine1;

 

[Parameter(1)]

public decimal OrderQuantity1;

 

[Parameter(1)]

public decimal OrderQuantity2;

 

[Parameter(1)]

public decimal StopLevel1;

 

MOV mov;

MOV mov2;

OTT ott;

public override void OnInit()

{

mov = MOVIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, MovPeriod1, MovMovMethod1);

mov2 = MOVIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, MovPeriod2, MovMovMethod2);

ott = OTTIndicator(Symbol1, SymbolPeriod1, OHLCType.Close, OttPeriod1, OttOpt1, OttMovMethod1, OttSupportLine1);

SendOrderSequential(true, orderSide);

WorkWithPermanentSignal(true);

}

 

public override void OnDataUpdate(BarDataEventArgs barData)

{

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

{

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

//TrailingStopLoss(Symbol1, SyntheticOrderPriceType.Percent, StopLevel1, includeAfterSession:false);

}

if (mov.Value[0][mov.CurrentIndex] < mov2.Value[0][mov2.CurrentIndex] && ott.Value[1][ott.CurrentIndex] < ott.Value[0][ott.CurrentIndex])

{

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

TrailingStopLoss(Symbol1, SyntheticOrderPriceType.Percent, StopLevel1, includeAfterSession:false);

}

}

public override void OnOrderUpdate(IOrder order){}

public override void OnStopped(){}

public override void OnInitCompleted(){}

public override void OnTimer(){ }

public override void OnNewsReceived(int newsId, List<string> relatedSymbols){}

}

}
Paylaş

1 Cevap

0

Merhabalar,
Sentetik emirleri bir değişken / parametre olarak görmeyiniz. Gönderilen emir ile birlikte tetiklenen mekanizmalardır ve son fiyatın stop fiyatını görme koşulunu beklerler. İndikatör sat vermedende sentetik stop koşulunuz gerçekleşir. Aynı şekilde sentetik stop koşulu gerçekleşmeden indikatör sat sinyali oluşturabilir.

Bu arada sentetik emirlerin sürekli revize olmaması için, emir yönü kontrolü eklemenizde fayda vardır.

Alt taraftaki kod bloğunu kullanabilirsiniz.

İyi çalışmalar dileriz.
 

if (mov.Value[0][mov.CurrentIndex] > mov2.Value[0][mov2.CurrentIndex] &&
	ott.Value[1][ott.CurrentIndex] > ott.Value[0][ott.CurrentIndex] &&
	LastOrderSide.Obj != Side.Buy)
{
	SendMarketOrder(Symbol1, OrderQuantity1, OrderSide.Buy, includeAfterSession:false);
	TrailingStopLoss(Symbol1, SyntheticOrderPriceType.Percent, StopLevel1, includeAfterSession:false);

}

if (mov.Value[0][mov.CurrentIndex] < mov2.Value[0][mov2.CurrentIndex] &&
	ott.Value[1][ott.CurrentIndex] < ott.Value[0][ott.CurrentIndex])
{
	SendMarketOrder(Symbol1, OrderQuantity1, OrderSide.Sell, includeAfterSession:false);
}



 

BağlantıBayraklaemresMatriks Destek6.795

Cevabınız

Cevap yazmak için giriş yapın.Giriş yapKayıt ol