Niko Posted June 21, 2023 Report Share Posted June 21, 2023 Hello, With the below saved order, I'm trying to buy x% of my portfolio, then set 2 bracket orders, everything in one key. It seems that I have a qty issue in leg 2 and 3. Any idea why ? Thank you ! Nicolas Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted June 22, 2023 Report Share Posted June 22, 2023 You cannot do that for several reasons. 1. Limit order is definitely not guaranteed to fill in 5 seconds (which is the delay you set)... and 2. Even if it did, the variables that are used in the hotkey are set at the beginning of the whole hotkey, and are not recalculated at the beginning of each section. So if you have no position at the start of the hotkey, the PosAbs will be 0 even if the first section executes an order and a position appears. What you would have to do is calculate the quantity and make it a variable in the variable section at the very start of the hotkey. Then use that variable in the subsequent sections. Same for the Paid price. And still have to take the (1) fact above into account. Quote Link to comment Share on other sites More sharing options...
Niko Posted June 22, 2023 Author Report Share Posted June 22, 2023 Thank you Mike. I'm trading multiple instruments so I won't be able to know and set in advance quantities. Just to make sure, there's no way at all to set 1 hotkey who will do the following : - Buy limit x% of account - Set 1SL and 1TP(half of position) at x% of entry - Set 1SL and 1TP(the other half) at y% of entry ? Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted June 22, 2023 Report Share Posted June 22, 2023 If instead of "Buy limit x% of account" you'd accept "Buy market x% of account" and then assume that it was bought at current Ask (for the "entry" part of the subsequent orders) - yes you can. Or - if you split it in two. One hotkey would do the "Buy limit x% of account". And the other (that you would execute once you see the buy go through) would set up the other two OCO orders. Quote Link to comment Share on other sites More sharing options...
Niko Posted June 22, 2023 Author Report Share Posted June 22, 2023 Ok, i already do option 2 but it's not ideal since i trade fast moving stocks. Option 1 is fine but not possible PM or AH. Thank you for your answer ! Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted June 23, 2023 Report Share Posted June 23, 2023 The limiting thing here is, the hotkey just executes, section by section. It cannot wait for one order to complete before continuing. There is no mechanism to do that. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted June 23, 2023 Report Share Posted June 23, 2023 Actually, Niko, I should amend my previous answer. This waiting for an order to execute cannot be done on MT side. But it can be done on the broker side, if your broker supports it. So if your broker supports OTOCA orders, here is a hotkey Quote Link to comment Share on other sites More sharing options...
Hans Posted June 23, 2023 Report Share Posted June 23, 2023 (edited) Mike - in your last example, is it not necessary to specify Quantity in each of the Sell bracket legs? Nico - which broker are you using? The benefit of Mike's proposed OTOCA solution is that the broker will be able to associate buy and sell orders as belonging to the same order. Your broker can then make placement of OTOCA Sell orders conditional on a complete fill of your OTOCA Buy order. I don't think MT Saved Orders can do that - they will send separate Buy and Sell orders -from the POV of the broker, these are not linked so theoretically they can fill separately. Btw - I am using the same approach as Mike described and it works well for me.. Edited June 23, 2023 by Hans Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted June 24, 2023 Report Share Posted June 24, 2023 3 hours ago, Hans said: Mike - in your last example, is it not necessary to specify Quantity in each of the Sell bracket legs? No - it would be copied from the main leg of the order. In fact, most brokers I think don't allow quantities in sub-legs that are different from main. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.