Need Reason, StopLoss, TakeProfit in HistoricalTrade class
Need Reason, StopLoss, TakeProfit in HistoricalTrade class
09 Jan 2021, 06:07
protected override void OnTick()
{
var posList = Positions.Where(p => p.SymbolName == Symbol.Name && p.Label == myLabel)
var penList = PendingOrders.Where(p.SymbolName == Symbol.Name && p.Label == myLabel);
var cntPosition = posList.Count();
var cntPending = penList.Count();
if (cntPosition == 0 && cntPending == 0)
{
if(!IsTradeNow() ) return; // IsTradeNow is method that return boolean regarding to Server.Time between my time setting and Meet my some indicator value satisfied
HistoricalTrade hist = History.FindLast(myLabel,Symbol.Name);
if (hist != null)
{
//need closing Reason,SL,TP here
}
}
.........................
}
Unfortunately this information is not available in the HistoricalTrade class.
Now these are found in only PositionClosedEvent, but it's not satisfied my strategy if position closed at tp or sl during TradeNow false or terminal closed;
In mql4 and mql5 it's very easy.
As ClosingPrice, Pips, etc are found, Hopefully Spotware Systems will add these properties Reason, StopLoss, TakeProfit in HistoricalTrade class as early as possible.
Also please check link
Thanks