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

  • fx.practic
    replied
    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.

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    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.

    Leave a comment:


  • fx.practic
    replied
    Thank you, Chris.
    Once more question: why RemoveLastBar(), why not UpdateBar() with ability updating Open price?
    Is there any reason for current design?

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    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.

    Leave a comment:


  • fx.practic
    replied
    And what if to RemoveLastBar() without adding new one - does it triggers any events?

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    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

    Leave a comment:


  • fx.practic
    replied
    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....

    ?

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    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.

    Leave a comment:


  • fx.practic
    started a topic RemoveLastBar() vs UpdateBar()

    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?

Latest Posts

Collapse

Topics Statistics Last Post
Started by FrancisMorro, Today, 03:24 AM
0 responses
1 view
0 likes
Last Post FrancisMorro  
Started by Segwin, 05-07-2018, 02:15 PM
10 responses
1,769 views
0 likes
Last Post Leafcutter  
Started by Rapine Heihei, 04-23-2024, 07:51 PM
2 responses
30 views
0 likes
Last Post Max238
by Max238
 
Started by Shansen, 08-30-2019, 10:18 PM
24 responses
943 views
0 likes
Last Post spwizard  
Started by Max238, Today, 01:28 AM
0 responses
10 views
0 likes
Last Post Max238
by Max238
 
Working...
X