Error for stop order

John A

Active member
Joined
Dec 16, 2024
Posts
25
Likes
2
I have been developing custom strategy using sdk. Major part of the strategy is working fine. But few times in replay, I am getting an error while submitting the order.
'Invalid order price: Buy stop order must be aboce current price'. Once this error occurs subsequent orders are not executed till this error dialog box is not removed.
Please see attached image for the error.

My query is:
1)Is this error similar to error in limit orders mentioned in below threads:
https://support.motivewave.com/forum/index.php?threads/error-submitting-order-message.1429/
https://support.motivewave.com/forum/index.php?threads/limit-order-problems.712/
or this can be fixed?

2) How to handle Error in submitting the order? does onOrderRejected method catches this error or is thera any alternative way to catch the error?
 

Attachments

  • Error_1.jpg
    Error_1.jpg
    30.4 KB · Views: 23
@pandalover do you have any idea how to fix/handle the above error one in Strategy? I tried handling order rejection in onOrderRejected method but it doesnt work.
any ideas?
 
The message is very clear- it is invalid to place a buy above the current price. You need to execute a market order, or set the buy <= the current price.
 
I'll expand on this to be more helpful. Sometimes when submitting an order the market could move out from under you before the order reaches the exchange. This is likely why this error is happening. The correct way to handle this (I assume) would be to handle the onOrderRejected? callback.
 
@thestephenromano Thank you for the reply. I understand what you are saying.

I had tried handling it with onOrderRejected but it is not being executed on on order rejection.

I can see cqg api rejection message in the logs, but after that onOrderRejected is not executed. Hence the question that is there any other way around to handle the order rejection.
 
@John A Understood, thats interesting... Is this on MW 7? Wondering if there is a platform bug where broker API errors are not correctly mapped to the appropriate SDK handler? Did you try catching onOrderCanelled by any chance?
 
Top