Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Order associated with Strategy instance?

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

    Order associated with Strategy instance?

    Hi:

    I've got a strategy that places orders using SubmitOrder. I run my strategy in multiple windows on different timeframes for the same instrument. So, I've got a different Strategy instance for each one of my charts.

    Since they are all running on the same instrument, I'd like any one of the Strategy instances to be able to selectively process OnOrderUpdate for example.

    The issue I'm seeing is that if I close the Strategy instance that was used to create the order originally, through SubmitOrder... None of the other strategy instances are getting OnOrderUpdate called, from what I can tell.

    So the question is: Is this just the way it works? If so, after closing a strategy (but not cancelling the order) how could one ever reopen the Strategy and internally recreate a valid order state within the Strategy without having to cancel and resubmit on the new Strategy instance?

    Is there a field in the IOrder objects that can be updated to 'associate' the orders with the new Strategy instance?

    Thx.

    #2
    Ok, so this is pretty interesting. After some additional investigation and fooling around I was able to get OnOrderUpdate kickstarted for a Strategy instance that was not the original creator of the Order.

    After the original instance terminated, I was able to call Strategy.ChangeOrder() (not modifying the price...) and then OnOrderUpdate events began arriving for that order and I was able to successfully manipulate it at will. As though the new Strategy instance had actually created the order in the first place.

    This gives me exactly what I need. The new question is this: This isn't really 'undocumented' behavior. It's documented. But how much trouble am I potentially buying myself by doing this?

    Thx.

    Comment


      #3
      It's Flakey

      After some additional testing, I'm seeing my Entry order get randomly cancelled when I call ChangeOrder on a different Strategy instance than the one which created it.

      Sometimes it works... sometimes it does not.

      Is there documented well-known way to get this working?

      I would assume there is a documented way that this works. Because, again, if your strategy gets shutdown leaving some orders active, how can one reestablish a valid internal order state within a new instance of the Strategy for those previously created orders?
      Last edited by BigWaveDave; 11-09-2013, 04:19 PM. Reason: grammar

      Comment


        #4
        Hello BigWaveDave,

        Thank you for your post.

        OnOrderUpdate() and ChangeOrder() are not designed to work outside of a strategy instance with orders from another strategy instance. Any behavior would be undocumented as this is not the intent of there two methods. There is no method to have a strategy pick up orders from a previous instance.

        You can enable NinjaTrader to immediately submit live working historical orders when enabling the strategy, this however does not seem to be what you are looking for. For more information on these settings please visit the following link: http://www.ninjatrader.com/support/h..._positions.htm

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

        Comment


          #5
          Thanks for the feedback Patrick!

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by futtrader, 04-21-2024, 01:50 AM
          4 responses
          41 views
          0 likes
          Last Post futtrader  
          Started by Option Whisperer, Today, 09:55 AM
          1 response
          11 views
          0 likes
          Last Post bltdavid  
          Started by port119, Today, 02:43 PM
          0 responses
          7 views
          0 likes
          Last Post port119
          by port119
           
          Started by Philippe56140, Today, 02:35 PM
          0 responses
          7 views
          0 likes
          Last Post Philippe56140  
          Started by 00nevest, Today, 02:27 PM
          0 responses
          7 views
          0 likes
          Last Post 00nevest  
          Working...
          X