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

Adding and Plotting indicator

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

    Adding and Plotting indicator

    I tried the following below but getting compile errors. Can a ATR component somehow be added to the EMA as below?

    Add(EMA(20) + 2*ATR(10));
    EMA(20) + 2*ATR(10).Plots[0].Pen.Color = Color.Green;

    #2
    Hi Delta007, only strategies could add in indicators for display. The calculation logic would be done in the indicator then, the add really only does the including of the indicator for visualization purposes, it would not be used to further include custom calculations like yours.

    You could for example check into the Keltner indicator and make a copy to let it's midline be an EMA. And then add this new study you created in via the strategy for display.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      What I'm looking to do is have one line display in the strategy analyzer charts which is a offset of 2 ATR's from the EMA20

      Comment


        #4
        Right, first create an indicator that would calculate that value for you. Then Add() this indicator in for visualization in your strategy script.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Ok. From looking at the script of the Keltner indicator in NT it just uses High - Low instead of the "max of" like the ATR uses. Unless I have an outdated version.

          Comment


            #6
            You are correct, that's the traditional way to calculate it I believe. Even easier then would be just creating a new indicator with one plot with our wizard.

            Then add this to your OnBarUpdate() -

            Plot0.Set(EMA(20)[0] + 2 * ATR(10)[0]);
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by judysamnt7, 03-13-2023, 09:11 AM
            4 responses
            59 views
            0 likes
            Last Post DynamicTest  
            Started by ScottWalsh, Today, 06:52 PM
            4 responses
            36 views
            0 likes
            Last Post ScottWalsh  
            Started by olisav57, Today, 07:39 PM
            0 responses
            7 views
            0 likes
            Last Post olisav57  
            Started by trilliantrader, Today, 03:01 PM
            2 responses
            21 views
            0 likes
            Last Post helpwanted  
            Started by cre8able, Today, 07:24 PM
            0 responses
            10 views
            0 likes
            Last Post cre8able  
            Working...
            X