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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    29 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    17 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    9 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    15 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    18 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X