Hi Stefano,
I cleaned a little bit the test and ran it again. This time I used TYD and DRN - both trade very few shares. Basically I buy every 15th minune and sell every 33rd minute (sending limit orders). If after 1 minute the orders are not filled, they are canceled and all is liquidated.
I put limit order to enter few cents above the current price and to exit few cents above the current price.
As I see it, it alwas enters and almost never exits - check TYD. So it seems that it uses next bar to enter, even if there is no trade.
Unless I have a mistake in the code which I cant see, since it is hard to debug, it seems to me that e.g. the algo uses next bar of TYD to enter and caries over TYD bar to next second - prices and volume seem suspiciously the same from 10:15 till 11:30 and etc.
Your opinion is greately appreciated.
Thanks
Nik
9/17/2018 10:15:00 AM BUY order1 sent, .status=New, limit= 40.090, curPrice=40.070, high=40.070,low=40.070, vol=200.000
9/17/2018 10:15:00 AM BUY order2 sent, .status=New, limit= 23.430, curPrice=23.410, high=23.410,low=23.410, vol=300.000
9/17/2018 10:15:00 AM, Will print next bar
9/17/2018 10:15:01 AM, barPairNow[0]=40.070, high=40.070, low=40.070, vol=200.000
9/17/2018 10:15:01 AM, barPairNow[1]=23.410, high=23.410, low=23.410, vol=300.000
9/17/2018 10:15:01 AM Entry Orders Executed , order1.FilledPrice=40.07, order2.FilledProce=23.41
9/17/2018 10:33:00 AM EXIT order1 sent, .status=New, limit= 40.080, curPrice=40.070, high=40.070,low=40.070, vol=200.000
9/17/2018 10:33:00 AM EXIT order2 sent, .status=New, limit= 23.350, curPrice=23.360, high=23.360,low=23.360, vol=500.000
9/17/2018 10:33:00 AM Exit orders sent
9/17/2018 10:33:00 AM, Will print next bar
9/17/2018 10:33:01 AM, barPairNow[0]=40.070, high=40.070, low=40.070, vol=200.000
9/17/2018 10:33:01 AM, barPairNow[1]=23.360, high=23.360, low=23.360, vol=500.000
9/17/2018 10:33:01 AM exit order1 canceled
9/17/2018 10:33:02 AM HandleState_PendingOrderExitCancelationSent - Liquidated ALL exit orders if any
9/17/2018 11:15:00 AM BUY order1 sent, .status=New, limit= 40.090, curPrice=40.070, high=40.070,low=40.070, vol=200.000
9/17/2018 11:15:00 AM BUY order2 sent, .status=New, limit= 23.170, curPrice=23.150, high=23.150,low=23.150, vol=5.000
9/17/2018 11:15:00 AM, Will print next bar
9/17/2018 11:15:01 AM, barPairNow[0]=40.070, high=40.070, low=40.070, vol=200.000
9/17/2018 11:15:01 AM, barPairNow[1]=23.150, high=23.150, low=23.150, vol=5.000
9/17/2018 11:15:01 AM Entry Orders Executed , order1.FilledPrice=40.07, order2.FilledProce=23.15
9/17/2018 11:33:00 AM EXIT order1 sent, .status=New, limit= 40.080, curPrice=40.070, high=40.070,low=40.070, vol=200.000
9/17/2018 11:33:00 AM EXIT order2 sent, .status=New, limit= 23.180, curPrice=23.190, high=23.190,low=23.190, vol=406.000
9/17/2018 11:33:00 AM Exit orders sent
9/17/2018 11:33:00 AM, Will print next bar
9/17/2018 11:33:01 AM, barPairNow[0]=40.070, high=40.070, low=40.070, vol=200.000
9/17/2018 11:33:01 AM, barPairNow[1]=23.190, high=23.190, low=23.190, vol=406.000
9/17/2018 11:33:01 AM exit order1 canceled
9/17/2018 11:33:02 AM HandleState_PendingOrderExitCancelationSent - Liquidated ALL exit orders if any