Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Seems Market Replay has a bug?

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

    Seems Market Replay has a bug?

    Whenever I have Market Replay running, and my code issues:
    Code:
    if (Account.Orders.Count > 0)
        Account.CancelAllOrders(Instrument);​


    and I wave my mouse in the windows

    the window & replay freezes, the mouse disappears from the window.

    I was using 1000x and Max speeds.

    #2
    Hello Skechers,

    Is this for an Addon?

    If you are using Account like this from a strategy that is not supported, if you want to track orders or cancel orders you need to use the correct strategy based methods for those items.

    Strategy orders can be tracked by using OnOrderUpdate and saving the order to a variable. To cancel an order you can see an example of how to do that here:



    CancelAllOrders would be for scripts that do not have their own account like an indicator or addon: https://ninjatrader.com/support/help...ancelAllOrders


    Comment


      #3
      Not for an AddOn, this is for a strategy.

      I'm closing down a strategy, and calling CancelAllOrders from within OnBarUpdate.

      How should I cancel orders from within OnBarUpdate?

      Many Thanks!

      Comment


        #4
        Hello Skechers,

        You can cancel orders using the method I had linked to in the previous post You can also use CloseStrategy().

        When finding code in the help guide make sure you are looking at the left side navigation, if you are in the addon section that code cannot be used for strategies.

        Comment


          #5
          Ah, got it, I missed it before.

          Many Thanks!

          Comment


            #6
            Read through the code. It looks to cancel one specific order only. I'm wanting to cancel both target and stop loss orders (issue 2 cancels?).

            Meny Thanks.

            Comment


              #7
              Hello Skechers,

              Yes you would need to use 2 cancels in that case and supply the order objects. If you wanted to also terminate the strategy you can instead use CloseStrategy to close open orders and terminate the strategy.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by NullPointStrategies, Today, 05:17 AM
              0 responses
              46 views
              0 likes
              Last Post NullPointStrategies  
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              126 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              66 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              42 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              46 views
              0 likes
              Last Post TheRealMorford  
              Working...
              X