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, 03-31-2026, 09:41 PM
      1 response
      45 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      21 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      31 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X