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 ScottWalsh, Today, 06:52 PM
      4 responses
      32 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      4 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      19 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      6 views
      0 likes
      Last Post cre8able  
      Started by Haiasi, Today, 06:53 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Working...
      X