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

On each tick" and "On price change"

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

    On each tick" and "On price change"

    When creating a new strategy, what's the difference between calculating "On each tick" and "On price change"?

    Thanks

    #2
    Hello kiss987,

    Thanks for the post.

    Calculating on each tick will run the OnBarUpdate method on every incoming tick. OnPriceChange will run the OnBarUpdate when the price changes.

    OnPriceChange calculation can improve your PC's performance because you can have multiple incoming ticks and the price can stay the same.

    Here is the help guide page on NinjaScript calculation mode for more details:


    Please let us know if we may be of any further assistance.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      jumping on...

      whats the difference between a strategy that loads a TICK data series and execute per BarsInProrgess =1 and setting the "Calculate on each tick " ?

      Comment


        #4
        anyone please?

        Comment


          #5
          Hello dadarara,

          Thank you for the post.

          Having a 1 tick series and a calculation mode of OnEachTick has the possibility of being redundant since running the script OnBarClose would essentially run OnEachTick because of that 1 tick series.

          Please let me know if I can assist further.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Hello everington_f,

            Thanks for the post.

            I made a test but was unable to reproduce what you are seeing. Could you please export the script and post it here so I can test?

            I look forward to your reply.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              Hello everington_f,

              Thanks for the reply.

              You can use the BarsInProgress index to know the context of the OnBarUpdate (Which series OnBarUpdate is being called for).

              Code:
               protected override void OnBarUpdate()
                      {
                          if(BarsInProgress == 0)
                          {
                              Print("Primary series OnBarUpdate called");
                          }
              
                          if(BarsInProgress == 1)
                          {
                              Print("1019 Minute series OnBarUpdate called");
                          }
                      }
              Please let me know if this does not resolve your inquiry.
              Chris L.NinjaTrader Customer Service

              Comment


                #8
                Thanks for the tips! Works just fine now.
                ________________________________
                Transfer Pricing Consultants
                Last edited by Marius Titulescu; 10-24-2019, 06:51 AM.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Irukandji, Yesterday, 02:53 AM
                2 responses
                17 views
                0 likes
                Last Post Irukandji  
                Started by adeelshahzad, Today, 03:54 AM
                0 responses
                3 views
                0 likes
                Last Post adeelshahzad  
                Started by CortexZenUSA, Today, 12:53 AM
                0 responses
                3 views
                0 likes
                Last Post CortexZenUSA  
                Started by CortexZenUSA, Today, 12:46 AM
                0 responses
                1 view
                0 likes
                Last Post CortexZenUSA  
                Started by usazencortex, Today, 12:43 AM
                0 responses
                5 views
                0 likes
                Last Post usazencortex  
                Working...
                X