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

Stop Orders Rejecting Logic

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

    Stop Orders Rejecting Logic

    Hi!

    Strategy tries to send Stop Loss unmanaged orders, but sometimes it can get rejects by some undefined(!) reason - price of the stop loss can be far from the market bid/ask

    For example,
    short entry price was 12027,
    spread at that time was 12027/12030
    and buy stop order with price of 12032.5 was rejected, but limit price of target order of 12025 was accepted and submitted

    1) Are there any rules from NT that it can reject orders on playback connection mode?
    2) Are there any rules from NT that it can reject orders on playback connection mode with big speed? I see that NT can't manage orders properly, it seems that ticks are going with big speed, but orders execution is made like the speed is 1x
    3) What to do if you get such rejects on the demo connection?
    4) What to do if you get such rejects on the REAL connection?

    Thank you


    Last edited by fut_practic; 03-23-2023, 12:48 PM.

    #2
    Hello fut_practic,

    If there is an order being rejected, that would cause an order error message to appear on the Log tab of the Control Center and j


    Are there any rules from NT that it can reject orders on playback connection mode?
    Yes, basically the same rules that would cause an order to be rejected by a broker. Invalid order price, order outside of market hours, no real-time data, pairing with closed OCO order, etc.

    Are there any rules from NT that it can reject orders on playback connection mode with big speed? I see that NT can't manage orders properly, it seems that ticks are going with big speed, but orders execution is made like the speed is 1x
    The playback speed should not effect order processing. If the order is rejected at 100x it should also be rejected at 1x.

    What to do if you get such rejects on the demo connection?
    Correct the code to prevent the rejected order. Ensure you are choosing a valid price (buy stops above ask, sell stops below bid), enabling the strategy during market hours, not using an OCO string thats been used on a closed order, etc.

    If the script is intending to place orders at invalid prices, and you are expecting orders to be rejected, you could also check the order state to be rejected, and then on the next bar update resubmit the order.

    What to do if you get such rejects on the REAL connection?
    Correct the code to prevent the rejected order. Ensure you are choosing a valid price (buy stops above ask, sell stops below bid), enabling the strategy during market hours, not using an OCO string thats been used on a closed order, etc.

    If the script is intending to place orders at invalid prices, and you are expecting orders to be rejected, you could also check the order state to be rejected, and then on the next bar update resubmit the order.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello fut_practic,

      If there is an order being rejected, that would cause an order error message to appear on the Log tab of the Control Center and j



      Yes, basically the same rules that would cause an order to be rejected by a broker. Invalid order price, order outside of market hours, no real-time data, pairing with closed OCO order, etc.


      The playback speed should not effect order processing. If the order is rejected at 100x it should also be rejected at 1x.


      Correct the code to prevent the rejected order. Ensure you are choosing a valid price (buy stops above ask, sell stops below bid), enabling the strategy during market hours, not using an OCO string thats been used on a closed order, etc.

      If the script is intending to place orders at invalid prices, and you are expecting orders to be rejected, you could also check the order state to be rejected, and then on the next bar update resubmit the order.


      Correct the code to prevent the rejected order. Ensure you are choosing a valid price (buy stops above ask, sell stops below bid), enabling the strategy during market hours, not using an OCO string thats been used on a closed order, etc.

      If the script is intending to place orders at invalid prices, and you are expecting orders to be rejected, you could also check the order state to be rejected, and then on the next bar update resubmit the order.
      I check always stop entry price that it must be worse then market. Also I check bid and ask, that stop must be outside current spread. I monitor all prices (last/bid/ask). No any OCO.
      All conditions are ok.
      But it rejects.
      See the example above - entry was done, but stop order was rejected by some reason, and opposite limit order was placed. Unless that market prices was too far from the requested price. I save all prices and check.

      Comment


        #4
        Hello fut_practic,

        If you would like assistance with an error message, please provide the full error message.

        Ctrl + c to copy, Ctrl + v to paste in your reply.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello fut_practic,

          If you would like assistance with an error message, please provide the full error message.

          Ctrl + c to copy, Ctrl + v to paste in your reply.
          There are No any errors anywhere, in logs, no exceptions. Yes it shows that messagebox allmost all time, that price are out of market, BUT price are ok, because I output all info (order price, last, bid, ask at time of accepting, and the same at time of execution/rejecting).
          The question is why it rejects when all conditions are correct?

          And also it's much more such errors when I use playback connection and big speed vs tests on 1x speed.

          Comment


            #6
            Hello fut_practic,

            What message box are you referring to?

            If this is an order error for a real-time order, it will be in the Log.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by TraderIqbal, 10-20-2023, 10:12 AM
            2 responses
            118 views
            0 likes
            Last Post Funnywo
            by Funnywo
             
            Started by Creamers, 04-27-2024, 05:32 AM
            12 responses
            72 views
            0 likes
            Last Post Creamers  
            Started by fredericlebre, Today, 01:19 AM
            0 responses
            7 views
            0 likes
            Last Post fredericlebre  
            Started by TraderJA, Today, 12:06 AM
            0 responses
            10 views
            0 likes
            Last Post TraderJA  
            Started by SnailHorn, Yesterday, 10:49 PM
            0 responses
            9 views
            0 likes
            Last Post SnailHorn  
            Working...
            X