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 usazencort, Today, 01:16 AM
      0 responses
      1 view
      0 likes
      Last Post usazencort  
      Started by kaywai, 09-01-2023, 08:44 PM
      5 responses
      603 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by xiinteractive, 04-09-2024, 08:08 AM
      6 responses
      22 views
      0 likes
      Last Post xiinteractive  
      Started by Pattontje, Yesterday, 02:10 PM
      2 responses
      21 views
      0 likes
      Last Post Pattontje  
      Started by flybuzz, 04-21-2024, 04:07 PM
      17 responses
      230 views
      0 likes
      Last Post TradingLoss  
      Working...
      X