I am trying to get the entry price of my positions to store as a double to use elsewhere in my code. This is what I have right now:
protected override void OnExecutionUpdate(Execution execution, string executionId, double price, int quantity, MarketPosition marketPosition, string orderId, DateTime time)
{
breakevenprice = execution.Order.AverageFillPrice;
}
This code is doing as intended and giving me the average fill price. The issue is on candles where the execution is a profit target or a stop loss, or a profit target and an entry. See image:
With the code I am currently using, the double breakeven price will calculate as the profit target or stop loss when that is the execution type, and on candles with both entries and stop losses will trigger as either. How can I tell OnExecutionUpdate to change breakevenprice only when the execution type is long or short? And not profit targets, stop losses, or exits on session closes?
Thanks

Comment