Page 1 of 1

Negative UID but successful action when sending order

Posted: Tue Jan 19, 2021 3:39 pm
by hkenrique
Hi,

It appears that the return value of order send function sometimes can be negative but successful.

Code: Select all

	long uid= __ib.order_send(__conid_EURUSD
            ,orderType // defined in file include/trade-commander.com/ibplugin_types.mqh                    
             ,size
             ,0
             ,targetPrice
             ,0
             ,0
             ,IntegerToString(magicNumber)+","+IntegerToString(posOpen)+"C"
             ,0
             ,0);
       PrintFormat("Position close signal sent, uid:%d, checking if position is closed already",uid);
       
Log reads:
Position close signal sent, uid:-721204922, checking if position is closed already
You can see the return value is not in the error code list.
Can this be another defect of the ibgORDER_SEND function?
I found this issue during my test, where I close my position twice and result in duplicate positions.
Debugging shows the code thinks the position close action failed and closed again where it actually succeeded and I can see two identical trades in IB.

Re: Negative UID but successful action when sending order

Posted: Tue Jan 19, 2021 4:31 pm
by board_admin
In a prior version negative uids where possible to use full range of integer 64 bit.
In latest version 1503 (and i believe version before 1502) uid should always be positive. Microseconds since 2010.

Re: Negative UID but successful action when sending order

Posted: Fri Feb 05, 2021 12:53 pm
by hkenrique
I am not sure how to check the version number of the plugin?