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 judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    53 views
    0 likes
    Last Post DynamicTest  
    Started by ScottWalsh, Today, 06:52 PM
    4 responses
    33 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Today, 07:39 PM
    0 responses
    5 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Today, 03:01 PM
    2 responses
    19 views
    0 likes
    Last Post helpwanted  
    Started by cre8able, Today, 07:24 PM
    0 responses
    6 views
    0 likes
    Last Post cre8able  
    Working...
    X