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 CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      35 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      198 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      364 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      283 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X