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 DayneSwift, Today, 11:06 PM
      0 responses
      2 views
      0 likes
      Last Post DayneSwift  
      Started by AidanLawrence, Today, 10:03 PM
      0 responses
      2 views
      0 likes
      Last Post AidanLawrence  
      Started by butt_toast, Today, 09:47 PM
      0 responses
      1 view
      0 likes
      Last Post butt_toast  
      Started by GaryOz, Today, 06:54 PM
      0 responses
      4 views
      0 likes
      Last Post GaryOz
      by GaryOz
       
      Started by 2inthebush, Today, 06:27 PM
      0 responses
      22 views
      0 likes
      Last Post 2inthebush  
      Working...
      X