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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      40 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      27 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      45 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      37 views
      0 likes
      Last Post CarlTrading  
      Working...
      X