Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Reference sample question

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

    #16
    Hi Tom,

    Did you see my previous reply? Let's isolate to one sample at a time. Break down the steps needed to see an issue. If you made changes that make it easier to reproduce in real time, you can attach and will test here.
    Ryan M.NinjaTrader Customer Service

    Comment


      #17
      HI Ryan,

      ok. I'll take one after the other the questions. my biggest problem is with the Reference Samples number 14. Using OnOrderUpdate() and OnExecution() methods to submit protective orders and 16. Using CancelOrder() method to cancel orders.
      when I'd like run real-time gives me constantly errors. as can be see under picture 1 and 2. I've attached only to the original script: TraceOrders, and if (Historical) return; to run only in real time. the script are applicable to NT7. I attached the amended script.
      question: why can give me this error? the problem can be at my PC? occur this at You? I give it on real-time data not only using MR.
      thanks Tom (I hope I didn't ask lot at a time)
      Attached Files
      Last edited by marotom; 06-03-2011, 09:27 AM.

      Comment


        #18
        Hi Tom,

        The basic functionality of those samples is working for me here.
        The message you're getting means that it's submitting at an invalid stop price and is rejected. To track this behavior you can use print statements and trace orders output.

        Check the value of your orders compare to the last traded price. For sell stop orders, they should be below the last traded price.

        If the message always comes on stop loss modification, maybe consider changing CalculateOnBarClose to false. Since it's currently set to true, it may be moving too late then and at an invalid price.
        Ryan M.NinjaTrader Customer Service

        Comment


          #19
          Hello Ryan,

          I've tried to set CalculateOnBarClose to false but accur nothing. I follow your instruction I'll monitor it more painstaking.
          have a nice weekend!

          Comment


            #20
            Hello,

            a short question:
            - the OnOrderUpdate() will immediately update at this time too when I use an entry method in the OnOrderUpdate()? e.g. ExitLong, EnterLong...
            thanks for answer

            Comment


              #21
              Hi Tom,

              Yes, OnOrderUpdate() triggers when ever there is a change in order state. When you submit these orders, OnOrderUpdate is triggered for the first PendingSubmit. You could use something like this to check each time this triggers for an order.

              protected override void OnOrderUpdate(IOrder order)
              {
              Print(order.ToString());
              }
              Ryan M.NinjaTrader Customer Service

              Comment


                #22
                thanks for answer

                Comment


                  #23
                  Hello,

                  could you clarify how does the OnOrderUpdate() work correctly?
                  I print an text within OnOrderUpdate() when the strategy open an position and the OnOrderUpdate() updates, and its name will change. but IOrder state changes will loop 4 times at open position, as can be seen on picture. is it routine procedure? should I calculate with this behavior extra info? what throws it?

                  I attached a picture and the script
                  thanks for answer. Tom
                  Attached Files

                  Comment


                    #24
                    Tom, I would suggest you print the state changes, too since 'the OnOrderUpdate() method is called every-time an order managed by a strategy changes state. An order will change state when a change in order quantity, price or state (working to filled) occurs.'

                    Comment


                      #25
                      thanks. I see.

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      599 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      345 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      103 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      558 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      558 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X