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 llanqui, Today, 03:51 PM
            0 responses
            5 views
            0 likes
            Last Post llanqui
            by llanqui
             
            Started by Quanto, 04-17-2024, 10:43 AM
            2 responses
            23 views
            0 likes
            Last Post Quanto
            by Quanto
             
            Started by Irukandji, Today, 03:06 PM
            0 responses
            7 views
            0 likes
            Last Post Irukandji  
            Started by cmtjoancolmenero, 04-25-2024, 03:58 PM
            17 responses
            96 views
            0 likes
            Last Post cmtjoancolmenero  
            Started by nleitman, Today, 11:46 AM
            8 responses
            20 views
            0 likes
            Last Post nleitman  
            Working...
            X