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

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 junkone, Today, 11:37 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post junkone
                    by junkone
                     
                    Started by quantismo, 04-17-2024, 05:13 PM
                    5 responses
                    33 views
                    0 likes
                    Last Post NinjaTrader_Gaby  
                    Started by proptrade13, Today, 11:06 AM
                    1 response
                    5 views
                    0 likes
                    Last Post NinjaTrader_Clayton  
                    Started by love2code2trade, 04-17-2024, 01:45 PM
                    4 responses
                    34 views
                    0 likes
                    Last Post love2code2trade  
                    Started by cls71, Today, 04:45 AM
                    2 responses
                    10 views
                    0 likes
                    Last Post eDanny
                    by eDanny
                     
                    Working...
                    X