Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hi. I am a beginner programmist. I've got the following question: I make a limited order to enter short. After that it comes to a "Working" state. I want to cancel it so that I could enter long having canceled my short order. The commands follow each other one after another but the second order is ignored by my broker. What could you suggest me to do?
Can you help answer these questions from other members on NexusFi?
Looks like you added the code fragment above. Just an FYI, subscribers (or previous posters) don't know you have updated your posting, somethings it is better to add another post so the notification goes out.
I suspect your broker is getting orders out of sequency from NT and/or screening your "Long" order out before successfully pulling your open order off the market. That means you might need a delay. Have you tried to simply reverse the order? If you are Long 2, send a Short 2 to see if it takes that order. This might leave you net 0 contracts, so you might need to go short 4. This might be a good question for your broker. Also, enabling Order Trace will help you determine what is happening: TraceOrders
Okay, you are venturing into a very complex system as best I can tell. If you need this feature you can get it to work, but I would review the IORDER status in your OnOrderUpdate(): IOrder
If it is flagged as FILLED then it is true, otherwise, it isn't filled. There is a Partial Fill, so be careful...
Also, since this is an OrderUpdate, you should probably put that logic in the OnExecution() function: OnExecution()
Could you please post a starategy or a piece of code that could show us the turnover of a starategy that uses limited orders and at the same time could guarantee their execution at a broker side.
There are many out there posted, you are going to need to do a little digging. The Battle of the Bots thread in the elite section has Many posted. You may want to start with Myst as that is probably close to the structure you need: