Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can't use SetProfitTarget & ExitLongLimit/ExitShortLimit together in Strategy

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

    Can't use SetProfitTarget & ExitLongLimit/ExitShortLimit together in Strategy

    I understand I can't use SetProfitTarget & ExitLongLimit/ExitShortLimit together in a strategy due to the order handling rules.

    How do I change the SetProfitTarget order so that it work together with ExitLongLimit/ExitShortLimit orders in a strategy?

    Also, do ExitLongLimit/ExitShortLimit orders expire automatically? How do I set them to be live until cancelled? Will these orders be automatically cancelled when my strategy stops at the end of the trading day or will it still be live and I need to cancel manually in TWS?
    Last edited by tjendra; 06-04-2009, 12:48 AM.

    #2
    tjendra, I'm not sure I follow SetProfitTarget is just a normal limit order. This would be the same as the ExitLongLimit / ExitShortLimit you already use. To set them liveUntilCancelled please use this overload -

    Code:
     
    ExitLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName, string fromEntrySignal)


    If you cancel the strategy, those orders would be cancelled, as this is set per defaul under OrderHandling in the Tools > Options > Strategies > NinjaScript tab.

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      tjendra, I'm not sure I follow SetProfitTarget is just a normal limit order. This would be the same as the ExitLongLimit / ExitShortLimit you already use. To set them liveUntilCancelled please use this overload -

      Code:
       
      ExitLongLimit(int barsInProgressIndex, bool liveUntilCancelled, int quantity, double limitPrice, string signalName, string fromEntrySignal)


      If you cancel the strategy, those orders would be cancelled, as this is set per defaul under OrderHandling in the Tools > Options > Strategies > NinjaScript tab.
      I tried puting SetProfitTarget and ExitLongLimit / ExitShortLimit in the strategy but the strategy don't seem to work properly until I removed the SetProfitTarget order. That's why this question.

      So to use the overload, I will need to enter all the variables? Should I put 0 for int barsInProgressIndex if there is only 1 instrument?

      Comment


        #4
        That is correct. You cannot mix Set() and an explicit ExitLongLimit() for the same position because of the potential to have overfills when both get filled.

        For a single instrument strategy you would use 0, that is correct.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          That is correct. You cannot mix Set() and an explicit ExitLongLimit() for the same position because of the potential to have overfills when both get filled.

          For a single instrument strategy you would use 0, that is correct.
          How do I change the SetProfitTarget order so that it work together with ExitLongLimit/ExitShortLimit orders in a strategy? Would I have to use Limit orders instead to set the profit target manually? But then would the strategy know that those orders are profit target, and after they are hit, the strategy should be flat so that orders such as exit on close won't get executed.

          Comment


            #6
            You will need to use ExitLongLimit()s. Limit orders are the same thing as profit targets. Once the limit price is reached it will try to get filled. When completely filled that would generally mean your position is closed, just like how SetProfitTarget() works.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Josh View Post
              You will need to use ExitLongLimit()s. Limit orders are the same thing as profit targets. Once the limit price is reached it will try to get filled. When completely filled that would generally mean your position is closed, just like how SetProfitTarget() works.
              If I use ExitLongLimit() orders for my profit targets, would I also be able to use ExitLongLimit() orders for my stops instead of using ExitLong() only?

              Comment


                #8
                You can use ExitLongLimit() for targets and ExitLongStop() for stops.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Josh View Post
                  You can use ExitLongLimit() for targets and ExitLongStop() for stops.
                  What the difference between using ExitLongStop() and ExitLong()? Wouldn't both be market orders when price is hit? I want to use ExitLongLimit() for stops as well to prevent slippage. Is it possible to use it for both profit targets and stops?

                  Comment


                    #10
                    tjendra, for the stop you would then have to a StopLimit order, otherwise the limit would fill you immediately as you place it.

                    ExitLongStop is a stop market order, ExitLong just exits right away with a market order.

                    Comment


                      #11
                      Originally posted by NinjaTrader_Bertrand View Post
                      tjendra, for the stop you would then have to a StopLimit order, otherwise the limit would fill you immediately as you place it.

                      ExitLongStop is a stop market order, ExitLong just exits right away with a market order.
                      The stop won't fill immediately coz the timing of the order is not at the same time. The profit target limit order is entered when a trade is taken, but the stop limit order will only be entered if the stop criteria is hit. That's why I am wondering if I can use both ExitLongLimit for both profit target and stop.

                      Comment


                        #12
                        tjendra, issue with the limit order as stop would be you't can place this, as it would immediately fill you. Consider being long and you place your stop using a normal limit, you have to place a sell limit order then below the current market - result would be a immediate fill, as this becomes a marketable limit order then.

                        Comment


                          #13
                          Originally posted by NinjaTrader_Bertrand View Post
                          tjendra, issue with the limit order as stop would be you't can place this, as it would immediately fill you. Consider being long and you place your stop using a normal limit, you have to place a sell limit order then below the current market - result would be a immediate fill, as this becomes a marketable limit order then.
                          It wont be a marketable limit order as price might have gone pass the limit price for the stop as the limit order was placed. So by placing the limit, you are hoping to get a better execution than using a market order such as ExitLong() or ExitLongStop but at consequence of not getting filled.

                          Comment


                            #14
                            Then you could simply modify the price of your ExitLongLimit() order to try exiting at your 'stop price' with a limit order.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            666 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            377 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            110 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            575 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            580 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X