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 TickSize to Pixels

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

    Convert TickSize to Pixels

    When Drawing lines in Panel1 , I use "n*TickSize " as on Offset from price to determine the "Y' value.

    When using this approach I get Lines that are closer or further away from price, as the Y scale Changes, or when the indicator is applied to a chart with a different TickSize.

    I could make things more consistent if I could place Lines by a Pixel Offset, say 6 pixels, from a price value. So if on a given chart, 1 Tick (TickSize) is equivalent to 12 pixels then to draw 6 pixels off Price I could use "6/12*TickSize" as the offset . Then, later on that chart, as price action changes a single Tick might be 30 pixels. Then in placing Lines I would use "6/30*TickSize" as the Offset in both cases placing lines at 6 pixels from price.

    ChartControl.Height will give # of pixels for the Entire Chart window. If I could get the # of pixels in just the pricePanel, and the Max&Min Prices displayed there then I could calculate the "pixels/Tick".

    Question:
    Can I do this?
    Is there another (better) way.

    #2
    This is currently not supported.
    RayNinjaTrader Customer Service

    Comment


      #3
      It might be possible to "capture" the min and max values by means of overriding the Plot(...) method. Check out the CustomPlotSample indicator.

      Comment


        #4
        It doesn't sound like a good practice to save values from the Plot method to be used in OnbarUpdate, as the values you're talking about are likely to rescale depending on the y-axis range of values, so my gut feeling is that this isn't always going to produce the desired effect.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by f.saeidi, Today, 08:01 PM
        0 responses
        2 views
        0 likes
        Last Post f.saeidi  
        Started by Rapine Heihei, Today, 07:51 PM
        0 responses
        3 views
        0 likes
        Last Post Rapine Heihei  
        Started by frslvr, 04-11-2024, 07:26 AM
        5 responses
        96 views
        1 like
        Last Post caryc123  
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        49 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Working...
        X