Is there a way to convert limit orders to market orders after 0 seconds if price just touches the limit? The current options seem to convert unfilled limits to markets after time but not on an 'if touched' basis.
Can anyone please advise?
thanks
Market if touched - convert limit to market if price touches
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact:
I'm a little confused. Why not just place a market order when the code detects the price at which one wants to enter the market is touched?You should be able to do this fairly simply in EasyLanguage/PowerLanguage using an intrabar order generation strategy. Simply put the limit order in the market, and if the price is touched and you don't get a fill, convert it to a market order and keep restating it until you do get a fill.
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact:
You could, but because the limit order is in there first (before you detect it's hit) it might get you a fill faster and with a better price. By the time you detect the price being hit and can send the market order, because of internet transmission time, price could easily have moved on resulting in greater slippage and there's a chance your limit will be filled immediately, depending on the strength of the move and the depth of liquidity at that time and price level.
It all depends on how MC handles the preset limit order. If it handles it internally then I don't think the difference would be significant. If on the other hand it sends the limit order to the broker then it could make a huge difference, especially since it will be placed on the exchange queue so taking precedence over other subsequent orders.You could, but because the limit order is in there first (before you detect it's hit) it might get you a fill faster and with a better price.
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact:
Yes that is correct. My comments are based on past experience with EasyLanguage on TS and with other platforms - would have to take a look at how MultiCharts handles this specifically and a quick experiment will tell the needed facts here. You're right that if it's handled only locally in the platform it would not be the way to go but if you think about it, when you put a limit order out there, it has to send an actual limit order to the broker some time - it can't just convert it to market or you wouldn't have the limit guarantee (we know it does send a limit order). The only question is when does it send it e.g. at the outset when placed (thus risking a reversal if that and a stop are both hit), or when touched, or when price moves further towards it than the stop (how TS handles it), and a 5 minute experiment should be able to quickly establish that.
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact:
I'm tied up too, which is why I prompted the query as I expected someone would already know the answer. Someone might still respond but I will do the check later anyway to confirm one way or the other. I'll report back later.That is correct, and is exactly what I would do to check TWS for the limit order's arrival (I'm just tied up at the moment.)
As far as I can tell, the limit orders are passed to IB on the next bar (or update if IntrabarOrderGeneration is turned on) and remain there until it's hit or the bar closes, whichever occurs first, unless if the study issues a subsequent limit order from the next bar. In that case if the first one is not hit and the second one is at the same level, nothing changes at IB's end. However, if the second one has a different limit the first one at IB is canceled and a new one appears at IB. If the first one is hit then a new one still appears if the study continues to submit another order. So the study needs to check if it was filled to stop submitting extra ones. This is one reason I prefer to do it the other way and submit at market orders only when my level is hit. The results can be slightly different but it's simpler to code. I still may use limit orders where required to take advantage of having a better place in the queue, provided I know the level I want to trade in advance. Sometimes I don't - depends on the rules. Stops are more likely to be predetermined so I would use stop orders more often.
The only concern is a possible race condition when one is canceled and another is submitted due to having a different level as mentioned above. I presume MC is doing the right thing by canceling first then checking if the order was really canceled before submitting another one, but I like to test it out when I have time to make sure. But that may depend on what the user had intended. Again, that's why i prefer my approach.
The only concern is a possible race condition when one is canceled and another is submitted due to having a different level as mentioned above. I presume MC is doing the right thing by canceling first then checking if the order was really canceled before submitting another one, but I like to test it out when I have time to make sure. But that may depend on what the user had intended. Again, that's why i prefer my approach.
- Bruce DeVault
- Posts: 438
- Joined: 19 Jan 2010
- Location: Washington DC
- Been thanked: 2 times
- Contact:
This should come down to a difference between entries and exits. If you're scaling into a long (and pyramiding is enabled in the strategy properties) it should continue buying as long as you keep repeating the order* (whether it's a market or limit or stop to enter), even if it's the same order price, size, etc. every tick/calculation. If you don't want to keep buying, you check for fills (CurrentContracts) and stop repeating the order. However, on the exit side, it should not keep selling your long position beyond your holdings, even if you keep repeating the order to sell.If the first one is hit then a new one still appears if the study continues to submit another order. So the study needs to check if it was filled to stop submitting extra ones.
*Note: there are settings in EL in which you can specify that you only want one entry order to execute one time, if this is what you want, although this is often not used in scale-in strategies.
I understand what you are saying regarding the possible condition wherein there could be two orders in the market before a confirmed cancelation. This would need to be tested, and I'm not sure off the top of my head how MC handles this internally, but interested to determine this so I can better assess how to leverage what MC is doing to maximum benefit. I'm pretty confident how TS handles it, which is surprisingly thought out, but need to flesh out the details on the MC side to make sure it's all consistent and there are no surprises or unexpected "gotcha" conditions.
Hi all,
I would like to share my experience as I have been automated to trade an intraday strategy that comprises of stop and limit orders (5-min chart and non IOG code). Also, I use IB to trade. Limit orders are sent to IB as limit orders at TWS as Janus has mentioned.
One CRUCIAL scenario of sending a limit orders is risking some opportunities of high profitable trades as mentioned in scenario 3 in the following thread as I mentioned earlier.
http://forum.tssupport.com/viewtopic.ph ... =execution
Well, I have been looking for variable solutions to tackle it, but haven't located a solution. I now use market orders instead of limit order as I don't want to miss the opportunities of capturing fast moving market that might have been missed if limited orders are placed (I learnt it with real experience!).
Well, I am trying to code using GV DLL to feed the signal, in additional to limit order sent to IB, to another IOG strategy that does the following:
1) Issue a market order if certain time has passed;
2) Issue a market order if price hit a certain level off from the limit order.
What I experience is that it appears that it is not a 100% reliable solution.....
Sa
I would like to share my experience as I have been automated to trade an intraday strategy that comprises of stop and limit orders (5-min chart and non IOG code). Also, I use IB to trade. Limit orders are sent to IB as limit orders at TWS as Janus has mentioned.
I think MC can control it under Strategy Properties \ Properties \ Position Limits. However, I have no knowledge of how to send it right. Perhaps, someone can jump in to fill the gap.If the first one is hit then a new one still appears if the study continues to submit another order. So the study needs to check if it was filled to stop submitting extra ones.
One CRUCIAL scenario of sending a limit orders is risking some opportunities of high profitable trades as mentioned in scenario 3 in the following thread as I mentioned earlier.
http://forum.tssupport.com/viewtopic.ph ... =execution
Well, I have been looking for variable solutions to tackle it, but haven't located a solution. I now use market orders instead of limit order as I don't want to miss the opportunities of capturing fast moving market that might have been missed if limited orders are placed (I learnt it with real experience!).
I am not sure how this can be coded as in my 5min EOB strategy.You should be able to do this fairly simply in EasyLanguage/PowerLanguage using an intrabar order generation strategy.
Well, I am trying to code using GV DLL to feed the signal, in additional to limit order sent to IB, to another IOG strategy that does the following:
1) Issue a market order if certain time has passed;
2) Issue a market order if price hit a certain level off from the limit order.
What I experience is that it appears that it is not a 100% reliable solution.....
Sa