Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Painting a Bar based on certain conditions.

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

    Painting a Bar based on certain conditions.

    Hi

    I am new to Ninja Trader and am trying my hand at building some simple indicators. I am trying to change the color of a bar based on certain conditions. I am attaching a copy of my Script below. The script compiles with no errors. When I load the indicator on to a chart, none of the bars are coloured even though I can see quite a few with the conditions that I am looking for. In the log tab, I can see "Its done!!" being printed multiple times.

    What am i missing?

    Thanks and I apologise for the trouble.

    Part of my code:

    //Add your custom indicator logic here.
    if (CurrentBar < 1)
    return;

    // condition: and(C > O, C[-1] < O[-1], O > C[-1], C > O[-1])
    if (Close[0] > Open[0] && Close[1] < Open[1] && Open[0] > Close[1] && Close[0] > Open[1])
    {

    PlotBrushes[0][0] = Brushes.Green; //
    }


    Print("its done!!");

    #2
    sir Please change
    PlotBrushes[0][0] = Brushes.Green​ to BarBrushes[0][0] = Brushes.Green​​

    Comment


      #3
      Thank you so much ajgauss13. Using BarBrushes[0] worked like a charm.

      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