Yes you can use the code. However I will not put the code
Buy_1MarketPosition = MarketPosition.Long; // Unique entry is long
Also, OrderState.Cancelled or OrderState.Rejected is not updated in OnExection event. They are triggered in OnOrderUpdate event.
Please let me know if I can assist you any further.
Comment