[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] GetStatus error, is it code or a timing error?



PureBytes Links

Trading Reference Links

I am submitting an OCA group of three orders, a MKT order with a GAT set to
three bars in the future. The second order is a MIT set to the profit target and
the third is a STP set to the loss target.
When I send a order I turn a GetStatus flag on and every scan through the
program it gets the status of the orders. Once in a while GetStatus reports the
status of the order incorrectly. In the last case the MIT was filled but the
status was reported as pre-submitted and the MKT and STP were reported as
pre-Submitted. The IBC message log shows the first and third order canceled and
the MIT filled. Get status does not report a filled status.

In the trace, before the order was canceled due to the MIT, the GetStatus
returned the following:
[580] #, StatusInc, OrdState 1a1, Status A, B and C=PreSubmitted, PreSubmitted,
PreSubmitted

The program captures the error codes that come back and that shows the order was
canceled and the reason was blank meaning the cancel was due to the unused OCA
members being canceled.
Right after that I ask for status of the three orders and this is what I get:
[580] #, StatusInc, OrdState 1a1, Status1, A, B and C=Canceled, PreSubmitted,
PreSubmitted According to this the order was not filled.

The above does not agree with the IBC trade log. Is there a timing problem here?

This is the part of the status processing code:
LastError = "";
{
LastError = ibc.GetLastError(0);
if(LastError != "")
{
LastErrorID = fProcessError(LastError);
if(DebugOn) _TRACE("#, Status processing @@@#@@@ LastError=" +
LastError);
}
}
if(DebugOn) _TRACE("#, Status processing @#$$$#@ LastError=" + LastError);

tempStatus = "None";
if(GetStatus)
{
tempStatus = tempStatusA = tempStatusB = "";
tempStatus = ibc.GetStatus( ordID, True ); // get order status
tempStatusA = ibc.GetStatus( ordIDa, True ); // get order status of OCA group
member
tempStatusB = ibc.GetStatus( ordIDb, True ); // get order status of OCA group
member

if(DebugOn) _TRACE("#, StatusInc, OrdState 1a1, Status A, B and C=" +
tempStatus + ", " + tempStatusA + ", " + tempStatusB);

if(tempStatus == "Filled" OR tempStatusA == "Filled" OR tempStatusB == "Filled"
) // check for a filled on each order
...

Since InclFilled is set to True statuses of orders listed on "Executions" list
are reported and this means that you can get "Canceled", "Filled", "Error",
"Inactive" consistently.

It seems they are not reported consistently and I don't know why. 95% of the
time this works flawlessly. But the other 5% are screwing my system up. Any idea
why GetStatus is not processing the order status correctly???

Will getting LastError change the results of the GetStatus? Most of the time it
does not. It seems status and error reporting are separately or independently.

Thanks in advance,
Barry




------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/