• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 martyn73, Today, 08:56 AM
    0 responses
    1 view
    0 likes
    Last Post martyn73  
    Started by TazoTodua, Today, 06:16 AM
    0 responses
    5 views
    0 likes
    Last Post TazoTodua  
    Started by adsjons, Today, 03:41 AM
    0 responses
    3 views
    0 likes
    Last Post adsjons
    by adsjons
     
    Started by bubblegum, Today, 01:02 AM
    0 responses
    9 views
    0 likes
    Last Post bubblegum  
    Started by RB104, Yesterday, 06:06 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ShawnB  
    Working...
    X