Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Above or below Plot

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

    Above or below Plot

    Above or below Plot

    Hello everyone, I have a code

    Values[0][0] = SomePrice;

    if (Close[0] < Values[0][0])
    {
    BarBrushes[0] = Color1;
    }

    This code color all bars when the line crosses.

    How do I make only one bar color that crosses the line?

    #2
    Hello memonolog,

    Thanks for your post.

    In order to only color the bar on the cross, you will have to change the condition to evaluate. Currently, your condition would remain true as long as the close price is less than the plot.

    There are a couple of ways to determine a cross:

    Use the CrossAbove, CrossBlow methods: https://ninjatrader.com/support/help...crossabove.htm https://ninjatrader.com/support/help...crossbelow.htm

    or Change your condition to test if the previous bar was above (or below) the plot (which is what the crossAbove and crossbelow methods actually do):

    if (Close[0] < Values[0][0] && Close[1] > Values[0][1]) // crossbelow
    {
    BarsBrush = Color1;
    }

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    574 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    333 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    553 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X