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

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?
    Chris L.NinjaTrader Customer Service

    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.
        Chris L.NinjaTrader Customer Service

        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.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by josh18955, 03-25-2023, 11:16 AM
            6 responses
            435 views
            0 likes
            Last Post Delerium  
            Started by FAQtrader, Today, 03:35 PM
            0 responses
            3 views
            0 likes
            Last Post FAQtrader  
            Started by rocketman7, Today, 09:41 AM
            5 responses
            18 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by frslvr, 04-11-2024, 07:26 AM
            9 responses
            126 views
            1 like
            Last Post caryc123  
            Started by selu72, Today, 02:01 PM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Working...
            X