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

Scrollable ATR

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

    Scrollable ATR

    Sometimes we might want to scroll back the chart and find ATR values without using a plot,
    but just by using OnRender.

    I've been trying and let's just say my head hurts

    high0 = BarsArray[0].GetHigh(ChartBars.ToIndex - 1);
    low0 = BarsArray[0].GetLow(ChartBars.ToIndex - 1);
    close1 = BarsArray[0].GetClose(ChartBars.ToIndex);
    double trueRange =
    Math.Max(Math.Abs(low0 - close1),
    Math.Max(high0 - low0,
    Math.Abs(high0 - close1)));​

    the default Ninja atr uses a plot with Value, but I would have to reconstruct the values necessary for the period.

    If only I could use ATR(12)[ChartBars.ToIndex];

    Long shot, but any advice from the community and I'm all ears
    Last edited by davydhnz; 01-28-2024, 05:11 AM.

    #2
    Hello davydhnz,

    Thanks for your notes.

    You could consider accessing the ATR indicator value in OnRender() using .GetValueAt() on the ATR() system indicator method.

    For example: ATR(20).Values[0].GetValueAt(123);

    See the help guide documentation below for more information.

    GetValueAt(): https://ninjatrader.com/support/help...getvalueat.htm
    ATR: https://ninjatrader.com/support/help..._range_atr.htm

    Otherwise you would need to come up with your own custom logic to calculate that information. This forum thread will be open for other community members to share their insight on possible custom logic to accomplish this.
    Brandon H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by pibrew, Today, 06:37 AM
    0 responses
    0 views
    0 likes
    Last Post pibrew
    by pibrew
     
    Started by rbeckmann05, Yesterday, 06:48 PM
    1 response
    12 views
    0 likes
    Last Post bltdavid  
    Started by llanqui, Today, 03:53 AM
    0 responses
    6 views
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by burtoninlondon, Today, 12:38 AM
    0 responses
    11 views
    0 likes
    Last Post burtoninlondon  
    Started by AaronKoRn, Yesterday, 09:49 PM
    0 responses
    15 views
    0 likes
    Last Post AaronKoRn  
    Working...
    X