Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help editing an indicator

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

    Help editing an indicator

    I want to change the font used by an indicator which draws fixed text on the chart, the problem is I cannot find a single reference anywhere in the code to the font or the text size. The font it's drawing is too big.

    The code that draws the text is this:

    OnRender()
    protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
    {
    if(!ViewText || State < State.Realtime)
    {
    return;
    }

    if(chartControl == null || chartScale == null || ChartBars == null)
    {
    return;
    }

    base.OnRender(chartControl, chartScale);

    Text = String.Format(
    "Count: {0} Width: {1} Space: {2}",
    ChartBars.ToIndex - ChartBars.FromIndex + 1,
    chartControl.BarWidth.ToString("0.00"),
    chartControl.Properties.BarDistance.ToString("0.00 ")
    );

    Draw.TextFixed(this, "ZoomReset_Text", Text, Positioner);
    }
    endregion


    If I create a simple font and then add more parameters to Draw.TextFixed such as the Brushes.Color I get an error saying:

    brushes do not exist in this context​

    #2
    Hello several,

    Thank you for your post.

    You should be able to use the following syntax to specify a font and font size for Draw.TextFixed():

    Draw.TextFixed(NinjaScriptBase owner, string tag, string text, TextPosition textPosition, Brush textBrush, SimpleFont font, Brush outlineBrush, Brush areaBrush, int areaOpacity)



    Specify a SimpleFont object to use that has defined your font and font size.



    I was able to achieve this in an indicator script from within OnRender. Please see the attached test script.

    Attached Files

    Comment


      #3
      Hello, thanks for the reply. I already tried exactly this before I made the post and it gives the error 'brushes do not exist in this context​'​. It does not seem to like the use of Brushes.Color

      This is the indicator.

      https://ninjatraderecosystem.com/use...%20the%20chart.

      Comment


        #4
        You're missing the using statement in order to use Brushes.

        using System.Windows.Media;

        Comment


          #5
          ah perfect thanks

          Comment

          Latest Posts

          Collapse

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