Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 Brevo, Today, 01:45 AM
    0 responses
    2 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    3 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    238 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    9 responses
    384 views
    1 like
    Last Post Gavini
    by Gavini
     
    Started by oviejo, Today, 12:28 AM
    0 responses
    4 views
    0 likes
    Last Post oviejo
    by oviejo
     
    Working...
    X