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

Trouble Accessing Previous ATR Indicator Values

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

    Trouble Accessing Previous ATR Indicator Values

    Hello,

    I am currently developing an algorithm, and a part of my algorithm uses the Ninja Trader 8 built in indicator ATR

    I want to use it for a stop loss in my system. The algorithm is based off of the 30 min chart.

    The algo should take the ATR value, multiply it by 1.5, and then round the final value up.

    In terms of the ATR value I want, it ideally needs to be the ATR from the previous 30M candle, for example:
    Click image for larger version

Name:	image.png
Views:	42
Size:	28.7 KB
ID:	1302284
    The ATR is 5.55 for the last candle - that being the red one.

    I am using this as a calculation: double stopLossPoints = (double)Math.Ceiling((ATR(14)[1] * 1.5));

    But when I try to access the previous ATR value, I get values such as 0.124 or 0.26274.

    I am not sure how to get around this. I want to be able to access the value from the previous candle (so like in this picture, that would be 5.55), but it is giving me the wrong values.​

    #2
    I want to base it off of pips if that helps.

    Comment


      #3
      Hello AaronKTradingForum,

      Thank you for your post.

      How have you confirmed this value is incorrect?

      I recommend adding prints to debug. Add a print that prints out the time of the bar and the value of the ATR.

      For example,

      Print(Times[0][0] + " ATR(14)[1]: " + ATR(14)[1]);

      What values are you seeing printed out for the ATR using the print statements?

      Please let me know if I may further assist with analyzing the output.
      Gaby V.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by kevinenergy, 02-17-2023, 12:42 PM
      123 responses
      2,882 views
      1 like
      Last Post SilverSurfer1  
      Started by warpinator, Yesterday, 10:44 AM
      2 responses
      17 views
      0 likes
      Last Post warpinator  
      Started by rayyyu12, Today, 03:59 PM
      0 responses
      9 views
      0 likes
      Last Post rayyyu12  
      Started by calmcosmia, Today, 03:07 PM
      4 responses
      14 views
      0 likes
      Last Post calmcosmia  
      Started by Tim-c, Today, 02:34 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X