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 bortz, 11-06-2023, 08:04 AM
                47 responses
                1,606 views
                0 likes
                Last Post aligator  
                Started by jaybedreamin, Today, 05:56 PM
                0 responses
                8 views
                0 likes
                Last Post jaybedreamin  
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                18 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                4 views
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                13 views
                0 likes
                Last Post Javierw.ok  
                Working...
                X