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

Closed Orders

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

    Closed Orders

    I accidentally disabled a strategy that had an opened position, stop and limit order. When I enabled it again, it cancelled the stop and limit order. How can I prevent that? Is this normal behavior?

    Thanks!!

    #2
    Hello GibbsB613,

    Thanks for writing in to our Support team.

    This is most likely occurring due to certain exit conditions you have defined in your strategy and the logic you have defined for setting your profit target and stop loss values. Could you provide me a sample of your code pertaining to the order entry logic so that I can investigate this further?

    Also, can you clarify if the orders were cancelled after you disabled your strategy or only when you re-enabled it?

    I look forward to your reply.
    Alan S.NinjaTrader Customer Service

    Comment


      #3
      As stated in my original post:

      When I enabled it again, it cancelled the stop and limit order.

      What part of the code do you need to see?

      Thanks!!

      Comment


        #4
        Hello GibbsB613,

        Thanks for your reply.

        I would need to see any sections pertaining to setting stop losses or profit targets and any entry/exit logic to enter/exit a position.

        I look forward to your reply.
        Alan S.NinjaTrader Customer Service

        Comment


          #5
          else if (State == State.Configure)
          {
          AddDataSeries(Data.BarsPeriodType.Minute, 240);
          SetProfitTarget("", CalculationMode.Pips, 250);
          SetStopLoss("", CalculationMode.Pips, 50, false);
          }

          This is how they are set. The exit logic is moot since it never gets to execute. But just as an FYI, I dont have any exit logic, I adjust my stop and limit and allow them to be hit. The entry is just MA crossovers.

          Thanks!!!

          Comment


            #6
            Hello GibbsB613,

            Thanks for your reply.

            Please send me your log and trace files so that I can investigate this further.

            You can do this by going to the Control Center-> Help-> Mail to Platform Support.

            Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

            Please reference this forum thread by including this link in the body of the email and make the subject ATTN Alan S:
            http://www.ninjatrader.com/support/f...ad.php?t=99083

            I look forward to your reply.
            Alan S.NinjaTrader Customer Service

            Comment


              #7
              Hello GibbsB613,

              Thank you for sending me those files and for your patience.

              This behavior is occurring because you are using StartBehavior.WaitUntilFlat. With this StartBehavior, the strategy will check for any active orders previously generated by the strategy on your account and cancel those first. You can find documentation on StartBehavior.WaitUntilFlat here:
              http://ninjatrader.com/support/helpG...#WaitUntilFlat

              I would recommend using using StartBehavior.ImmediatelySubmit - using this will check for previously generated orders and attempt to match the active strategy order when the order action, order type, quantity, limit price, and stop price are exactly identical. You can find detailed documentation on StartBehavior.ImmediatelySubmit here:
              http://ninjatrader.com/support/helpG...ediatelySubmit

              Please let me know if I may be of any further assistance.
              Alan S.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by adeelshahzad, Today, 03:54 AM
              5 responses
              32 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by stafe, 04-15-2024, 08:34 PM
              7 responses
              32 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Started by merzo, 06-25-2023, 02:19 AM
              10 responses
              823 views
              1 like
              Last Post NinjaTrader_ChristopherJ  
              Started by frankthearm, Today, 09:08 AM
              5 responses
              20 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by jeronymite, 04-12-2024, 04:26 PM
              3 responses
              43 views
              0 likes
              Last Post jeronymite  
              Working...
              X