Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Straightforward CompleteBar

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

    Straightforward CompleteBar

    There should be a simple int property called CompleteBar just like CurrentBar - it should be equal to the latest COMPLETE bar. In State.Historical before the last bar, and when Calculate == Calculate.OnBarClose, this would be equal to CurrentBar. If it's intrabar updating and on the last bar and the last bar isn't closed yet, it would be equal to CurrentBar - 1. This change would be simple and easy to deliver, yet would make NinjaTrader programming more accessible to new users.

    It would also be helpful to define an int property CompleteBack = CurrentBar - CompleteBar.

    This would lead to easy to read and easy to code solutions like:

    Code:
    if (CompleteBar < 0) return;
    double SMACompleteValue = SMA(Close, 50)[CompleteBack];
    Last edited by QuantKey_Bruce; 05-31-2023, 01:52 PM.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    #2
    Hello Bruce,

    Thank you for your post.

    We already have pages in the help guide that explain how to reference the correct bar and also how to make sure you have enough bars in the data series you are accessing that aim to cover the differences and caveats of CurrentBar indexes and barsAgo indexes. These pages can serve as resources for new users to gain a better understanding of how bar indexing works in NinjaTrader, and of course if they have questions they may reach out to support.

    What you have proposed could certainly be added to scripts manually if desired, though since CompleteBar and CompleteBack are based on calculations from CurrentBar they are really just concepts that are derived from CurrentBar and adding them in to the NinjaScript library could be considered extraneous or redundant. Additionally, some bars support the Bars.PercentComplete property already which could also be used in certain scenarios to check when a bar is completed or not.

    You mentioned that these changes would make NinjaTrader programming more accessible to new users. Are there any additional use cases where this would be beneficial to add? If it is just for the sake of making bar indexing easier to explain to new users and demonstrate the differences between processing OnBarClose vs. OnPriceChange or OnEachTick then it sounds like it may be more beneficial to just additional explanations/examples to our help documentation rather than making these official properties added to the NinjaScript library.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Emily View Post
      If it is just for the sake of making bar indexing easier to explain to new users and demonstrate the differences between processing OnBarClose vs. OnPriceChange or OnEachTick [...]
      Yes, that is precisely why this would be helpful, except that they don't want the differences demonstrated or to go read a long section of the help trying to teach them about details immaterial to their task, they just want to get work done, and often the work involves, in part, some complete bar calculations in an intrabar indicator or strategy. These properties, if added, would make it easier for them to get straight to work.

      This isn't for me. I know how to do these things. I'm attempting to make suggestions that will help you reach a broader audience easily and show them they can do meaningful work on NinjaTrader before they get frustrated and wander off.
      Bruce DeVault
      QuantKey Trading Vendor Services
      NinjaTrader Ecosystem Vendor - QuantKey

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by fx.practic, 10-15-2013, 12:53 AM
      5 responses
      5,404 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Started by Shai Samuel, 07-02-2022, 02:46 PM
      4 responses
      95 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Started by DJ888, Yesterday, 10:57 PM
      0 responses
      7 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by MacDad, 02-25-2024, 11:48 PM
      7 responses
      159 views
      0 likes
      Last Post loganjarosz123  
      Started by Belfortbucks, Yesterday, 09:29 PM
      0 responses
      8 views
      0 likes
      Last Post Belfortbucks  
      Working...
      X