I am paper trading a strategy, and I need to understand how limit orders work. I issued a limit order, and it was not filled. Eventually, it was cancelled, but my strategy just stopped doing anything at that point. It left and open position that I had to close manually.
It looks like it closed the order the next bar, which I assumed was correct, and I am fine with. The problem is that the strategy did not take the next trade for whatever reason. The next strategy was about 20 minutes later, and it should not have been affected.
Limit Orders
-
- Posts: 51
- Joined: 24 Feb 2011
- Location: Atlanta, GA
- Has thanked: 5 times
- Been thanked: 8 times
- TJ
- Posts: 7740
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2221 times
Re: Limit Orders
Do you think this is a coding problem?
or procedural problem?
Have you checked out the posts in the FAQ?
viewtopic.php?t=10811
or procedural problem?
Have you checked out the posts in the FAQ?
viewtopic.php?t=10811
-
- Posts: 51
- Joined: 24 Feb 2011
- Location: Atlanta, GA
- Has thanked: 5 times
- Been thanked: 8 times
Re: Limit Orders
t is a mix of a coding problem and not completely understanding unfilled strategy order replacement and limit order cancellations. The problem occurs when I get the change in price exactly right.
When my price point is hit, I enter a limit order to enter the market at that price to avoid slippage from my strategic results. Most times, the price will go past the entry that I want and execute. When the market turns exactly where I want it, then the limit does not trigger. What I was hoping is that unfilled strategy order replacement will turn into a market order and send the trade, but I guess the ask or bid was not hit. I don't know how it could NOT be hit however, because the limit order was entered at the price that I wanted, so the bid or ask was definitely at the limit price.
That leaves me with 3 questions:
1. I am using 1 second as the time window, but I need to understand how 0 seconds really works. If I send the limit order, then immediately transfer it to a market order? That seems like I will not get the limit fill the vast majority of the time, but it will likely work.
2. I saw some old posts about a feature being added that can cancel a limit order, but I don't see it in the documentation. I could use the code to detect the open order then cancel it and replace it myself.
3. Is there some way to detect that an order was cancelled? It appears that the strategy automatically cancels the limit order when the condition is no longer met. If this is the case, can I detect that an order was cancelled and just send a market order? If so, how do I detect it.
I have checked a lot of the documentation, but I cannot seem to find answers to 2 and 3.
When my price point is hit, I enter a limit order to enter the market at that price to avoid slippage from my strategic results. Most times, the price will go past the entry that I want and execute. When the market turns exactly where I want it, then the limit does not trigger. What I was hoping is that unfilled strategy order replacement will turn into a market order and send the trade, but I guess the ask or bid was not hit. I don't know how it could NOT be hit however, because the limit order was entered at the price that I wanted, so the bid or ask was definitely at the limit price.
That leaves me with 3 questions:
1. I am using 1 second as the time window, but I need to understand how 0 seconds really works. If I send the limit order, then immediately transfer it to a market order? That seems like I will not get the limit fill the vast majority of the time, but it will likely work.
2. I saw some old posts about a feature being added that can cancel a limit order, but I don't see it in the documentation. I could use the code to detect the open order then cancel it and replace it myself.
3. Is there some way to detect that an order was cancelled? It appears that the strategy automatically cancels the limit order when the condition is no longer met. If this is the case, can I detect that an order was cancelled and just send a market order? If so, how do I detect it.
I have checked a lot of the documentation, but I cannot seem to find answers to 2 and 3.