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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    56 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X