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

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.

    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.

        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 alexstox, 10-16-2018, 03:29 PM
          11 responses
          343 views
          0 likes
          Last Post aligator  
          Started by ageeholdings, 05-01-2024, 05:22 AM
          6 responses
          44 views
          0 likes
          Last Post ageeholdings  
          Started by tony_28217, Today, 07:04 PM
          0 responses
          11 views
          0 likes
          Last Post tony_28217  
          Started by flybuzz, Today, 10:33 AM
          1 response
          9 views
          0 likes
          Last Post flybuzz
          by flybuzz
           
          Started by spencerp92, 10-10-2023, 09:56 AM
          4 responses
          312 views
          0 likes
          Last Post flybuzz
          by flybuzz
           
          Working...
          X