Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to submit bracket stop/profit orders with NT8?

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

    #46
    Originally posted by imphasing View Post
    Thanks for getting back to me.

    Manually setting the OCO target and stop has the undesirable effect that if my entry order doesn't get filled, I have stray stop/target orders sitting around. Imagine this scenario:

    1. place buy stop entry order above the market price, to initiate a long position
    2. place OCO stop and target orders
    3. go to sleep
    4. price drops before filling the entry order, falls through your OCO stop
    5. surprise! you're short, good morning!

    ATM orders have the undesirable effect or requiring NT to be running and connected to your broker in order to submit stops and targets.

    If there's no way for NT to submit bracket orders, I'm afraid NT just doesn't fit my needs and I would be better off just executing through my broker's application where I can submit bracket orders.

    I know.....

    UNBELIEVABLE!

    NinjaTrader is meant to be a professional trading platform and it doesn't allow for the most simple of trade orders.

    A Limit Entry Order. A Stop Loss. And a Limit Target Order.


    Why would anyone use this platform?

    Comment


      #47
      Hello MatDerKater,

      Thank you for your post.

      Please note that this is not true for all Brokers/Data Feed providers that you are able to connect to with NinjaTrader.

      This depends on the Brokers Servers you are using that supports this functionality.

      Below I have provided a link showing which Brokers support the function and where your OCO orders reside:If OCO functionality is not supported by your Broker then yes your platform must be connected to be able to send the appropriate signals.

      However, if OCO is supported your ATM Strategy with your Profit Target and Stop Loss will function as expected as the signals are sent from the Brokers Servers and not your platform.
      Spencer F.NinjaTrader Customer Service

      Comment


        #48
        Interactive Brokers provides code samples on how to create the opening order and attach the bracket orders as child orders to the parent order and transmit them together.

        Comment


          #49
          Hello aviat72,

          Thank you for your post.

          You may use this code by using custom coding within NinjaTrader and our NinjaScript Support Team would be able to assist with any specific questions you may have. If you are not a coder yourself, we have developers available within our NinjaTrader EcoSystem that would be able to assist.

          Spencer F.NinjaTrader Customer Service

          Comment


            #50
            Please add me to the list of people voting for SFT-1091. Not being able to send the entry, stop, and trigger to the server all at once is no beuno.

            Comment


              #51
              Hello Calebg,

              Thank you for your post.

              I have added a vote to SFT-1091.

              Please reference this internal tracking number when contacting Platform Support if you ever have questions regarding this feature request.

              When a feature request is implemented, you'll find a description of the new feature in the release notes:
              Spencer F.NinjaTrader Customer Service

              Comment


                #52
                Originally posted by NinjaTrader_Spencer View Post
                Hello aviat72,

                Thank you for your post.

                You may use this code by using custom coding within NinjaTrader and our NinjaScript Support Team would be able to assist with any specific questions you may have. If you are not a coder yourself, we have developers available within our NinjaTrader EcoSystem that would be able to assist.
                Hi, I'm having the same problem where strategy is getting rejected only when the market moves fast and goes past my entry or exit. I tried the Interactive Brokers code sample in the previous post for parent/child bracket orders but I got a bunch of compile errors. Wondering if someone has a ninjascript code sample that works in NinjaTrader without errors. I'm not a coder but I can work with other people's brilliance. Eg. I can use the variables that contain the entry, target, stop and incorporate it into my strategy. Don't act like you're not impressed, lol.

                Comment


                  #53
                  I'm not sure I grasp what all everyone has struggled with in this thread but have you tried just using an ATM? Either manually from chart trader or programmatically by starting one up from your strategy? They do all that and more, and they work quite well.

                  Additionally, if you use managed orders, you can submit your exit orders BEFORE your entry orders, and NinjaTrader will automatically send them the split second you get an entry fill, so it's a software OSO of an OCO exit pair. You could SetStopLoss and SetProfitTarget or you could ExitLongStop and ExitLongLimit or ExitShortStop and ExitShortLimit.

                  Either of these have virutally no programming involved, and work pretty well. I'm not sure if there's more to this leading to why you're trying to do it the really hard way and maybe I missed it.
                  Last edited by QuantKey_Bruce; 05-20-2023, 06:21 PM.
                  Bruce DeVault
                  QuantKey Trading Vendor Services
                  NinjaTrader Ecosystem Vendor - QuantKey

                  Comment


                    #54
                    Hello jonesy73,

                    Thanks for your notes.

                    SetStopLoss() and SetProfitTarget() methods could be used to submit protective orders when an entry order is filled. Since they are submitted upon receiving an execution, the Set method should be called prior to submitting the associated entry order to ensure an initial level is set. You could set up a simple strategy using the Strategy Builder to see how these methods work.

                    Below is a link to a forum post with helpful information about getting started with NinjaScript.
                    https://ninjatrader.com/support/foru...040#post786040

                    Or, Exit methods such as ExitLongLimit() and ExitLongStopLimit() could be used to submit protective orders in a custom NinjaScript. See the attached example script demonstrating this.

                    Further, you could consider using ATM Strategies either manually from Chart Trader or in a custom NinjaScript strategy. See the SampleAtmStrategy script that comes default with NinjaTrader for how this could be done. To view the code of this script, open a New > NinjaScript Editor window, open the Strategies folder, and double click on the SampleAtmStrategy file.

                    See this help guide page about Atm Strategy Methods: https://ninjatrader.com/support/help...gy_methods.htm

                    See this help guide page about using ATM Strategies: https://ninjatrader.com/support/help...atm.htm​
                    Attached Files
                    Brandon H.NinjaTrader Customer Service

                    Comment


                      #55
                      Thank you very much for the information. I have tried using the SampleATMStrategy using AtmStrategyCreate() with the same result. Errors similar to "Sell and Buy Stops cannot be placed Above/Below the market". I've also tried to submit the stop and takeprofit order before the entry order with SetStopLoss() and SetProfitTarget() and I get the same errors.

                      I have a scalping strategy of 1 to 3 ticks. I notice when the entry order is executed, there is a split second delay for my stop and takeprofit to execute. When the market has already moved the 1 to 3 ticks in this split second window (which happens all the time), I get the error and my entry order is left hanging in the market with no stoploss or profit target.

                      I'm using Rithmic data feed, have a pentium 7 computer and 300mb internet download speed and 30mb upload speed. I guess this isn't fast enough to beat a fast moving market without server-side bracket orders submitted all at once. I too would like to vote for server-side bracket orders, has any progress been made with the Rithmic data feed server-side bracket orders? Continuum is not an option for me. Thank you and Regards.

                      Comment


                        #56
                        Hello jonesy73,

                        Thanks for your notes.

                        "Sell and Buy Stops cannot be placed Above/Below the market""

                        This error message means that the strategy attempted to change an order to the wrong side of the market. Buy stop orders must be placed above the current ask price. Sell stop orders must be placed below the current bid price.

                        If this is due to market volatility then there isn't really a way to 100% avoid this occurring, as in volatile markets the market could move so far and fast that this would occur.

                        Add prints to the strategy to determine why the stop order is being ignored. One line above where the stop order is placed, print the GetCurrentAsk()/GetCurrentBid() and print the price being submitted to the order method.

                        Something you could consider is using GetCurrentBid() and GetCurrentAsk() to offset orders so that they are more likely to land on the correct side of the market.

                        See these help guide pages for more information.
                        GetCurrentBid(): https://ninjatrader.com/support/help...currentbid.htm
                        GetCurrentAsk(): https://ninjatrader.com/support/help...currentask.htm

                        You could also consider using RealtimeErrorHandling.IgnoreAllErrors to trap order errors in OnOrderUpdate by checking error == ErrorCode.UnableToChangeOrder.

                        Please note that setting this property value to IgnoreAllErrors can have serious adverse affects on a running strategy unless you have programmed your own order rejection handling in the OnOrderUpdate() method. To do this you could trap the rejected order by checking if the OrderState is Rejected within OnOrderUpdate() followed by defining your own order rejection handling behavior for the rejected order.

                        Please see the example in the help guide link below that demonstrates using RealtimeErrorHandling and trapping a rejected order in OnOrderUpdate().

                        RealtimeErrorHandling — https://ninjatrader.com/es/support/h...orhandling.htm
                        Brandon H.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by martin70, 03-24-2023, 04:58 AM
                        15 responses
                        114 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by The_Sec, Today, 02:29 PM
                        1 response
                        7 views
                        0 likes
                        Last Post NinjaTrader_Jesse  
                        Started by jeronymite, 04-12-2024, 04:26 PM
                        2 responses
                        31 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Started by Mindset, 05-06-2023, 09:03 PM
                        10 responses
                        265 views
                        0 likes
                        Last Post NinjaTrader_BrandonH  
                        Started by michi08, 10-05-2018, 09:31 AM
                        5 responses
                        743 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X