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

Letters automatically adjusted to screen

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

    Letters automatically adjusted to screen

    I have created a proprietary Market Profile indicator and I would like to adjust the letters size AUTOMATICALLY to the screen display as we play with x and y axis shrinking or enlarging the chart.

    Is there a conventional way to do this in code ?


    Thank you

    #2
    Hello blar58,

    Thanks for your inquiry.

    You could use a variable for your font size and then use ChartScale.Height and ChartScale.Width to create ratios to scale your font size.

    I would recommend comparing the difference between MinValue and MaxValue (MaxMinusMin) with ChartScale.Height to scale on the Y-axis, and to compare how many bars are visible on the chart to ChartScale.Width for the X-axis.

    The number of bars visiable on a chart can be found by looping through ChartBars.FromIndex to ChartBars.ToIndex.

    Documentation on the items discussed can be found below.


    Please let me know if I can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      I have a difficult time figuring out how to calculate that ratio to apply the right font size

      When the Y axis is small and X axis is large I don't know how a font size would be able to fit the space.

      Comment


        #4
        Hello blar58,

        Using both the Y and X axis would be difficult for font size for that reason. It is my opinion that it would be easier to leave font size to the Y axis and to use the X axis for how many characters are visible with your text.

        One idea I can think of for your main goal would be to check if both the Y axis and the X axis are within an acceptable range to allow increasing the font size. One will have to be the minimum.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ghoul, Today, 06:02 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        44 views
        0 likes
        Last Post jeronymite  
        Started by Barry Milan, Yesterday, 10:35 PM
        7 responses
        20 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by AttiM, 02-14-2024, 05:20 PM
        10 responses
        180 views
        0 likes
        Last Post jeronymite  
        Started by DanielSanMartin, Yesterday, 02:37 PM
        2 responses
        13 views
        0 likes
        Last Post DanielSanMartin  
        Working...
        X