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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    50 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    16 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    22 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X