Announcement

Collapse
No announcement yet.

Width (in pixels )of chart...

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

  • Width (in pixels )of chart...

    Hello,

    I was wondering if anyone had come up with a way to figure the width of a chart in pixels?

    The problem: you use drawTextPixel to create a small grid to display some metrics...and get it all set up nice and smart on your desktop...set off to the right of the 'bleeding edge'...on the right side of the chart. Then you put it up on your laptop and the x-axis is all messed up...because the pixel count (for a chart) is different on your laptop than your desktop.

    I can imagine a simple algorithm that would loop from 1 to 'max pixel width' once when the script is initializing but am at a loss when it comes to definite syntax. Anyone know any other keywords that relate to pixels in a chart that might work?

    Any help much appreciated,

    gg

  • #2
    To do precisely what you want, I think you're going to have to create a DLL Object which does the following:

    1. The title of the chart window is going to be the name you saved it under, minus the ".ach" file ending.

    2. When you have the title, you can use the Windows function called FindWindow to locate the window's Windows Handle pointer.

    3. When you have the Handle (aka, HWND), you can get the height and width of the chart window by calling the Windows function GetClientRect.

    [This is something I'm probably going to have to do soon myself for a direct-chart trading project I'm working on.]

    But look, if all of this sounds too complicated, then go the simple route: hard-code your chart widths.

    For your personal use, you KNOW the widths of all of your monitors/screens and how wide you're going to make your charts. So, you just setup an option in your "Edit Studies..." with those known pixel widths and you choose which one the script needs to draw to for the drawPixel-type functions to come out correctly on the screen.

    Easy peasy that way.

    Comment


    • #3
      Yup...will do

      Some functionality seems so self-evident in terms of practicality that you just can't accept (for several hours) that it's implementation should be next to impossible by usual means.

      It's not an excuse but an explanation.

      Thanks Steve,

      gg

      Comment

      Working...
      X