Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

CalculateOnBarClose = false question

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

    CalculateOnBarClose = false question

    I have a strategy attached to a chart. The strategy has CalculateOnBarClose = false;

    When I reference Closes[0][0], sometimes it refers to the open bar and sometimes the bar before the open bar. The reference can be triggered by a button on the chart. i.e. update or from the code on a firstTick/OnBarUpdate event. -- i.e. i have a manual override to calculate the strategy instead of waiting for the next firsttick.

    So the question is, can the Closes[0][0] sometimes refer to an open bar and sometimes the 1st closed bar, given the different sources of the call. Are there any reasons I wouldn't betting getting the open bar at all times with Closes[0][0]?

    Thanks
    Rich

    #2
    Hi Rich,

    It can vary here, depending on whether the bar update is marked as historical. The bar referencing model for multiseries script changes whether you're accessing historically or real time.


    If you get a real time update on Closes[0][0] and are running with COBC = false, then you should generally expect that this refers to the most recent bar - the one currently forming.

    If you access this value in a multiseries script, you should filter within a specific BarsInProgress, so that you're not looking at the value within the context of another series' updates.

    if (BarsInProgress == 0)
    Print(Closes[0][0]);
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by itrader46, Today, 10:22 AM
    0 responses
    11 views
    0 likes
    Last Post itrader46  
    Started by NM_eFe, Today, 10:13 AM
    0 responses
    3 views
    0 likes
    Last Post NM_eFe
    by NM_eFe
     
    Started by hdge4u, Yesterday, 12:23 PM
    1 response
    10 views
    0 likes
    Last Post hdge4u
    by hdge4u
     
    Started by 1001111, Today, 09:45 AM
    0 responses
    11 views
    0 likes
    Last Post 1001111
    by 1001111
     
    Started by DTSSTS, 01-28-2024, 12:07 PM
    11 responses
    559 views
    0 likes
    Last Post bmo111
    by bmo111
     
    Working...
    X