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 DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    1 view
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    6 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    10 views
    0 likes
    Last Post bltdavid  
    Started by alifarahani, Today, 09:40 AM
    6 responses
    41 views
    0 likes
    Last Post alifarahani  
    Working...
    X