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 CrissCross, Today, 01:34 PM
                0 responses
                4 views
                0 likes
                Last Post CrissCross  
                Started by rtwave, Today, 09:14 AM
                2 responses
                17 views
                0 likes
                Last Post rtwave
                by rtwave
                 
                Started by nandhumca, Today, 12:09 PM
                1 response
                6 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by nandhumca, Today, 12:23 PM
                1 response
                5 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by RaddiFX, 09-28-2021, 09:42 PM
                7 responses
                216 views
                0 likes
                Last Post nandhumca  
                Working...
                X