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 Haiasi, 04-25-2024, 06:53 PM
    2 responses
    16 views
    0 likes
    Last Post Massinisa  
    Started by Creamers, Today, 05:32 AM
    0 responses
    4 views
    0 likes
    Last Post Creamers  
    Started by Segwin, 05-07-2018, 02:15 PM
    12 responses
    1,786 views
    0 likes
    Last Post Leafcutter  
    Started by poplagelu, Today, 05:00 AM
    0 responses
    3 views
    0 likes
    Last Post poplagelu  
    Started by fx.practic, 10-15-2013, 12:53 AM
    5 responses
    5,407 views
    0 likes
    Last Post Bidder
    by Bidder
     
    Working...
    X