Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how can I draw text over minute chart bars at the same distance everytime

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

    how can I draw text over minute chart bars at the same distance everytime

    Hi - I am trying to figure out a way to always print text over select bar on a minute chart.. (E.g. I want to print if a candle is engulfing or not, pin-bar or not).. The problem is that when I change the instrument or the even the period (e.g. 3mins to 15mins), then the labels printed are far away from the candle top/bottom or too close to the top/bottom.

    Is there a simple way to consistently print the same distance at the top or bottom of each bar irrespective of the Instrument and chart period ?

    #2
    Hello jpkulkarni,

    To print text at an offset from a bar you could use Draw.Text and supply a price from the bar in question and then use the yPixelOffset​ field to give the text a fixed offset from the bar.

    Draw.Text(NinjaScriptBase owner, string tag, bool isAutoScale, string text, int barsAgo, double y, int yPixelOffset, Brush textBrush, SimpleFont font, TextAlignment alignment, Brush outlineBrush, Brush areaBrush, int areaOpacity)

    Comment


      #3
      Yeah.. I have been using that offset value.. the problem is that offset needs to be different for each instrument and chart period. I am trying to figure out how to keep changing that offset dynamically for selected instrument and period..

      Comment


        #4
        Hello jpkulkarni,

        You may need to add a user input that you can set for each instrument when you apply the script to control that. Each instrument trades at different prices and will have different scale values and compression of the chart so there would not be a way to ensure that there is always a set distance from the bars besides using the y offset.

        You may be able to come up with some general logic to make a dynamic value based on the instrument and timeframes being used. I would not have any specific recommendations on that, you would likely need to experiment to see what works best for the instruments you use and what values you use for the offset to get an idea if an equation could be made to control that.


        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        590 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        342 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        555 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X