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 helpwanted, Today, 03:06 AM
        1 response
        16 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        11 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        6 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        244 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        387 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X