Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ExitLongStopLimit in real-time trading?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    ExitLongStopLimit in real-time trading?

    The ExitLongStopLimit() method isn't acting like I believe it should. I'm looking for some more detail on how it works in NinjaScript and possible solutions.


    Given
    1) I'm exiting a long position with an ExitLongStopLimit() in real-time trading
    2) I am always willing to cross the spread so that my limit order is marketable. In other words I submit my sell order on the bid data series.
    3) limitPrice = stopPrice

    Problem:
    The marketable ExitLongStopLimit() order is not always filled even though the market has traded through my limit and I can't tell why for certain. The missed fills are occurring even when the bid has been resting at my marketable limit for several seconds.

    Possible issues:
    1) Is NT requiring that one or both of the stop and/or limit trade through my marketable limt, rather than 'if touched'?
    2) In cases where the market has traded through my marketable limit and still not filled it is it because NT will only consider the bid data series and not the ask?

    --In other words, let's assume there's some latency, and the bid has moved 1 tick lower in the milliseconds that have passed since I placed my order. I'd think that my limit order would then get filled at the ask. But, even that is being missed. If I used a bid data series when I place my limit does NT not know to fill it at the ask?









    .

    #2
    Hello bluelou,

    Thank you for your post.

    The Stop price needs to be reached, then the Limit order will need to fill at the Limit price or better. Just because we submit to the Bid price does not mean it has to fill based on the Bid Data Series, but of course a sell is to the bid and not the ask.

    Please let me know if I may be of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello bluelou,

      Thank you for your post.

      The Stop price needs to be reached, then the Limit order will need to fill at the Limit price or better. Just because we submit to the Bid price does not mean it has to fill based on the Bid Data Series, but of course a sell is to the bid and not the ask.

      Please let me know if I may be of further assistance.
      Patrick,
      What you've said isn't 100% clear to me. Let's go through an example.

      Example 1) As before my stop = limit = 100.01. Given the market is 100.01 bid x 100.02 ask and I place my ExitLongStopLimit at the bid (using the bid data series), i.e., at 100.01 - then, this is a marketable order and should be filled if 100.01 is touched, correct?

      Example 2) As before my stop = limit = 100.01. Given the market is 100.01 bid x 100.02 ask and I place my ExitLongStopLimit at 100.01 and the market has moved lower by 1 tick to 100.00 x 100.01. In effect, my order lands at the ask. Then, let's assume that the market moved another tick lower to 99.99 x 100.00. So, the market traded through my limit. My order should be filled regardless of what data series was used when the order was placed, correct?

      Comment


        #4
        Originally posted by bluelou View Post
        Patrick,
        What you've said isn't 100% clear to me. Let's go through an example.

        Example 1) As before my stop = limit = 100.01. Given the market is 100.01 bid x 100.02 ask and I place my ExitLongStopLimit at the bid (using the bid data series), i.e., at 100.01 - then, this is a marketable order and should be filled if 100.01 is touched, correct?
        No. Your order becomes a Limit order when the Stop is touched. After that, it is a Limit Order at a specific price. The market has to come back and trade through that price for it to be filled. That is one of the issues when using StopLimit orders: in a fast market, they may be left unfilled because the market goes through them fast and never comes back.

        Example 2) As before my stop = limit = 100.01. Given the market is 100.01 bid x 100.02 ask and I place my ExitLongStopLimit at 100.01 and the market has moved lower by 1 tick to 100.00 x 100.01. In effect, my order lands at the ask. Then, let's assume that the market moved another tick lower to 99.99 x 100.00. So, the market traded through my limit. My order should be filled regardless of what data series was used when the order was placed, correct?
        Same answer. Regardless of anything else, you now have a Limit order, to be filled at 100.01 or better. It is a sell order, so until and unless the market comes back to it (if first in queue, maybe), or trades through it, it will not fill: you are asking to sell at 100.01, when the market is at 100.00.

        IOW, a StopLimit order NEVER becomes a market order: it becomes a Limit order, and is treated as such.

        Comment


          #5
          Originally posted by koganam View Post
          No. Your order becomes a Limit order when the Stop is touched. After that, it is a Limit Order at a specific price. The market has to come back and trade through that price for it to be filled. That is one of the issues when using StopLimit orders: in a fast market, they may be left unfilled because the market goes through them fast and never comes back.


          Same answer. Regardless of anything else, you now have a Limit order, to be filled at 100.01 or better. It is a sell order, so until and unless the market comes back to it (if first in queue, maybe), or trades through it, it will not fill: you are asking to sell at 100.01, when the market is at 100.00.

          IOW, a StopLimit order NEVER becomes a market order: it becomes a Limit order, and is treated as such.

          Okay, let's focus on the 1st example. Given the stop price = limit price = ask = 100.01 are you saying that the limit is not instantly marketable at 100.01. Instead, the market must trade through 100.01 and then come back to 100.01?

          Sry, not trying to be a pain. I just want to be totally certain. Thx.

          Comment


            #6
            The mental block I'm running into here is what is it that makes the limit order non-marketable in this case?

            Comment


              #7
              Nevermind, I thought this was an NTSupport person. I'll wait to hear from Patrick tomorrow. thx

              Comment


                #8
                Hello bluelou,

                Thank you for your response.

                The Limit order when placed after the Stop Price is reached is market-able, but that does not mean the order will be filled.

                Comment


                  #9
                  Originally posted by bluelou View Post
                  The mental block I'm running into here is what is it that makes the limit order non-marketable in this case?
                  It is not a NT issue. It is purely a matter of market dynamics.

                  Yes, if you happen to be first in queue you might get filled immediately. The aegis is that the order must be filled at the Limit price or better. Generally speaking, if the market trades through the price, you are almost guaranteed a fill. The market can touch the Limit price multiple times without filling.

                  That is why market orders exist. To guarantee a fill, albeit often with slippage.

                  Marketable just means capable of being executed. The Limit order is certainly capable of being executed: it does not mean that it will necessarily be executed immediately it is touched.

                  Comment


                    #10
                    koganam and Patrick,
                    I'm not questioning the issue of what marketable means but I don't think this is an issue of market dynamics either. If I had to guess I'd say the problem I'm running into is a latency issue and this issue may be worse with an NT stop limit vs an NT limit order.

                    I say this because I'm getting filled on all of my marketable limit orders but I'm getting 1 tick slippage on about 1/3 of my marketable stop limit orders. (The slippage comes when the first limit is missed and I chase with a new limit 1 tick worse).

                    My next move is to get rid of the stop limit order type altogether and use only limit orders for entries and exits (chasing when appropriate).
                    Last edited by bluelou; 07-28-2014, 07:52 PM.

                    Comment


                      #11
                      Patrick,
                      I resolved the 'slippage' issue. It wasn't a slippage issue after all. It was a conditional off-by-one error with a bar object. Thx for your help.

                      ~Lou

                      P.S. I have a related question about the sim acct matching engine but will ask in a separate post.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by AH369, 07-03-2024, 10:17 AM
                      8 responses
                      825 views
                      1 like
                      Last Post Karado58  
                      Started by FAQtrader, 04-25-2024, 12:00 PM
                      58 responses
                      1,283 views
                      0 likes
                      Last Post rene69851  
                      Started by kevtancw, Today, 07:09 PM
                      0 responses
                      4 views
                      0 likes
                      Last Post kevtancw  
                      Started by LanceFulk, Today, 06:28 PM
                      0 responses
                      6 views
                      0 likes
                      Last Post LanceFulk  
                      Started by utilizator, Today, 04:53 PM
                      0 responses
                      8 views
                      0 likes
                      Last Post utilizator  
                      Working...
                      X