Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Background color (backBrush) on building bar

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

    Background color (backBrush) on building bar

    Hi Guys - A long time since my last post.

    I have a quick question. Can the background color (backBrush) be altered on a building bar on a tick by tick basis ?

    Thanks
    Jerry

    #2
    Hello Jerry,

    Thank you for your note.

    Yes, the background color for a bar could be altered on a tick-by-tick basis as long as the script is set to Calculate.OnEachTick. Here is a snippet that would set the BackBrush to green when the volume is an even number and red when the volume is an odd number:
    Code:
                if (Volume[0] % 2 == 0)
                    BackBrush = Brushes.Green;
                else if (Volume[0] % 2 != 0)
                    BackBrush = Brushes.Red;
                else
                    BackBrush = null;​
    If you add this to OnBarUpdate() in an indicator that is calculated on each tick, you will see the BackBrush change between red and green as the bar is building.

    Please let us know if we may be of further assistance.

    Comment


      #3
      Emily
      Thanks - Saved me a bunch of time.
      Jerry

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      78 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      40 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X