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

Start Behavior

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

    #16
    Hello Charlie,

    The example demonstrates placing protective orders to protect the position in OnStateChange() during State.Transition.

    Can you clarify on what on you trying to handle?

    Are you still trying to handle matching orders previously placed by the strategy in real-time on a previous run?
    If so, this will not work unless there are historical orders being placed that can match the real-time orders.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #17
      1. I am not sure which example you are referring to. Please provide the link again.

      2. What I am trying to handle is this: When my strategy is enabled and reaches Real-Time State, I want it to pick up where it left off when it was disabled by recognizing the live account position and any orders that are sitting at the broker. Is this not possible?

      3. Yes, I am still trying to handle matching orders previously placed by the strategy in real-time on a previous run. In my last post I asked if I could take the order information from Account.Orders and submit matching orders within the strategy to sync up with the live account. Assuming the orders match exactly will NT not submit them to the broker? Otherwise I will wind up with duplicate orders.

      Charlie


      Comment


        #18
        Hello Charlie,

        Apologies, I had that linked in another thread. I'm including a link to this example below.
        https://ninjatrader.com/support/foru...29#post1068829

        Yes, with a strategy that implements intra-bar granularity, places the orders with logic both historically and in real-time, and uses the StartBehavior.ImmediatelySubmit I would expect this strategy to resume both any position left by the strategy and any orders left by the strategy, as it will also calculate those historically.

        With Adopt account position, this would primarily used if you didn't want to resume a strategies logic, but instead want to start with an account positions logic and start placing new protective orders from there. However, if you are placing orders in historical data with intra-bar granularity and these are being matched, these would also be resumed.

        So yes, it is possible.

        Orders from the Account object are not the strategies orders, these are account orders.

        Only orders that are submitted from the strategy can be matched and resumed if the price, time, and name are exactly the same.

        From the help guide:
        "Any active orders on the account previously generated by the strategy that does not match* an active strategy order will be cancelled. Should the strategy be unable to cancel and receive confirmation on the cancellation of these orders within 40 seconds the strategy will not start and an alert will be issued."
        * A previously generated order is considered to match an active strategy order when the order action, order type, quantity, limit price, and stop price are exactly identical.
        https://ninjatrader.com/support/help...ccountPosition
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by PaulMohn, Today, 05:00 AM
        0 responses
        7 views
        0 likes
        Last Post PaulMohn  
        Started by ZenCortexAuCost, Today, 04:24 AM
        0 responses
        6 views
        0 likes
        Last Post ZenCortexAuCost  
        Started by ZenCortexAuCost, Today, 04:22 AM
        0 responses
        3 views
        0 likes
        Last Post ZenCortexAuCost  
        Started by SantoshXX, Today, 03:09 AM
        0 responses
        16 views
        0 likes
        Last Post SantoshXX  
        Started by DanielTynera, Today, 01:14 AM
        0 responses
        5 views
        0 likes
        Last Post DanielTynera  
        Working...
        X