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 rjbtrade1, 11-30-2023, 04:38 PM
    2 responses
    72 views
    0 likes
    Last Post DavidHP
    by DavidHP
     
    Started by suroot, 04-10-2017, 02:18 AM
    5 responses
    3,021 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by Stanfillirenfro, Today, 07:23 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by cmtjoancolmenero, Yesterday, 03:58 PM
    2 responses
    22 views
    0 likes
    Last Post cmtjoancolmenero  
    Started by olisav57, Yesterday, 07:39 PM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X