i have build a strategy for ninja8 which is monitoring netpos, realized and unrealized profit for each traded instrument. Now iam trying to implement the functions in a ninja7 script.
OnStartUp() is called when the strategy is activated by the user, then the current account is selected: Account MonitorAccount = Account;
MonitorAccount.AccountUpdate += OnAccountUpdate;
MonitorAccount.PositionUpdate += OnPositionUpdate;
The events are not triggered when the price is changing for the instrument,
how to track the profit in realtime?
Iam using Sim101 Account with "Simulated datafeed" connection. Which event i should use in ninja7 to track the openPnL for the instrument in realtime?
Also all these values return 0:
double PnL = MonitorAccount.GetAccountValue(AccountItem.Realize dProfitLoss, xCurrency).Value;
double CumProfit = Performance.AllTrades.TradesPerformance.Currency.C umProfit;
double GrossProfit = Performance.AllTrades.TradesPerformance.GrossProfi t;
double GrossLoss = Performance.AllTrades.TradesPerformance.GrossLoss;
am i missing something?
i have attached the sample strategy, thx for help
Comment