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.

    Comment


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

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Today, 05:17 AM
      0 responses
      52 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      130 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      70 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      44 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X