Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plot Height (pixels to ticks)

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

    Plot Height (pixels to ticks)

    I am plotting in the price panel and that works fine. Is there any way so I can plot a number of ticks thick rather than pixels.

    Maybe better question is can I convert plot pixels to ticks?

    Cheers

    #2
    Remember that how many pixels per tick or ticks per pixel is a function of the scale - you can drag the price axis scale to expand or compress it, and these change dynamically as the chart is re-rendered.

    So, if you're doing this as a plot thickness, then no, the best you could do is estimate what thickness would be required at the current zoom level, but that's not a good idea.

    If, on the other hand, you're doing it manually in OnRender, you can determine how many pixels there are per tick by using the function chartScale.GetYByValue() and just comparing the Y value in pixels for some price with the Y value of that price plus or minus a tick - the difference in pixels is the height of a tick in pixels. But understand, you could easily zoom out to where there are multiple ticks per pixel so that the difference, or number of pixels per tick, might be zero. You could get the height of a tick in fractional pixels by comparing the GetYByValue for a price with the GetYByValue for that price + 1000 * TickSize, then convert the two answers to float or double, and subtract that instead and divide by 1000.

    I think, though, that this is probably too technical of an answer - the better answer might be, no, don't do it that way unless you're shading a region, and then that's not a plot but something like a rectangle.
    Last edited by QuantKey_Bruce; 03-11-2023, 03:16 PM.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      QuantKey_Bruce

      Many thanks. I was a developer for most of my life so understand the implications of what you have said.

      You are an absolute star!

      Cheers

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      630 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      565 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X