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 andrewtrades, Today, 04:57 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by chbruno, Today, 04:10 PM
                0 responses
                3 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                436 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                7 views
                0 likes
                Last Post FAQtrader  
                Started by rocketman7, Today, 09:41 AM
                5 responses
                19 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X