LastTrade = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1]; Commission = LastTrade.Commission;
What I would like to get instead is the comission of the entire order of 20 contracts.
Currently I'm using this code:
protected override void OnPositionUpdate(Position position, double averagePrice, int quantity, MarketPosition marketPosition)
{
if (Position.MarketPosition == MarketPosition.Flat && SystemPerformance.AllTrades.Count > 0)
{
if (Position.MarketPosition == MarketPosition.Flat && SystemPerformance.AllTrades.Count > 0)
{
if (Position.Instrument.FullName == Instrument.FullName)
{
string OrderAction = "";
string OrderType = "";
double EntryPrice = 0;
double ExitPrice = 0;
double GrossProfit = 0;
double NetProfit = 0;
double Commission = 0;
double Fees = 0;
Trade LastTrade;
// Get commission for the order/position
LastTrade = SystemPerformance.AllTrades[SystemPerformance.AllTrades.Count - 1];
Commission = LastTrade.Commission;

Comment