Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

order state initialized

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

    order state initialized

    Hello. I have code that transitions historical orders to real time.
    However, when iI start the strategy, the "new" historical orders show up as order state "Initialized", instead of Working (I am submitting these to NinjaBrokerage). Do you know why this occurs, and is there anyway for me to change them to Working?

    Thanks

    #2
    additional info

    In particular, this is what the code looks like:

    if (State == State.Realtime)
    {
    foreach(Order o in sellStopList)
    if (o.OrderState == OrderState.Working) GetRealtimeOrder(o);
    }

    Does this do what I think it's supposed to? Or do I need to add an additional line where the "new" order is submitted? To reiterate, what I'm seeing now is that the "old" orders were cancelled but a single new order (which seems to aggregate the old ones) is sitting on my PC in "initialized" status, in color orange.

    Thanks

    Comment


      #3
      Hello stewarco,
      Thanks for your post.

      Can you tell if this is happening for all orders or possibly orders that are Accepted instead of Working?

      What happens if you remove if (o.OrderState == OrderState.Working) and just use

      Code:
      if (State == State.Realtime)
      {
      foreach(Order o in sellStopList)
      GetRealtimeOrder(o);
      }
      Josh G.NinjaTrader Customer Service

      Comment


        #4
        follow up

        Hey Josh. I'll try that.

        1) Am I correct that the only way to test this is to use the Market Playback? If so, I'll need to wait until markets close since I'm using the connection for active strategies at the moment.

        2) Some of the orders in my list will be State = Cancelled or State = Filled. I used the State = Working because I wasn't sure how the GetRealtimeOrder handles orders that are no longer active. Does that pose any problems? I feel as though that may have caused problems for me in the past, though it's quite possible I'm imagining that.

        Thanks

        Comment


          #5
          You can test this on Market Replay or on live data.

          As far as the second part goes I do not believe it will be an issue. The help guide does not specify the order state in the sample so that is how I would approach it.

          Help Guide- Transitioning order references from historical to live
          Josh G.NinjaTrader Customer Service

          Comment


            #6
            last question

            Hey Josh. When you say test on live data, how do I do that exactly? You mean just run the strat real time in a test account?

            Comment


              #7
              Yes, that is correct. Testing on Market Replay or on live data with the SIM101 account should generally accomplish the same thing.
              Josh G.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by DJ888, 04-16-2024, 06:09 PM
              4 responses
              12 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by terofs, Today, 04:18 PM
              0 responses
              7 views
              0 likes
              Last Post terofs
              by terofs
               
              Started by nandhumca, Today, 03:41 PM
              0 responses
              6 views
              0 likes
              Last Post nandhumca  
              Started by The_Sec, Today, 03:37 PM
              0 responses
              3 views
              0 likes
              Last Post The_Sec
              by The_Sec
               
              Started by GwFutures1988, Today, 02:48 PM
              1 response
              9 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Working...
              X