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

how to detect pending orders that still exist in the chart

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

    how to detect pending orders that still exist in the chart

    Hello,

    What can I do if my strategy is recalculated due to a network disconnection or if I compile the code and the previous Take Profit, Stop Loss or pending orders are lost?
    Can I detect pending orders in the chart under the account class? (they are still there, but lost contact with my strategy).
    Or is there any other way besides account?
    I want to ask how to detect pending orders that still exist in the chart by code, they are working


    thankyou


    #2
    Hello jetheil2,

    Thanks for your post.

    The Adopt Account Position Start Behavior would be used if you want the strategy to inherit the Account Position upon enablement. This requires additional programming.

    See the help guide documentation below for more information.

    Start Behaviors: https://ninjatrader.com/support/help...ccountPosition
    IsAdoptAccountPositionAware: https://ninjatrader.com/support/help...itionaware.htm

    Also, see the attached sample script which you may find helpful.

    Let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Hello,
      AdoptAccountPositionTestManaged: Line 67, is "oco" useful?

      Comment


        #4
        Hello jetheil2,

        Thanks for your note.

        'oco' on line 67 in the sample script would not need to be used and could be omitted from the script.

        'oco' is being assigned a unique ATM Strategy ID value that could be used to tie orders together via OCO.

        See this help guide for more information: https://ninjatrader.com/support/help...gyuniqueid.htm

        Let us know if we may assist further.
        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          'oco' is being assigned a unique ATM Strategy ID value that could be used to tie orders together via OCO


          --------
          How to tie orders together via OCO? Is there a simple example?
          I only know to tie orders together via setXXX
          Last edited by jetheil2; 02-18-2022, 08:29 AM.

          Comment


            #6
            Hello jetheil2,

            Thanks for your note.

            This OCO functionality would only be availabe when using the Unmanaged Approach to submit orders with SubmitOrderUnmanaged(). This would not be possible to incorportate with the Managed Approach Entry/Exit/Set methods.

            GetAtmStrategyUniqueId() will assign a unique id to the 'oco' variable. You would then use the 'oco' variable for the OCO property when calling SubmitOrderUnmanaged().

            SubmitOrderUnmanaged(int selectedBarsInProgress, OrderAction orderAction, OrderType orderType, int quantity, double limitPrice, double stopPrice, string oco, string signalName)

            See the attached example script which demonstrates using OCO with the Unmanaged Approach.

            And, see the help guide pages below.
            Unmanaged Approach: https://ninjatrader.com/support/help...d_approach.htm
            SubmitOrderUnmanaged: https://ninjatrader.com/support/help...runmanaged.htm

            Let us know if we may assist further.
            Attached Files
            Brandon H.NinjaTrader Customer Service

            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
            1 view
            0 likes
            Last Post port119
            by port119
             
            Started by Philippe56140, Today, 02:35 PM
            0 responses
            3 views
            0 likes
            Last Post Philippe56140  
            Started by 00nevest, Today, 02:27 PM
            0 responses
            2 views
            0 likes
            Last Post 00nevest  
            Working...
            X