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 CarlTrading, 03-31-2026, 09:41 PM
                    1 response
                    153 views
                    1 like
                    Last Post NinjaTrader_ChelseaB  
                    Started by CarlTrading, 04-01-2026, 02:41 AM
                    0 responses
                    89 views
                    1 like
                    Last Post CarlTrading  
                    Started by CaptainJack, 03-31-2026, 11:44 PM
                    0 responses
                    133 views
                    2 likes
                    Last Post CaptainJack  
                    Started by CarlTrading, 03-30-2026, 11:51 AM
                    0 responses
                    128 views
                    1 like
                    Last Post CarlTrading  
                    Started by CarlTrading, 03-30-2026, 11:48 AM
                    0 responses
                    107 views
                    0 likes
                    Last Post CarlTrading  
                    Working...
                    X