Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

65,535 unique BackBrush instance clarification needed

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

    65,535 unique BackBrush instance clarification needed

    The guide writes: You may have up to 65,535 unique BackBrush instances.
    But it doesn't clarify the domain.

    1. Per indicator instance?
    2. Per chart (basically per UI thread)
    3. Globally within NinjaTrader8?

    Since it affects all Brushes the question is even more so:
    How exactly does this limitation work?
    Last edited by Zapzap; 01-15-2021, 04:27 AM.

    #2
    Hello Zapzap,

    Thanks for your question.

    This is applicable per NinjaScript instance. If we have a script that creates too many WPF brushes, and then add another indicator which creates custom brushes within the limit, the added indicator which is within the limit can still use its custom brushes and we can see them on the chart.

    I had tested with an indicator that is know to bust the limit and then I have added another simple test indicator that adds the following in State.Realtime. "myBrush" is a private Windows.Media.Brush.

    else if (State == State.Realtime)
    {
    myBrush = new SolidColorBrush(Color.FromArgb((byte)255, (byte)255, (byte)255, (byte) 255));
    myBrush.Freeze();
    BackBrush = myBrush;
    }

    The script I tested which busts the brush limit can be found here - https://ninjatrader.com/support/foru...ate-oneachtick

    We look forward to assisting.

    Comment


      #3
      Thank you Jim, I reached basically the same conclusion:

      You can create as many Brush instances as you want, but a given NinjaScript instance can only plot/show/draw/use 256*256 different Brush objects as BackBrush/BarBrush/Cande Brushes/BrushSeries.

      Interesting limitation (I wonder why not 256*256*256), but oh well I accept you somehow need to limit the endlessly created Brushes.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      80 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