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 mmckinnm, Today, 01:34 PM
                0 responses
                1 view
                0 likes
                Last Post mmckinnm  
                Started by f.saeidi, Today, 01:32 PM
                0 responses
                1 view
                0 likes
                Last Post f.saeidi  
                Started by traderqz, Today, 12:06 AM
                9 responses
                16 views
                0 likes
                Last Post NinjaTrader_Gaby  
                Started by kevinenergy, 02-17-2023, 12:42 PM
                117 responses
                2,766 views
                1 like
                Last Post jculp
                by jculp
                 
                Started by Mongo, Today, 11:05 AM
                5 responses
                15 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X