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

RemoveLastBar() vs UpdateBar()

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

    RemoveLastBar() vs UpdateBar()

    Hello.

    I searched across the manuals and forum, but do not catch: why to remove bar, if we can update all it's prices and volume instead?
    fx.practic
    NinjaTrader Ecosystem Vendor - fx.practic

    #2
    Hi fx.practic, thanks for your note.

    RemoveLastBar is used to repaint the open of a bar. UpdateBar is unable to modify the open price.

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

    Comment


      #3
      Thanks a lot, Chris!
      One of the most clear answers ever!

      I
      Am I clearly understand, that AddBar() impact all all scripts, using this bars series:
      1. Triggers OnBarUpdate() for scripts Calculated.OrBarClose.
      2. Increment CurrentBar index.
      3. Set IsFirstTickOfBar to true.
      4. Something else....

      ?
      fx.practic
      NinjaTrader Ecosystem Vendor - fx.practic

      Comment


        #4
        Hi fx.practic, thanks for the follow-up.

        1. Yes, AddBar will trigger the OnBarUpdate method for all scripts running on the bar series.
        2. Yes, AddBar will increment CurrentBar.
        3. AddBar will set IsFirstTickOfBar to true in a Calculate.OnEachTick or Calculate.OnPriceChange script only.

        Kind regards,

        ChrisL
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          And what if to RemoveLastBar() without adding new one - does it triggers any events?
          fx.practic
          NinjaTrader Ecosystem Vendor - fx.practic

          Comment


            #6
            Hi fx.practic, thanks for your reply.

            If one calls RemoveLastBar they are mostly always going to call AddBar right after to update the bar with new values. One would need to make a test script and see exactly what events trigger.

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

            Comment


              #7
              Thank you, Chris.
              Once more question: why RemoveLastBar(), why not UpdateBar() with ability updating Open price?
              Is there any reason for current design?
              fx.practic
              NinjaTrader Ecosystem Vendor - fx.practic

              Comment


                #8
                Hi fx.practic, thanks for your patience.

                UpdateBar() is intended to change values of a bar that change over time and the open price obviously doesn't do this normally. The Renko and LineBreak bars are the only defaults that would need to change their open price. I can submit a feature request to request the ability to change the open price of a bar through UpdateBar.

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

                Comment


                  #9
                  Please, don't.
                  I've just asked to be familiar with general logic.
                  I'd wish to save development resource for something really useful.

                  Thanks again, Chris.

                  fx.practic
                  NinjaTrader Ecosystem Vendor - fx.practic

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Barry Milan, Today, 10:35 PM
                  2 responses
                  8 views
                  0 likes
                  Last Post Barry Milan  
                  Started by WeyldFalcon, 12-10-2020, 06:48 PM
                  14 responses
                  1,428 views
                  0 likes
                  Last Post Handclap0241  
                  Started by DJ888, Yesterday, 06:09 PM
                  2 responses
                  9 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  41 views
                  0 likes
                  Last Post jeronymite  
                  Started by bill2023, Today, 08:51 AM
                  2 responses
                  16 views
                  0 likes
                  Last Post bill2023  
                  Working...
                  X