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

public input

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

    public input

    How to I make an input available from my custom indicator?

    I have a simple indicator called myADX with only 1 input called period. How do I make myADX and period callable from other strategies and indicators?

    double = myADX( period )[0];

    Thank You - Westsider

    #2
    Hello Westsider,

    That looks good. To call your indicator you will just need to use the Class name and any overloads that it requires so since you only have 1 parameters then you would just need to pass it in one parameter like "period". You will just have to make sure that it is the same type like an "int".

    Here is an example of how to call an indicator from a strategy which would be the same way you may call it from another indicator as well from the following link.


    Note that if you have not created a strategy before using the Strategy Wizard will help you get started with this and may help you out with your Indicator as well. I'm proving a link to a recently recorded 'Automated Strategy Development Webinar' video for you to view at your own convenience: http://youtu.be/SpwGTr9kl9k
    JCNinjaTrader Customer Service

    Comment


      #3
      Hi JC,
      Thanks for the info. I have used the strategy wizard and its great. The problem I'm having is period does not show up when I call it from a strategy.

      I was creating the input "period" manually and it was not public. When I use the Indicator wizard and it creates the input "period". It is available when called from a strategy.

      The wizard must do something different in the background because I manually create the properties the same way.

      private int period = 5;

      [Description("")]
      [GridCategory("Parameters")]
      public int Period
      {
      get { return period; }
      set { period = Math.Max(1, value); }
      }

      Is that correct?

      Thanks - Westsider

      Comment


        #4
        Hello Westsider,

        That looks correct. Is that the code for the "Period" variable that you are defining inside of your Strategy or Indicator?
        JCNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bortz, 11-06-2023, 08:04 AM
        47 responses
        1,603 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
        12 views
        0 likes
        Last Post Javierw.ok  
        Working...
        X