• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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);
      }
      JoshNinjaTrader 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
          JoshNinjaTrader 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.
              JoshNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Duval, Today, 08:38 AM
              0 responses
              6 views
              0 likes
              Last Post Duval
              by Duval
               
              Started by i2w8am9ii2, 02-13-2019, 04:28 PM
              7 responses
              61 views
              0 likes
              Last Post sledge
              by sledge
               
              Started by woodyfox, Yesterday, 08:33 PM
              0 responses
              7 views
              0 likes
              Last Post woodyfox  
              Started by rblunsom, Yesterday, 11:19 AM
              2 responses
              29 views
              0 likes
              Last Post guidoisot  
              Started by drewski1980, Yesterday, 02:38 PM
              1 response
              22 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Working...
              X