Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

nbarsup / nbarsdown not working as expected

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

    nbarsup / nbarsdown not working as expected

    I've been trying to get these two indicators to work in a strategy (using strategy builder), but they don't seem to trigger as expected. Here, as a test, I'm trying to get it to draw a green vertical line on the chart every time there are three green bars in a row. The plot along the bottom shows that it's identifying some, but not all, instances of three green bars in a row. In the same range, though, it only triggered drawing the vertical green line one time. What am I missing here? I've tried a bunch of different settings for this indicator with similar results.
    Attached Files

    #2
    Hello pantherito,

    Thank you for your post.


    Based on what I see in your screenshot, it appears that all parameters for NBarsUp are currently set to true.

    When all three parameters are set to true, the indicator will trigger only if there are three consecutive bars that not only close higher than they open but when both their highs and lows increase consecutively. This stricter set of conditions excludes cases where there are three green bars, but both their highs and lows are not higher consecutively.
    • higherHigh: Requires consecutive higher highs;
    • higherLow: Requires consecutive higher lows
    If your goal is to capture three consecutive green bars, regardless of how their highs and lows behave, you may simply compare the close and open values for bars in the conditions rather than use NBarsUp.

    Here is what the condition would look like (index values are barsago):
    • if (Close[0] > Open[0] && Close[1] > Open[1] && Close[2] > Open[2])
    Please let me know if I may be of any further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    25 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    121 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    64 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    41 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X