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

using external indicators

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

    using external indicators

    this appears to work ...

    private ATR myATR;

    private double myVar;

    OnStartUp()
    myATR = ATR(Closes[0],20);

    OnBarUpdate()
    myVar = myATR[0];

    but is there a discussion on other approaches and what's the most efficient?
    Last edited by futurenets; 01-27-2015, 05:08 AM.

    #2
    futurenets, correct this is a workable and efficient approach using indicator instances variables.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      and this also?

      private DataSeries myATR;

      Initialize()
      myATR = new DataSeries(this);

      OnBarUpdate()
      myATR.Set(ATR(Closes[0],20);

      Comment


        #4
        I'm not sure why you would want to do that, since the ATR already directly returns a series to work with, just like any other indicator method.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          ok thanks I guess that's what I was trying to ask.

          Comment


            #6
            trying to implement this but not working so not quite there yet.

            I'll provide more detail if required but meanwhile ... HL2 is an indicator that returns (H+L)/2 and
            works fine on its own but when try and use it as follows it returns closing price only:

            private HL2 MI;

            OnStartUp()
            MI = HL2();

            OnBarUpdate()
            Print(MI.PlotHL2[0]);

            if the error is not obvious then I'll provide more code.

            are there any guidelines or potential conflicts that I need to be aware of?
            Last edited by futurenets; 01-31-2015, 01:20 PM.

            Comment


              #7
              Originally posted by futurenets View Post
              trying to implement this but not working so not quite there yet.

              I'll provide more detail if required but meanwhile ... HL2 is an indicator that returns (H+L)/2 and
              works fine on its own but when try and use it as follows it returns closing price only:

              private HL2 MI;

              OnStartUp()
              MI = HL2();

              OnBarUpdate()
              Print(MI.PlotHL2[0]);

              if the error is not obvious then I'll provide more code.

              are there any guidelines or potential conflicts that I need to be aware of?
              Ignore this post. See PatrickH's reply.
              Thanks.
              Last edited by ninZa; 02-02-2015, 12:49 AM.
              ninZa
              NinjaTrader Ecosystem Vendor - ninZa.co

              Comment


                #8
                Hello futurenets,

                Thank you for your response.

                There should be no issue in the way you are assigning and calling the value. Can you provide further information on the HL2, such as the code?

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by mmenigma, Today, 02:22 PM
                1 response
                3 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by frankthearm, Today, 09:08 AM
                9 responses
                35 views
                0 likes
                Last Post NinjaTrader_Clayton  
                Started by NRITV, Today, 01:15 PM
                2 responses
                9 views
                0 likes
                Last Post NRITV
                by NRITV
                 
                Started by maybeimnotrader, Yesterday, 05:46 PM
                5 responses
                26 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by quantismo, Yesterday, 05:13 PM
                2 responses
                21 views
                0 likes
                Last Post quantismo  
                Working...
                X