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 r68cervera, Today, 05:29 AM
    0 responses
    2 views
    0 likes
    Last Post r68cervera  
    Started by geddyisodin, Today, 05:20 AM
    0 responses
    3 views
    0 likes
    Last Post geddyisodin  
    Started by JonesJoker, 04-22-2024, 12:23 PM
    6 responses
    35 views
    0 likes
    Last Post JonesJoker  
    Started by GussJ, 03-04-2020, 03:11 PM
    12 responses
    3,239 views
    0 likes
    Last Post Leafcutter  
    Started by AveryFlynn, Today, 04:57 AM
    0 responses
    6 views
    0 likes
    Last Post AveryFlynn  
    Working...
    X