Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

reset NBarsUp / NBarsDown

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

    reset NBarsUp / NBarsDown

    Hello
    this is an example

    Code:
    // OnBarUpdate method
    protected override void OnBarUpdate()
    {
    // Evaluates if we have 3 consecutive higher closes
    double value = NBarsUp(3, true, true, true)[0];
    
    if (value == 1)
    Print("We have three consecutive higher closes");
    }​
    For instance, if we have a sequence of 6 consecutive bars (1, 2, 3, 4, 5, 6), the script would detect subsequences bars like 123, 234, 345, and 456.
    I would like the counter to reset after the initial detection 123.


    I genuinely appreciate the time you dedicate to helping us.

    #2
    Hello aekzof,

    I am not sure I understand the question as it was written, can you try to rephrase the question?

    The NBarsUp simply returns true or false by using 1 or 0 if the bars in the range are up bars based on the settings given. If you wanted to do some other action based on that you would need to make a condition using that value.

    Comment


      #3
      Thank you for your response.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      477 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      317 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      256 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      340 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      308 views
      0 likes
      Last Post CarlTrading  
      Working...
      X