Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Keep BarBrush colors over time

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

    Keep BarBrush colors over time

    Hi-

    I have created the code below code that changes the bar color depending on how signal1 and signal2 below work inside OnBarUpdate().

    My issue is that this is working perfect on the current candle but as soon as it closes, the old bar goes back to the default color.

    How do I keep the color on all the old bars?

    Thanks in advance!

    if (signal1[0]==1)
    {
    BarBrushes[0]=Brushes.Red;
    }
    else if (signal2[0]==1)
    {
    BarBrush=Brushes.LimeGreen;
    }
    else
    {
    BarBrush=Brushes.Gray;
    }


    #2
    Hello aarons34,

    I would expect the last brush update for that bar to remain.

    Attached is an exported test script. (I recommend providing an export of reduced test script, or output from prints, anytime you are trying to show someone something)

    Also attached is a screenshot showing that changing the bar color persists and does not change back.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Chelsea-

      Thank you very much. This was driving me crazy until I finally figured I had an indicator active on the chart I was testing my script so the other indicator was overriding what I was doing.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      65 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      139 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      75 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      50 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X