Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Order rejected because of "insufficient buying power"

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

    #16
    Hello,

    The only issue here with your code is that everytime your stop order is cancelled you will reverse position. So if your Profit Target gets his for examply and you exit the trade you will reverse position.

    This is why you need some sort of flag to be set for when you want to actually reverse.

    I look forward to assisting you further.
    BrettNinjaTrader Product Management

    Comment


      #17
      Are you confusing me with someone else? I don't now why you started talking about reversing in post #14 since we never talke about it before. I never wanted to reverse my position, I only wanted to exit it without having my exit order rejected.

      Assuming you mean "exit" rather than "reverse," I don't understand what the problem is. The pseudocode I posted under OnOderUpdate sets both the stopOrder and the exitOrder back to null. It's the "exit conditions" within my first block that tell when I "really want to exit."
      Last edited by raintree; 03-15-2011, 09:45 AM.

      Comment


        #18
        Hello,

        Sorry must have had you confused.

        You are in good shape since you are using Exit Long();

        With this code with no flag. When a profit target gets hit this will leave you with a flat position and will then cancel your stop loss since your stop loss is OCO linked to your stop loss to automatically cancel.

        When this happens, the strategy will then get confirmation of the cancellation of the stop loss and then will run ExitLong(). Which will not do anything since you are not currently in a position to exit.

        So this code should be fine.

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #19
          I don't think we have to worry about OCO orders in this case. First I don't use a profit target in my strategy, but more importantly (FYI) MBTrading does not support OCO orders at all! There's a Ninjatrader disclaimer somewhere to that effect. That's why I was very careful to mention that we are dealing with MBTrading.

          Anyway, thank you for confirming that my code will probably work. I'll just have to try it in my cash account to be sure.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          633 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          364 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          105 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          567 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          568 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X