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 Hwop38, 05-04-2026, 07:02 PM
    0 responses
    155 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    307 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    244 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    346 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    176 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Working...
    X