Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Interactive Brokers: GTC and Time to Enforce

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

    #16
    Hi Jesse,

    as I posted I aleady have this option enabled but it does not work.

    I noticed that the problem appears only with Stop Loss. If I place a Stop Limit I see in TWS that the option "Fill/trigger outside RTH" is selected.

    Any idea? Should I re-install NT?

    Thanks.

    Comment


      #17
      Hello Peppo,

      Are you using the correct TWS version, the same version listed in the connection guide? https://ninjatrader.com/ConnectionGu...nnection-Guide
      TWS 978.2c

      The only options that need to be checked would be the items listed in the connection guide. If you are seeing an inconsistency, for example manually submitting an order is allowed after market but a specific order type like stop loss is failing the first item to check would be the TWS version. If the version is correct a re install of the platform could be completed to make sure the NinjaTrader files are up to date as well.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #18
        HI Jesse,

        thank you for your suggestion but this does not solve the problem either.

        The situation is a bit more complicated as stated on IB wesite (https://ibkr.info/article/576):

        * For stocks, Market orders and Stop orders (which, when triggered, become Market orders) are only active from 09:30 until 16:00 EST (the Nyse's regular trading hours session). To have the order active in all sessions including the Premarket hours, Regular Trading Hours and the Aftermarket hours, you must use a Limit or Stop Limit type order and add the attribute "Allow Outside RTH". The same settings apply for Globex/ECBOT/Nymex Future contracts. The Nybot accepts Stop orders and converts them internally to "Stop with Protection" orders that are active for all available hours. A Future contract's RTH session is detailed in the contract's description window.

        So, I trade stocks and because of that even if I enable the option "Allow order to be activated, triggered, or filled outside of regular trading hours" the order will not trigger.

        I am using the unmanaged approach and I was thinking about the possibility to convert a Stop Loss (Market order) to Stop Limit order by setting the limitPrice to 0.

        SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.StopLimit, Quantity, 0, xxxx, oco, "signalName").

        It should trigger anytime the stopPrice is reached like a market order. Do you see any drawback in doing that?

        Thanks & Regards.

        Comment


          #19
          Hello Peppo,

          If you are using one of the order types mentioned in IB's message you would need to change what you are trying to do. You can certainly try submitting the stop limit like you mentioned however if you submit at a time when the market moves and that becomes an invalid price it may be rejected.

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

          JesseNinjaTrader Customer Service

          Comment


            #20
            Hi Jesse,

            Thank you for your answer. I want to submit the stop limit (stop loss) as soon my entry order has been filled or partially filled. I will place it some ticks away from my entry. Do you see any possibility for the order to be rejected or not filled due to fast changing price?

            I also have another issue.

            When I sell short I place 2 orders (BuyToCover). In particular the order for the StopLimit, placed above the market price, looks like this:

            SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.StopLimit, Quantity, 0, StopPrice, oco, "StopLossShort");

            As reported in the NT Help guide, I use "0" for order limit price (Use "0" should this parameter be irrelevant for the OrderType being submitted).

            When I run my strategy, I get an error message reporting "Limit price can't be smaller than stop price. affected Order: BuyToCover..." while placing the order.

            What can I do to fix this? I don't want to set a limit price since I want the order to be filled at any price from stop price like a stop order.

            Regards.

            Comment


              #21
              Hello Peppo,

              Thank you for your answer. I want to submit the stop limit (stop loss) as soon my entry order has been filled or partially filled. I will place it some ticks away from my entry. Do you see any possibility for the order to be rejected or not filled due to fast changing price?
              Sure, there is always the chance of an invalid price depending on how close you place the target. If the price has the ability to move more than a few ticks and your stop is placed on the wrong side of the market it may get rejected. You would need to review the instrument you are trading and determine how you would want to proceed there depending on the given market.

              When I sell short I place 2 orders (BuyToCover). In particular the order for the StopLimit, placed above the market price, looks like this:

              SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.StopLimit, Quantity, 0, StopPrice, oco, "StopLossShort");

              As reported in the NT Help guide, I use "0" for order limit price (Use "0" should this parameter be irrelevant for the OrderType being submitted).
              The limit price is not irrelevant to StopLimit type orders, you would need a limit price for that type of order. 0 can be used for orders which are not limit type orders like a Market as an example. For any Limit type order you need a limit price. For this use case you would need to calculate a limit price and submit the order with a limit price because it requires it.



              I look forward to being of further assistance.

              JesseNinjaTrader Customer Service

              Comment


                #22
                Hi Jesse,

                I implemented the stop loss like this:

                1) Long Position: I check that the stop price is below the current bid price and then I submit the order like this:

                SubmitOrderUnmanaged(0, OrderAction.Sell, OrderType.StopLimit, Quantity, 0, StopLong, oco, "StopLossLong");

                In this case the limit price must be lower than the stop price --> 0 < StopLong.

                2) Short Position: I check that the stop price is above the current ask price and then I submit the order like this:

                SubmitOrderUnmanaged(0, OrderAction.BuyToCover, OrderType.StopLimit, Quantity, StopShort + 1000*TickSize, StopShort, oco, "StopLossShort");

                In this case the limit price must be greater than the stop price --> StopShort + 1000*TickSize > StopShort.

                Are the spreads between limit and stop price enough large to "guarantee" a trigger of the orders?

                Thanks & Regards.

                Comment


                  #23
                  Hello Peppo,

                  Are the spreads between limit and stop price enough large to "guarantee" a trigger of the orders?

                  I couldn't' really say, that would depend on the instrument and its volatility. This would be something you need to try and see if that value works for the instrument being used and what you are trying to do.

                  If you see that the fills are happening when you expect and the target is being placed in a way that avoids rejections you could know it is working.

                  You can use the playback connection to fast forward through realtime data to get a better idea how it would do over a longer period of time as well. Otherwise you could test it against your realtime data feed or a live account when you feel it is ready.



                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by junkone, Yesterday, 08:06 PM
                  3 responses
                  16 views
                  0 likes
                  Last Post NinjaTrader_EricB  
                  Started by fscabrera03, Yesterday, 07:27 PM
                  1 response
                  5 views
                  0 likes
                  Last Post tradecombine  
                  Started by Rad4633, Yesterday, 05:31 PM
                  0 responses
                  2 views
                  0 likes
                  Last Post Rad4633
                  by Rad4633
                   
                  Started by litamm89, Yesterday, 03:51 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post litamm89  
                  Started by sgordet, Yesterday, 01:52 PM
                  3 responses
                  12 views
                  0 likes
                  Last Post NinjaTrader_Tyler  
                  Working...
                  X