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

last bar of entire session

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

    last bar of entire session

    Hi,

    how to recognize that it is the last bar of the entire chart in historical backtesting (real time is obvious to me) on a chart in strategy code ? For example if it is the last bar I would like to print some statistics, but only if it is the last bar so that the computer would not eat up resources without purpose making the running even slower.

    best regards
    Kittyan

    #2
    Hello Kittyan,

    You can work with CurrentBar in relation to Count to identify this.

    When CalculateOnBarClose = true:
    if (Count - 2 == CurrentBar)

    When CalculateOnbarClose = false;
    if (Count - 1 == CurrentBar)
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by devatechnologies, 04-14-2024, 02:58 PM
    3 responses
    19 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by tkaboris, Today, 08:01 AM
    0 responses
    1 view
    0 likes
    Last Post tkaboris  
    Started by BarzTrading, Today, 07:25 AM
    1 response
    11 views
    1 like
    Last Post NinjaTrader_Clayton  
    Started by EB Worx, 04-04-2023, 02:34 AM
    7 responses
    161 views
    0 likes
    Last Post VFI26
    by VFI26
     
    Started by Mizzouman1, Today, 07:35 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Working...
    X