I am trying to use GetTrades() to get a TradeCollection of trades from a given IOrder (o) Name using the code below in OnPositionUpdate once the trade is flat.
TradeCollection currentTrades = Performance.AllTrades.GetTrades("6E 12-10", o.Name, 1);
I have also tried this using Instrument.FullName instead of the literal. I get 0 entries in my TradeCollection. However, if I use
currentTrades = Performance.AllTrades
foreach(Trade t in currentTrades)
{
if (t.Entry.Name == o.Name)
{
lastProfit = t.ProfitCurrency * t.Quantity;
totalProfit += lastProfit;
Print("ShortTrade P&L " + lastProfit.ToString("##,###.00"));
}
}
I get exactly what I expect. I prefer the GetTrades() approach as this trade list can get quite large by the end of the day.
Can anyone point out what is wrong with my GetTrades() statement?
Thanks in advance.
Scott
Comment