• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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
    Paul H.NinjaTrader Customer Service

    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 saltminer, Today, 05:19 PM
      0 responses
      3 views
      0 likes
      Last Post saltminer  
      Started by martyn73, Today, 04:18 PM
      0 responses
      2 views
      0 likes
      Last Post martyn73  
      Started by aprendiz, Today, 03:42 PM
      0 responses
      2 views
      0 likes
      Last Post aprendiz  
      Started by 1001111, Today, 09:10 AM
      1 response
      18 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Started by usero86, Today, 06:02 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Working...
      X