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 ghoul, Today, 06:02 PM
      2 responses
      12 views
      0 likes
      Last Post ghoul
      by ghoul
       
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      44 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      20 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      180 views
      0 likes
      Last Post jeronymite  
      Started by DanielSanMartin, Yesterday, 02:37 PM
      2 responses
      13 views
      0 likes
      Last Post DanielSanMartin  
      Working...
      X