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

Unmanaged Order Approach Examples

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

    Unmanaged Order Approach Examples

    Hi,

    Is there a collection of sample/reference strategies that illustrates how to use the unmanaged order approach in advanced scenarios which also illustrates all the things one would need to be concerned about vs using the managed approach? Is there something like that you can point me to?

    Thanks,
    FaaastEddy

    #2
    Hello FaaastEddy,

    Thanks for your post.

    You can read about the Unmanaged Approach following the documentation below. I have also attached an UnmanagedTemplate strategy which follows the same techniques as SampleOnOrderUpdate.

    Unmanaged Approach - https://ninjatrader.com/support/help...d_approach.htm

    SampleOnOrderUpdate (to compare with Unmanaged Template strategy) - https://ninjatrader.com/support/help...and_onexec.htm

    Unmanaged allows you to have full control over OCO and Overfilled orders, but removes the framework of the Managed Approach. We essentially just tell NinjaTrader to submit orders to buy and sell. SellShort and BuyToCover would be order types to enter short and close short positions, but the premise is essentially the same that we do not Enter/Exit, we just Buy/Sell.

    Let us know if you have any additional questions.

    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      Hi Jim,

      Thanks for the UnmanagedTemplate sample code, its quite helpful to understand how to use the Unmanaged Order Approach.

      I have a question regarding order references. The sample has a comment in the OnOrderUpdate() method that indicates its more reliable to assign order objects there than in the OnBarUpdate() method. The reason provided is: "as the assignment is not guaranteed to be complete if it is referenced immediately after submitting". I want to double check if I get this point. As an example, you assign the order object that is returned from the unmanaged order submission call to an order entry variable in the OnBarUpdate() method. Then on the next line, you try to use it - is this is the unreliable case? If so why? The code is not async, so I assume after the order object assignment it should be there by the time the next line of code is processed. Or am I going down the wrong path in thinking what that comment means? When would you use the order object that is returned from the unmanaged order submission method? in the sample provided it's not assigned there but assigned in the OnOrderUpdate() instead.

      Comment


        #4
        Hello FaaastEddy,

        Your understanding is correct. The trying to use the order on the next line will either be the incorrect order, unreliable information, or will fail with an error.

        The code is async. OnBarUpdate runs from the data thread. OnOrderUpdate runs from the order thread. These are not synchronous.

        Below are links to the help guide.
        https://ninjatrader.com/support/help...rderupdate.htm
        https://ninjatrader.com/support/help...nbarupdate.htm

        Where you have inquired:
        "When would you use the order object that is returned from the unmanaged order submission method?"

        The answer is never. Always use the order object from OnOrderUpdate as advised in the help guide.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by buyvigornow, Today, 11:38 PM
        0 responses
        1 view
        0 likes
        Last Post buyvigornow  
        Started by buyvigornow, Today, 11:37 PM
        0 responses
        1 view
        0 likes
        Last Post buyvigornow  
        Started by HTrader, Today, 09:12 PM
        2 responses
        11 views
        0 likes
        Last Post HTrader
        by HTrader
         
        Started by firstlanetech, Today, 08:56 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X