Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

X bars passed

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

    X bars passed

    I am looking through all of the "Bars" in the keyword index to find what I might use for my situation, but I can't seem to find it.

    I want to make sure that there are at least 4 bars that have passed since the previous variable that was defined.

    For example, if I find a swing low that occurred 2 bars ago and I name that "SL1" then I want to make sure that there are at least 4 bars that pass before it starts searching for the next swing low that would be called SL2.

    Could you tell me how I could accomplish this?

    I have looked specifically under BarsPeriod and GetBar but I am not too sure that those are correct.

    #2
    Hello jg123,

    Thank you for your note.

    My recommendation would be when you get the first SL1 would be to store the current bar at that time as well.

    int myStartBar = CurrentBar;

    Then you can compare the Current running bar to the myStartBar when its 4 or greater than

    if(CurrentBar - myStartBar >= 4)
    Cal H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    563 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    329 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    547 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X