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

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, 08:38 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      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
      10 views
      0 likes
      Last Post burtoninlondon  
      Started by AaronKoRn, Yesterday, 09:49 PM
      0 responses
      15 views
      0 likes
      Last Post AaronKoRn  
      Started by carnitron, Yesterday, 08:42 PM
      0 responses
      11 views
      0 likes
      Last Post carnitron  
      Started by strategist007, Yesterday, 07:51 PM
      0 responses
      14 views
      0 likes
      Last Post strategist007  
      Working...
      X