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


          #5
          Hi,

          I'm wondering if there is an updated/newer version of 'Unmanaged_Template" for detailed example on how to code around Unmanaged Approach strategy development.

          Thank You.

          Comment


            #6
            Hello FaaastEddy,

            Thanks for your note.

            We do not have an updated/newer version of the script shared by NinjaTrader_Jim.

            The same unmanaged approach methods would be used in an updated script as the ones you see in the UnmanagedTemplate example shared by NinjaTrader_Jim on post # 2.

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

            You could view the attached example that NinjaTrader_Jim shared and the attached script, UnmanagedOCOBracketExample, which you might find helpful.
            Attached Files
            Brandon H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by TraderBCL, Today, 04:38 AM
            2 responses
            7 views
            0 likes
            Last Post TraderBCL  
            Started by martin70, 03-24-2023, 04:58 AM
            14 responses
            105 views
            0 likes
            Last Post martin70  
            Started by Radano, 06-10-2021, 01:40 AM
            19 responses
            606 views
            0 likes
            Last Post Radano
            by Radano
             
            Started by KenneGaray, Today, 03:48 AM
            0 responses
            4 views
            0 likes
            Last Post KenneGaray  
            Started by thanajo, 05-04-2021, 02:11 AM
            4 responses
            471 views
            0 likes
            Last Post tradingnasdaqprueba  
            Working...
            X