I try to use Performance.AllTrades in this way (some code from OnBarUpdate):
if(Time[0] >= FirstRealtimeDate && bProcessed == false)
{
bProcessed = true;
Print("all " + Performance.AllTrades.Count + "; real " + Performance.RealtimeTrades.Count + "; exec " + Performance.Executions.Count);
if (Performance.AllTrades.Count > 0)
{
foreach(Trade lastTrade in Performance.AllTrades)
{
// Calculate the PnL for the last completed real-time trade
double lastProfit = lastTrade.ProfitCurrency * lastTrade.Quantity;
// Pring the PnL to the Output window
Print("Pnl" + lastProfit);
}
}
Code works properly in time, but I always get this:
all 0; real 0; exec 0.
I have about 100 trades in history on my Sim101 account.......
I set in Initialize():
Enabled = true;
SyncAccountPosition = true;
TraceOrders = true;
What I should to do to fix?

Comment