Merhaba,
Elinizdeki pozisyon yönüne göre stop seviyesinden anlık fiyatı yada anlık fiyattan stop seviyesini çıkartıp puan cinsinden kar al tanımlayabilirsiniz. Aşağıdaki yapıyı inceleyebilirisiniz.
bool negatifKontrol = true;
public override void OnDataUpdate(BarDataEventArgs barData)
{
if (barData.BarData.DiffPercent<0 && negatifKontrol)
{
var anlikFiyat = GetSelectedValueFromBarData(GetBarData(), OHLCType.Close);
var poz = GetPortfolio();
var adet = poz.ContainsKey(order.Symbol) ? poz[order.Symbol] :0;
if (adet>0)
{
TakeProfit(order.Symbol, SyntheticOrderPriceType.PricePoint, KarAlSeviyesi_pozitif - anlikFiyat);
}else if (adet<0)
{
TakeProfit(order.Symbol, SyntheticOrderPriceType.PricePoint, anlikFiyat-KarAlSeviyesi_negatif);
}
negatifKontrol = false;
}
}
decimal KarAlSeviyesi_pozitif = 70, KarAlSeviyesi_negatif = 60;
public override void OnOrderUpdate(IOrder order)
{
if (order.OrdStatus.Obj == OrdStatus.Filled)
{
var anlikFiyat = GetSelectedValueFromBarData(GetBarData(), OHLCType.Close);
var poz = GetPortfolio();
var adet = poz.ContainsKey(order.Symbol) ? poz[order.Symbol] :0;
if (adet>0)
{
TakeProfit(order.Symbol, SyntheticOrderPriceType.PricePoint, KarAlSeviyesi_pozitif - anlikFiyat);
}else if (adet<0)
{
TakeProfit(order.Symbol, SyntheticOrderPriceType.PricePoint, anlikFiyat-KarAlSeviyesi_negatif);
}
negatifKontrol = true;
}
}
Unblocked Games offering a wide range of experiences: action, puzzle, platform, racing, clicker mechanics, strategy, sports, even horror.
https://unblocked1games.github.io