Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

working orders and On Bar Update

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

    working orders and On Bar Update

    I wrote a strategy that with a price condition set inside OnBarUpdate(), and place the trade inside OnMarketData(MarketDataEventArgs e), it works fine but the problem that I have is that once the working order is place, the OnBarUpdate() checks if the price change on every bar update (of course) if the price change my strategy cancel the previous working order and place a new working order with the new entry price but the problem is here: if the entry price stay the same the strategy does the same, cancel the current working order and place a new one with the same entry price, how can I do to prevent this happening, because sometimes market is too fast that ninja trader sent me and error because the order was misplace.

    #2
    Hello manuelmaldonado,

    If I am understanding you correctly, you want NinjaTrader to not cancel out your old order and keep your original entry price the same.

    If so, then you may use an IOrder to make sure that your orders is not already placed so that NinjaTrader will not change the price of your entry order. Here is an example of this that you may view.


    Another item that you may run into is that if your order is not filled by the end of the OnBarUpdate() NinjaTrader will cancel the order. To prevent this you may use the Advanced Order Handling approach to keep this order alive. Here is an example of how to keep an order a live even if it is not filled within the next OnBarUpdate().


    Let me know if you have any questions.
    JCNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    1 response
    17 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by benmarkal, Yesterday, 12:52 PM
    3 responses
    23 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by helpwanted, Today, 03:06 AM
    1 response
    20 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    12 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    244 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Working...
    X