Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Options to define value for the x-axis

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

    Options to define value for the x-axis

    There are some options for the Y-axis regarding its values and options when I want to draw for example a rectangle.

    The options for the X-axis however seem to be limited to e.g. 5 (bars ago) to 0 (current bar). Are there some other options? Like to that bar in the past which had a High or Low? If so, can you point out where I can find more about that.

    sandman

    #2
    Hello sandman,

    Are you referring to the DrawRectangle() method?

    Below is a public link to the help guide.


    For selecting the X axis (the time axis) this method accepts a barsAgo integer or a DateTime.

    You would need to calculate the number of bars ago the highest high has occured.

    For example:

    int highestHighBarsAgo = HighestBar(High, Bars.BarsSinceSession - 2);
    if (CurrentBar - highestHighBarsAgo + 2 < 1)
    return;
    DrawRectangle("myRectangle", highestHighBarsAgo, Low[highestHighBarsAgo], highestHighBarsAgo + 2, High[highestHighBarsAgo], Color.Blue);

    This would find the bars ago value of the highest high on the chart, ensure that there are at least 2 bars before this bar, and then draw a rectangle from 2 bars previous to the highest bar to the highest bar on the X axis and from the low of the bar that this the highest bar to the high of the highest bar on the Y axis (price axis).
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    574 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    332 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
    553 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    551 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X