I like to know when my Algo has changed its position and how much profit has been done until that moment; in order to get this, I have this little code:
protected override void OnPositionUpdate(IPosition position) { if (position.MarketPosition != MarketPosition.Flat) { SendMail ("[email protected]", "[email protected]", "Algo Summary ", Position.MarketPosition.ToString() + ". P/L " + GetAccountValue(AccountItem.RealizedProfitLoss).ToString()); } }
1. I received 2 mails immediately, with a report of the old position/accumlated profit and the new position, and actually I need just one mail with the last and actual position only
2. The accumulated profit reported is not the actual amount, instead is the right early one, the immediate before to the actual or real one, how to address this?
Thanks
Comment