I have a strategy that when meeting a specific condition it will call ExitLong()/ExitShort() to close the current position, and then open a new reverse position by calling EnterShort()/EnterLong().
but it seems that the ExitLong() or ExitShort() tries to fire 2 orders to close the current position. Adding to the new position which I intend to open, it results in more quantity traded than I want.
For example, currently I have a long position called "Long0", after meeting the required condition, ExitLong("ExitLong0","Long0") is called in my script to close the current position, and I intentionally want to take a reverse position "Short0". However, NT fires 2 orders to close the position. Adding to my EnterShort("Short0") call, it fired 3 orders in total.
In Log, total 3 orders were fired (lower the newer in timeline) :-
11/1/2019 0:05:00,Order,Order='632966e1a4544ec9b05e854aff7fd 7a0/Sim101' Name='ExitLong0' New state=PendingSubmit Instrument='BABA' Action=Sell Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error='',
11/1/2019 0:05:00,Order,Order='a960840f15cd4c39992d648f41631 608/Sim101' Name='Close position' New state=PendingSubmit Instrument='BABA' Action=Sell Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error='',
11/1/2019 0:05:00,Order,Order='781de5123a054e319f4cd4abe17ef 790/Sim101' Name='Short0' New state=PendingSubmit Instrument='BABA' Action=SellShort Limit price=0 Stop price=0 Quantity=1 Type=Market Filled=0 Fill price=0 Error=NoError Native error='',
I also added TraceOrders = true to my script, and the output shows that only 2 PlaceOrder() is called.
11/1/2019 0:05:00 Entered internal PlaceOrder() method at 11/1/2019 0:05:00: BarsInProgress=0 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='ExitLong0' FromEntrySignal='Long0'
11/1/2019 0:05:00 Entered internal PlaceOrder() method at 11/1/2019 0:05:00: BarsInProgress=0 Action=SellShort OrderType=Market Quantity=1 LimitPrice=0 StopPrice=0 SignalName='Short0' FromEntrySignal=''
So my conclusion is that ExitLong() fired two sell orders, namely 'ExitLong0' and 'Close position' to close my current 'Long0' position.
I have no idea why it happens. I will be very grateful if anyone can shed some light on the problem!
Thank you very much!
Cheers,
Hiromichi
Comment