Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Candle Stick: Label on top or bottom

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

    Candle Stick: Label on top or bottom

    Guys, I am creating a indicator that counts Legs (Al Brooks Price Action). So far so good, I was able to create it. now I am polishing some details. One challenge I am facing is when plotting the label above or below the bar, if I change the time frame its gets too far or too close often time in higher time frames getting over the bar. Is there better way to correctly place text that will be responsive independently of the Time frame. This is what I am doing:

    Code:
    y = High[bar] + (3 * TickSize);
    Draw.Text(this, tag, true, text, bar, y, 0, brush, new SimpleFont("Arial", 20), TextAlignment.Center, Brushes.Transparent, Brushes.Transparent, 100);
    I saw a parameter after, Y that I could use, its a offsetY. But not sure how to get the time frame or how make some sort of calculation to add to the offset

    Thank you

    #2
    Hello amfpaulo,

    You can get the bar type and interval from the BarsPeriod.

    Below is a link to the help guide.


    The BarsPeriod.BarsPeriodType is the bar type, while BarsPeriod.Value is the interval.

    The calculation would be up to you.
    But you could do something like:

    private int offsetY;

    if (BarsPeriod.Value == 10)
    offsetY = 5;
    else if (BarsPeriod.Value == 15)
    offsety = 7;

    y = High[0] + offsetY;
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thank you It helped, however I think I need to use another logic, before I start. Do you have any insight for the off set when bars change size drastically due to a very big bar or zoom ? How to keep things responsive ?

      Comment


        #4
        Hello amfpaulo,

        You can check the High[0] - Low[0] is greater than a number of ticks.

        if ((High[0] - Low[0]) / TickSize > 5)
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Cool. Thank you . I'll try this

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          558 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          324 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          545 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          547 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X