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

Error on executing DB command

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

    Error on executing DB command

    Hello. My automated strategy was running. It placed an order. Then three error messages popped up and my automated strategy was un-enabled. So I used playback to show me what had happed.


    The 1st error message: "Playback101, Sell stop or sell stop limit orders can't be placed above the market. affected Order: Sell 1 [email protected]."

    The 2nd error message: "Strategy "RboTunlk' submitted an order that generated the follwing error "Order rejected' Strategy has sent cancel requests, attempted to close position and terminate itself.

    The 3rd error message: PlayBac101, Order686db1d45e5.... can't be submitted: The OCO ID '99edf21d4a23....' cannot be reused. Please use a new OCO ID. affected Order: Sell 1 Limit @

    I attached a screenshot of the error messages. Can someone explain what happened and why my strategy was shut off, and help me find a solution to my problem?
    Thanks
    Attached Files

    #2
    Hi AdeptistJune, thanks for posting.

    The source of the issue is the stop-loss getting placed on the wrong side of the market, all other errors are caused by the stop loss being rejected. You will need to analyze why this stop was placed on the wrong side of the market and make adjustments to the stop price so it does not happen again.

    Best regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Can I send you a copy of my code. I'm new at programming and I doubt I will be able to tell the difference. Thanks.

      Comment


        #4
        Hi AdeptistJune, thanks for your reply.

        I will not be able to debug the script for you but I will have a look if the script is reduced down to demonstrate the issue. You can send the script to scriptingsupport at ninjatrder.com referencing "Attn ChrisL" in the body of the email.

        Best regards,
        -ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Thanks. I just sent you an email.

          Comment


            #6
            Hi, I reviewed the script sent by email, just following up here so there is an answer on the forum.

            The stop losses are very tight, so a 4$ currency stop loss might be less than a tick for the instrument you were running the strategy on, or there was an in-flight order rejection where the order was sent to the broker and the price changed before the stop loss could get to the exchange, resulting in an order rejection. If you loosen the stop loss more to be further away from the current market price it can be avoided, or you can handle the order rejection by setting RealTimeErrorHandling to IgnoreAllErrors and handle the rejection in OnOrderUpdate when the order gets the Rejected state. When the Rejected state occurs, re-submit a stop order at a legal price.

            Best regards.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by elirion, Today, 01:36 AM
            0 responses
            3 views
            0 likes
            Last Post elirion
            by elirion
             
            Started by gentlebenthebear, Today, 01:30 AM
            0 responses
            4 views
            0 likes
            Last Post gentlebenthebear  
            Started by samish18, Yesterday, 08:31 AM
            2 responses
            9 views
            0 likes
            Last Post elirion
            by elirion
             
            Started by Mestor, 03-10-2023, 01:50 AM
            16 responses
            391 views
            0 likes
            Last Post z.franck  
            Started by rtwave, 04-12-2024, 09:30 AM
            4 responses
            34 views
            0 likes
            Last Post rtwave
            by rtwave
             
            Working...
            X