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 BarzTrading, Today, 07:25 AM
      2 responses
      27 views
      1 like
      Last Post BarzTrading  
      Started by devatechnologies, 04-14-2024, 02:58 PM
      3 responses
      20 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by tkaboris, Today, 08:01 AM
      0 responses
      6 views
      0 likes
      Last Post tkaboris  
      Started by EB Worx, 04-04-2023, 02:34 AM
      7 responses
      163 views
      0 likes
      Last Post VFI26
      by VFI26
       
      Started by Mizzouman1, Today, 07:35 AM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X