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 futtrader, 04-21-2024, 01:50 AM
    4 responses
    41 views
    0 likes
    Last Post futtrader  
    Started by Option Whisperer, Today, 09:55 AM
    1 response
    12 views
    0 likes
    Last Post bltdavid  
    Started by port119, Today, 02:43 PM
    0 responses
    8 views
    0 likes
    Last Post port119
    by port119
     
    Started by Philippe56140, Today, 02:35 PM
    0 responses
    7 views
    0 likes
    Last Post Philippe56140  
    Started by 00nevest, Today, 02:27 PM
    0 responses
    7 views
    0 likes
    Last Post 00nevest  
    Working...
    X