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

Events Order

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

    Events Order

    When an order was filled, what will be the order of the following events:

    OnExecution
    OnOrderUpdate
    OnBarUpdate (CalculateOnBarClose= false)

    Thanks

    #2
    Originally posted by kiss987 View Post
    When an order was filled, what will be the order of the following events:

    OnExecution
    OnOrderUpdate
    OnBarUpdate (CalculateOnBarClose= false)

    Thanks
    Depends on if you are live or in Market Replay.

    In Market Replay, OnBarUpdate doesn't happen until the others.
    But in live - OnBarUpdate keeps happening until the others have happened.

    So put in some Print() statements and you will see.

    Comment


      #3
      Sledge is correct. The OnBarUpdate() method would be called when a bar updates. If the execution report comes in during a bar update it will wait until the bar update is complete and then the OnOrderUpdate() method will be called followed by the OnExecution() method.

      Comment


        #4
        Originally posted by sledge View Post
        Depends on if you are live or in Market Replay.

        In Market Replay, OnBarUpdate doesn't happen until the others.
        But in live - OnBarUpdate keeps happening until the others have happened.

        So put in some Print() statements and you will see.
        What does it mean in subservient English?

        Comment


          #5
          Originally posted by outsource View Post
          What does it mean in subservient English?
          In Market Replay - orders are filled instantly, OnPositionUpdate fires before OnBarUpdate.
          In the real world - order are not filled instantly, OnBarUpdate keeps processing, and at some point OnPositionUpdate fires when there's a position.

          I had to rework my logic - my strategy was running other sections of code (which would turn off those section of code) and when I hit target/stopped out - it thought the logic had already processed because of the flag - but it wasn't in reality..so my strategy just sat there....

          Comment


            #6
            Originally posted by sledge View Post
            In Market Replay - orders are filled instantly, OnPositionUpdate fires before OnBarUpdate.
            In the real world - order are not filled instantly, OnBarUpdate keeps processing, and at some point OnPositionUpdate fires when there's a position.

            I had to rework my logic - my strategy was running other sections of code (which would turn off those section of code) and when I hit target/stopped out - it thought the logic had already processed because of the flag - but it wasn't in reality..so my strategy just sat there....
            Does COBC=false/true matter in this sense?How does it behave in live and replay?Though I set it to true,my strategy fires the signals intra ba on replay.Would that be the same real time?

            Comment


              #7
              Originally posted by outsource View Post
              Does COBC=false/true matter in this sense?How does it behave in live and replay?Though I set it to true,my strategy fires the signals intra ba on replay.Would that be the same real time?
              I run with FALSE.

              If it was TRUE - it would be different depending on your time frame... 5 second charts? Would your strategy fill in 5 seconds? Probably... But maybe not.

              Are you using market orders? (I am).

              Sounds like you are using limit orders?

              Comment


                #8
                Originally posted by sledge View Post
                I run with FALSE.

                If it was TRUE - it would be different depending on your time frame... 5 second charts? Would your strategy fill in 5 seconds? Probably... But maybe not.

                Are you using market orders? (I am).

                Sounds like you are using limit orders?

                It fills instantly.I don't know in what second exactly.I use market orders.

                Another thing is that I call two different signal from one indicator and need one to be on close true and another false.Is that possible?

                Comment


                  #9
                  Originally posted by outsource View Post
                  It fills instantly.I don't know in what second exactly.I use market orders.

                  Another thing is that I call two different signal from one indicator and need one to be on close true and another false.Is that possible?
                  No idea. I don't have that situation.

                  Comment


                    #10
                    Originally posted by sledge View Post
                    No idea. I don't have that situation.
                    Use a secondary time frame of 1-tick, or 1-Range. I actually use 1-Second for the simple reason that that is the granularity of the data.

                    My math taught me long ago that I cannot be more accurate than my data, so why bother to overload my system with a 1-tick series when my data accuracy is 1-second? But do as thou wilt.

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by andrewtrades, Today, 04:57 PM
                    1 response
                    8 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Started by chbruno, Today, 04:10 PM
                    0 responses
                    6 views
                    0 likes
                    Last Post chbruno
                    by chbruno
                     
                    Started by josh18955, 03-25-2023, 11:16 AM
                    6 responses
                    436 views
                    0 likes
                    Last Post Delerium  
                    Started by FAQtrader, Today, 03:35 PM
                    0 responses
                    7 views
                    0 likes
                    Last Post FAQtrader  
                    Started by rocketman7, Today, 09:41 AM
                    5 responses
                    19 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Working...
                    X