Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Colour bars based off bar high/low

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

    Colour bars based off bar high/low

    Hi there,

    I would like to apply the below rules to colour each of the bars in a chart. Is it possible to do this somehow in NT7? (please see screenshot).

    If Bar HIGH < (ie below) SMA10 --> make bar green
    If Bar LOW > (ie above) SMA10 --> make bar red
    For anything else --> make bar grey

    Thanks,
    Michelle
    Attached Files

    #2
    Hello michellepace,

    Thanks for your post.

    Yes, this is possible through Ninjascript programming. Here is an example using your example:

    if (High[0] < SMA(10)[0])
    {
    BarColor = Color.Green;
    }
    else if (Low[0] > SMA(10)[0])
    {
    BarColor = Color.Red;
    }

    else
    {
    BarColor = Color.Gray;
    }

    References:

    http://ninjatrader.com/support/helpG.../?barcolor.htm

    Comment


      #3
      Great, thanks Paul. Your code worked perfectly - I just had to swap the green and red around as I got it incorrect in the description of my requirement.

      In case anyone else ever needs this, attached is the indicator script I wrote. You can specify what Period of SMA you want to use.

      Basically if the bars are green you know you're bullish trending up, if red then bearish trending down and grey is neutral.

      Cheers,
      Michelle
      Attached Files

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      557 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      324 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
      545 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X