Here is code example and screenshot attached:
protected override void OnBarUpdate()
{
if(CurrentBar < 10)
return;
var entryExecution = new Execution()
{
Instrument = Instrument,
Price = Close[9],
Time = Time[9],
Quantity = 1,
MarketPosition = MarketPosition.Long
};
var exitExecution = new Execution()
{
Instrument = Instrument,
Price = Close[0],
Time = Time[0],
Quantity = 1,
MarketPosition = MarketPosition.Short
};
Trade trade = new Trade(entryExecution, exitExecution, 1);
Print("-------");
Print("Entry.Price:" + trade.Entry.Price);
Print("Exit.Price:" + trade.Exit.Price);
Print("ProfitCurrency:" + trade.ProfitCurrency.ToString("C"));
Print("MfeCurrency:" + trade.MfeCurrency.ToString("C")); // THIS VALUE IS WRONG!
}
And additionally I want to ask if my manual calculation of MFE for LONG is correct (same is NT uses):
var pointValue = Instrument.MasterInstrument.PointValue;
var mfeCurrency = Math.Abs(trade.Entry.Price - MAX(High,10)[0]) * trade.Quantity * pointValue;
Comment