Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Send cancels only after 30 seconds....

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

    Send cancels only after 30 seconds....

    I created a strategy and everything was working fine until I went live with it, which is when I get this error message. I'm using Rithmic. The strategy submits a limit order when certain conditions are true but cancels the order unless it's filled during the next bar. The limit order is submitted and accepted and will get filled without any issues. However, if the order is not filled during that bar, it submits two cancel orders at the same time causing the issue. My code is not very complicated so I'm not sure why it's behaving this way.

    Edit: Just noticed this morning that this behavior does not happen every time if order isn't filled. There were two back to back orders where the Cancel order was only submitted once.
    Last edited by guyonabuffalo; 08-02-2022, 07:47 AM.

    #2
    Hi, thanks for posting. The platform will cancel orders after the bar they were submitted on unless the order is re-submitted every bar. You must use the order entry overload that takes a IsLiveUntilCanceled parameter e.g.:

    EnterLongLimit(int barsInProgressIndex, bool isLiveUntilCancelled, int quantity, double limitPrice, string signalName)

    Use this overload if you want to cancel the order yourself.

    Kind regards,
    -ChrisL

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris, thanks for responding.

      I think you may have misunderstood my post. I want the order to cancel after the bar it's submitted on, that's by design. The problem is that two cancels get sent when it does cancel the order and Rithmic complains and throws an error stating the message in the subject line.

      Comment


        #4
        Hi, If you are getting the error message "Send cancels only after 30 seconds" then it means the strategy is trying to cancel the order too quickly. If you need to cancel the order at the end of the bar, make sure that bar can last at least 30 seconds otherwise Rithmic will send this error message. Are you calling CancelOrder() in your strategy?
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          No, I am not. I'm letting the platform cancel the orders after the bar they were submitted on.

          Comment


            #6
            Hi, could you let me know what bar type you are running the strategy on? If it's a non time based bar it's possible that the bar is closing before the order is alive for over 30 seconds. This error message is a message from your broker, so the strategy will need to be adjusted to comply with this rule.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              The strategy is running on 2000 tick bars. The odd thing is that it doesn't behave like this all time. It's really random when it sends two cancels.

              Comment


                #8
                Hi, thanks for your reply. If this happens randomly, it most likely means there are 2000 tick bars that are closing before the required 30 seconds to cancel from Rithmic. You would need to handle the order cancelation in your code by reading the time stamp at the close of each bar. Something like:

                if(Position.MarketPosition == MarketPosition.Long/Short && DateTime.Compare(savedDateTime, (Time[0].AddSeconds(30))) > 0) //test in playback or realtime, use Print() to debug if needed.
                //Cancel order.
                Chris L.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Max238, Today, 01:28 AM
                1 response
                21 views
                0 likes
                Last Post CactusMan  
                Started by giulyko00, Yesterday, 12:03 PM
                2 responses
                10 views
                0 likes
                Last Post giulyko00  
                Started by r68cervera, Today, 05:29 AM
                0 responses
                4 views
                0 likes
                Last Post r68cervera  
                Started by geddyisodin, Today, 05:20 AM
                0 responses
                6 views
                0 likes
                Last Post geddyisodin  
                Started by JonesJoker, 04-22-2024, 12:23 PM
                6 responses
                37 views
                0 likes
                Last Post JonesJoker  
                Working...
                X