Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Shansen, 08-30-2019, 10:18 PM
      25 responses
      949 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by JonesJoker, 04-22-2024, 12:23 PM
      8 responses
      41 views
      0 likes
      Last Post JonesJoker  
      Started by timko, Today, 06:45 AM
      0 responses
      3 views
      0 likes
      Last Post timko
      by timko
       
      Started by Waxavi, 04-19-2024, 02:10 AM
      2 responses
      39 views
      0 likes
      Last Post poeds
      by poeds
       
      Started by chbruno, Yesterday, 04:10 PM
      1 response
      44 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X