Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

QUESTION: AddPlot Stroke Brushes colors and SharpDX.Color

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

    QUESTION: AddPlot Stroke Brushes colors and SharpDX.Color

    Hi,

    while trying to translate for NT8

    Code:
    Add(new Plot(Color.Blue, PlotStyle.Line, "MyPlot"));
    I'm suggested from https://ninjatrader.com/support/help...ml?addplot.htm to write:
    Code:
    AddPlot(new NinjaTrader.Gui.Stroke(System.Windows.Media.Brushe s.Blue), PlotStyle.Line, "MyPlot");
    ​​at the same time in the example file Custom\Indicators\@SampleCustomRender.cs we learn that to create a brush from System.Windows.Media.Brushes,
    like is done over there,
    Code:
    AreaBrush = System.Windows.Media.Brushes.DodgerBlue;
    ...
    areaBrushDx = areaBrush.ToDxBrush(RenderTarget);
    is less efficient than creating it directly from SharpDX
    Code:
    SharpDX.Direct2D1.SolidColorBrush customDXBrush = new SharpDX.Direct2D1.SolidColorBrush(RenderTarget, SharpDX.Color.DodgerBlue);

    so at this point I would expect the following code to be working and be more efficient

    Code:
    AddPlot(new NinjaTrader.Gui.Stroke(System.Windows.Media.Brushe s.Blue), PlotStyle.Line, "MyPlot");
    ​
    But this doesn't compile. with error message:
    Argument 1: cannot convert from 'SharpDX.Color' to 'NinjaTrader.Gui.Stroke',CS1503
    Am I running into some sort of confusion, could you please clarify me?
    Thank you

    #2
    Hello giogio1,

    A SharpDX brush can only be used in the context of OnRender() and cannot be used in other methods like OnStateChange().

    However, are you sure that line of code is what is causing an issue?
    System.Windows.Media.Brushes.Blue is not a SharpDX brush.

    A screenshot of the error message and line referred to in the error message may be helpful.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you. I believe you answered me.


      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      562 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      325 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      547 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X