As long as I exit (ExitLong or ExitShort) with the same number of contracts that I entered with all is well. However, when I exit with different number of contracts than I enter with things get a bit strange. For example, if I EnterShort( 2 ) then a few bars later I ExitShort( 1 ) and then a few bars later I ExitShort( 1 ) the second exit is often ignored. Every time my strategy enters or exits it Print()s.
I also do this:
protected override void OnExecution( IExecution execution ) { // Remember to check the underlying IOrder object for null before trying to access its properties if( execution.Order != null && execution.Order.OrderState == OrderState.Filled ) Print( execution.ToString() ); }
Execution='NT-00144' Instrument='NQ 03-15' Account='Replay101' Name='Sell short' Exchange=Default Price=4292.75 Quantity=2 Market position=Short Commission=0 Order='NT-00144' Time='3/13/2015 1:10:09 PM'
Short exit 1 3/13/2015 1:12:33 PM
Execution='NT-00145' Instrument='NQ 03-15' Account='Replay101' Name='Buy to cover' Exchange=Default Price=4290.25 Quantity=1 Market position=Long Commission=0 Order='NT-00145' Time='3/13/2015 1:12:38 PM'
Short exit 1 3/13/2015 1:15:38 PM
What m I missing?
Comment