Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Refers to previous bar (close, low or high) when CalculateOnBarClose is set to false

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

    Refers to previous bar (close, low or high) when CalculateOnBarClose is set to false

    Hi,

    I have a doubt in my strategy. I am trying to programm a code with
    CalculateOnBarClose =
    false and make a comparison with the data of previous bar. For example, something like this:

    If currentprice > Close of previous bar then so something

    If I use: if (Close[0]>Close[1]) {...} using this it will refers to the previous tick instead of the close of the previous bar.

    Any help about how to do this?.

    As a clarification, I am trying to enter in the current price of current bar (by using Close[0]) but with some conditions with respect to the previous bars, and not of the previous ticks of the current bar that is what it seems it is happening if I user Close[1] that refers to previous tick, of Close[2] that refers to 2 ticks before the current one of the same bar.

    Thanks in advance.


    #2
    Sangui,

    If I use: if (Close[0]>Close[1]) {...} using this it will refers to the previous tick instead of the close of the previous bar.
    This should not be the case. Close[0] refers to the most current tick, however Close[1] is always the previous bar's close.
    Adam P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    672 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    379 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    111 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    577 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    582 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X