Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Convert text size to ticksize

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

    Convert text size to ticksize

    This may be unsupported but how would I go about converting a textHeight into ticksize units.
    I am measuring 2 text objects and would like to do something if they get too close to each other on the chart.

    #2
    Font has a GetHeight property. also have a peep at measure text http://msdn.microsoft.com/en-us/library/y4xdbe66.aspx

    Comment


      #3
      ok but...

      I want to do something like this


      if(txtHeight > TickSize * 4)

      seems to be measuring apples and pears as the txtHeight is in pixels and the TickSize is in something else.
      Or can I convert Ticksize to pixels?

      Comment


        #4
        i would do something in these lines


        int diff = ChartControl.GetYByValue(BarsArray[0],price) - ChartControl.GetYByValue(BarsArray[0],price - TickSize * 4); //price ia a double

        and then
        if (text suze > diff)
        {
        //do stuff
        }

        Comment


          #5
          simple idea

          Many thanks Bukkan

          Comment


            #6
            GetYByValue

            When I use GetYByValue, I get numbers in the tens of thousands range. I was expecting it to return a pixel measurement of Y. The following code is generating current numbers over 60,000...

            int inty = ChartControl.GetYByValue(BarsArray[0], price);

            Is my understanding wrong?

            Thx.

            Comment


              #7
              BradB,

              Testing the small snippet you provided, I'm getting Y values as expected base on the size of my chart. What double are using for Price?

              While ChartControl is undocumented/unsupported we're happy to help clear up anything we can.
              MatthewNinjaTrader Product Management

              Comment


                #8
                Originally posted by BradB View Post
                When I use GetYByValue, I get numbers in the tens of thousands range. I was expecting it to return a pixel measurement of Y. The following code is generating current numbers over 60,000...

                int inty = ChartControl.GetYByValue(BarsArray[0], price);

                Is my understanding wrong?

                Thx.
                what is the value of "price". the returned value depends on it. replace price with say Close[0] and see if things are right or not.

                Comment


                  #9
                  one question!what happens if you change the resolution?the strategy is destroyed? :\

                  Comment


                    #10
                    Originally posted by Qualitiedx View Post
                    one question!what happens if you change the resolution?the strategy is destroyed? :\
                    with different resolution the real-estate only changes, the logic of the code remains the same.

                    i have the same indi running on 2 pc with different screen resolution. both works fine without code changes.

                    Comment

                    Latest Posts

                    Collapse

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