Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

orderstate

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

    orderstate

    Hi,

    I have this in my strategy: "if (entryOrder.OrderState == OrderState.Working <some code> CancelEntryOrder();" as part of an if statement. It's integral to how a setup is detected / cancelled. The problem I'm facing is that I want to run the strategy analyzer and optimize settings. the OrderState.Working is not something that's called in the analyzer. My question is there another way I can have the strategy detect if I have a waiting order and have it be recognized in the analyzer? I'm pretty sure this is also causing the analyzer to crash.

    Cheers,
    Seastragg

    #2
    Hi Seastragg, thanks for your note.

    The order in my test strategy does hit State.Working state. There's something coded incorrectly in the strategy. You can run the script through Visual Studio and it will break when an exception happens. See here for instructions on setting up the custom project:



    Do you get any errors in the log tab of your Control Center when the problem occurs?

    Comment


      #3
      Hi Chris,

      The blue arrow represents where the "OrderState.Working" is (essentially the code waits for a setup then executes a "EnterShortLimit" order somewhere up here
      The red arrow represents where the "CancelEntryOrder(); should occur
      The green arrow represents where a different "CancelEntryOrder(); occurs.


      The red arrow is where the cancel order is supposed to take place when a specific price is hit, and does take place when the strategy is live, but in when it's run historically and in the strategy analyzer, it does not cancel the "order". Instead, in the historical and strategy analyzer, the second green arrow CancelEntryOrder takes over and cancels the order after X number of bars. Is there another command instead of OrderStateWorking I can enter that will see where a waiting order "EnterShortLimit" should be that can be recognized by the analyzer?

      Cheers,
      Seastragg
      Attached Files

      Comment


        #4
        Hi Seastragg, thanks for the follow up.

        The bar period you are using might be too big for the historical fill algorithm to detect a fill. Try setting Order Fill Resolution to High and add a 1 tick or 1 minute series. Run the strategy again after this and see if you get different results.

        I would need to look at a reduced test script to know what exectly is going wrong here.

        Comment


          #5
          Hi Chris,

          I set the order resolution to high and I didn't get any different results. Do you have an email address I can send a snippet to and have you see if what might be going wrong?

          Cheers,
          Seastragg

          Comment


            #6
            Hi Seastragg,

            Please send it to platformsupport at ninjatrader.com and reference "ATTN ChrisL 2350286" in the body of the email.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by NullPointStrategies, Today, 05:17 AM
            0 responses
            50 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
            69 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