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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    67 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    36 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    60 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    62 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X