Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATR over the SMA?

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

    ATR over the SMA?

    On the charts, you can overlay the ATR on top of an SMA. Can you share with me how, in the strategy builder, I would describe this in code?

    I tried:

    ATR(14)[0] > SMA(200)[0];

    This doesn't work. Again, just trying to create a condition based on the chart screenshot below. Thank you!


    #2
    Hello coopgrafik, thanks for writing in.

    The values from the SMA will likely always be greater than the ATR values. When they are overlayed on a chart they are crossing each other, but only visually. You would need to normalize the values so that the actual numbers are comparable. Unfortunately to do something complex with indicator values the script will need to be unlocked and written by hand through the NinjaScript editor. A function like the following would need to be used to normalize the SMA and ATR values between 0 and 1

    function(val, max, min) { return (val - min) / (max - min); } //pseudo code

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thank you!
      Last edited by coopgrafik; 01-16-2021, 07:38 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by timmbbo, 01-08-2020, 08:09 PM
      3 responses
      395 views
      0 likes
      Last Post bltdavid  
      Started by ntbone, Today, 02:30 PM
      0 responses
      5 views
      0 likes
      Last Post ntbone
      by ntbone
       
      Started by tuliomgui, Yesterday, 10:07 PM
      3 responses
      13 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by Learner Trader, Today, 08:36 AM
      1 response
      24 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by GeorgeW, Today, 03:15 AM
      1 response
      16 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Working...
      X