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

How to write text in an indicator that is compatible with skins?

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

    How to write text in an indicator that is compatible with skins?

    Hi there,

    We a building an add-on and have been very careful to ensure that all our panels and windows are compatible with skins, by inheriting our styles we bind to our WPF elements from styles in the BluePrint.xaml.

    We are now wanting to write some text in an indicator. The biggest issue we have with skin compatibly here is text color. If the text is the same or close to the same color as the skins chart background color, it is either impossible or very difficult to see.

    We have used the RenderTarget.DrawTextLayout method to write the text on the chart from the indicator, passing it a SharpDX.DirectWrite.TextLayout, and SharpDX.Direct2D1.Brush objects.

    The text color is set by the SharpDX.Color object that gets passed to the SharpDX.Direct2D1.Brush.

    The only way I can see to make this compatible with skins at the moment is to somehow get/create a reference to an instance of the FontLabelBrush from the BluePrint.xaml and access it's Color values and use then to create a SharpDX.Color object of the same color.

    Questions:

    - Is this the best way to write skin compatible text on the chart, or is there an easier way to do it?

    - Do you have a code sample of how to do this?

    Thanks for your time.

    #2
    Hello codeowl,

    Thank you for your post.

    There would not be a means to pass the brush to the indicator from the Skin and would either be best to use a condition to check the Skin or much more simply use the ChartControl.Properties.ChartText brush which is the chart's configured color/brush for the text on the chart.

    For example:
    Code:
    Brush textBrush = ChartControl.Properties.ChartText;
    ChartControl.Properties: https://ninjatrader.com/support/help...properties.htm

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Perr0Grande, Today, 08:16 PM
    0 responses
    2 views
    0 likes
    Last Post Perr0Grande  
    Started by elderan, Today, 08:03 PM
    0 responses
    4 views
    0 likes
    Last Post elderan
    by elderan
     
    Started by algospoke, Today, 06:40 PM
    0 responses
    10 views
    0 likes
    Last Post algospoke  
    Started by maybeimnotrader, Today, 05:46 PM
    0 responses
    9 views
    0 likes
    Last Post maybeimnotrader  
    Started by quantismo, Today, 05:13 PM
    0 responses
    7 views
    0 likes
    Last Post quantismo  
    Working...
    X