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)
My strategy should enter with a limit order and exit with a bracket.
Below is a simplified version of my code:
That works well at the backtesting stage, but when I moved to automating it I am not happy with the way the orders are transmitted.
At the first stage the limit order is transmitted to IB, without any attached stop. The stop will be there only when the position was initiated (if it is initiated), at the next bar. This means that if I lose connection after sending the limit order, and then it is executed, I have no stop.
Is it possible to transmit a limit order with an attached stop (or even better, with an attached bracket)?
Can you help answer these questions from other members on NexusFi?
unfortunately this is expected behavior when working without intrabar order generation (IOG). You would have to switch to IOG (which might bring other modifications to your code) when you want the stop in place during the entry bar already.
Since I enter with limit orders at certain levels that may or may not be reached, if I switch to IOG this means my orders will be repeatedly transmitted and cancelled at every tick rather than at every bar, correct?
you are welcome. By the way you can show your appreciation using the "Thanks" button under a post.
The order stays active as long as the conditions that generated it stay true. If you don't change these, your order wouldn't get cancelled and resend.
Actually, I don't want the stop to be placed during the entry bar. I want to be there already when the limit order is transmitted, since it may happen that my limit order is there for a while before it's executed - whether the script is evaluated every bar or every tick.
If I cannot have a "real" attached stop to my limit order then I think I need to rewrite the whole thing to use market orders that are executed when the price hits my intended entry rather then limit orders that are transmitted beforehand. Makes sense?
I don't think you can have actual OSO orders in Multicharts, it would only work to send the stops and targets after the fill and MC will include them into one OCO bracket.
Therefore you might have to use the market order approach you described.