Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Avoid Dead Sim101 Orders?

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

    Avoid Dead Sim101 Orders?

    Hi NT,

    I am running into an issue where my strategy is leaving "dead" / "stuck" orders out in the market, that are floating around for hours and not filling. I have found numerous threads on this issue and I believe this is caused when the strategy attempts to change/cancel a live order at the same instant it is being filled. My strategy is a higher frequency strategy that triggers/changes orders with the OnMarketData() method, so this is happening very often.

    Is there any way to avoid this? Could I add some logic to the strategy to check order state before attempting to change/cancel?

    I understand how to clear these stuck orders out of Sim101, and I understand that these are less likely to happen in a real account as orders are hosted on the broker's servers. It would really be nice to find a way to avoid this so that I can actually test this strategy before going live. It would also be nice to not need to clear out the DB on a daily basis.

    Click image for larger version

Name:	Capture.JPG
Views:	178
Size:	50.9 KB
ID:	1126511

    #2
    Hello collic653,

    Thank you for your post.

    Bombarding an order with a number of change requests per second can cause that order to get stuck in a pending state and the order will be shown as orange on the chart.

    You should add logic to your strategy which limits requests to change an order per second. For example, before you change the order save the current DateTime to a variable, then when you go back to change it again, check that you're not on the same second as the previous change request before submitting the change.

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hi Kate,

      Thank you for your suggestion.

      I'm not sure if it makes a difference but these orders were stuck in working state.

      Per your suggestion, wouldn't I be able to accomplish the same "speed bump" by adding the entry logic to the OnBarUpdate() method and setting the series to 1 second? Is there any sample of your suggestion in the help guide?

      Comment


        #4
        Hello collic653,

        Thank you for your reply.

        If you're either calculating on bar close (or using IsFirstTickOfBar to only calculate once per bar if using OnPriceChange or OnEachTick), yes, that would probably work fine. If you're calculating on each tick, most likely you'd see the same issue, since you can get large numbers of ticks per second.

        There wouldn't be an example of this in the help guide, unfortunately, but I can see about working up a simple example. I'll work on that and post it when complete.

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hello collic653,

          Thank you for your patience.

          I apologize this took a bit to get working, but the attached example shows how you could use a bool that gets reset when the stop is done changing to keep orders from being modified so often even when updating the order in OnMarketData. This particular example will only function on real time data and may be tested using the Sim101 account.

          Please let us know if we may be of further assistance to you.
          Attached Files
          Kate W.NinjaTrader Customer Service

          Comment


            #6
            Hi Kate,

            No worries at all, I appreciate your work here as always! I believe this is exactly what I am after

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by arvidvanstaey, Today, 02:19 PM
            4 responses
            11 views
            0 likes
            Last Post arvidvanstaey  
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            60 views
            0 likes
            Last Post samish18  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            9 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            18 views
            0 likes
            Last Post traderqz  
            Started by algospoke, 04-17-2024, 06:40 PM
            5 responses
            47 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X