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

  • NinjaTrader_BrandonH
    replied
    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

    Leave a comment:


  • jonesy73
    replied
    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.

    Leave a comment:


  • NinjaTrader_BrandonH
    replied
    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

    Leave a comment:


  • QuantKey_Bruce
    replied
    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.

    Leave a comment:


  • jonesy73
    replied
    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.

    Leave a comment:


  • NinjaTrader_Spencer
    replied
    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:

    Leave a comment:


  • Calebg
    replied
    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.

    Leave a comment:


  • NinjaTrader_Spencer
    replied
    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.

    Leave a comment:


  • aviat72
    replied
    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.

    Leave a comment:


  • NinjaTrader_Spencer
    replied
    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.

    Leave a comment:


  • MatDerKater
    replied
    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?

    Leave a comment:


  • NinjaTrader_Spencer
    replied
    Hello aviat72,

    Thank you for your post.

    I have added your vote to Feature Request 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:

    Leave a comment:


  • aviat72
    replied
    After using NT for charting for a long time, and I finally decided to get a license to trade through it for Interactive Brokers (IB)
    To my surprise I find that the bracket attached orders are not transmitted with the parent order.
    In the current market environment this is an unacceptable risk.

    The fact that this has been asked for multiple years, and not supported suggests that NT does not understand trading risks management.

    To me this feature is basic table-stakes. It it very easy to support and you should be doing it on war-footing.
    Last edited by aviat72; 03-24-2020, 12:06 AM.

    Leave a comment:


  • NinjaTrader_Spencer
    replied
    Hello fredfred,

    Thank you for your post.

    As of right now, the Feature Request SFT-1091 has 36 votes.

    However, I am unable to give a specific timeline has to when this will be implemented, but there is interest being tracked.

    I would be more than happy to add your vote to this if it has not already been added.

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

    Leave a comment:


  • fredfred
    replied
    93575-server-side-bracket-submission

    Is there any news on implementing this?

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by algospoke, 04-17-2024, 06:40 PM
3 responses
26 views
0 likes
Last Post NinjaTrader_Jesse  
Started by bmartz, 03-12-2024, 06:12 AM
3 responses
29 views
0 likes
Last Post NinjaTrader_Zachary  
Started by Aviram Y, Today, 05:29 AM
2 responses
10 views
0 likes
Last Post Aviram Y  
Started by gentlebenthebear, Today, 01:30 AM
1 response
8 views
0 likes
Last Post NinjaTrader_Jesse  
Started by cls71, Today, 04:45 AM
1 response
7 views
0 likes
Last Post NinjaTrader_ChelseaB  
Working...
X