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 NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      54 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      71 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X