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

How to pass parameters to custom indicator?

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

    How to pass parameters to custom indicator?

    let's say, i am adding custom indicator in my primary indicator.


    Add(OtherCustomIndi());

    however, i need to pass arguments in it. The source of `OtherCustomIndi` is:
    Code:
            #region Properties
            [Browsable(false)]
            [XmlIgnore()]
            public DataSeries Bullish_upper_Line
            {
                get { return Values[0]; }
            }
    
            [Browsable(false)]
            [XmlIgnore()]
            public DataSeries Bullish_lower_Line
            {
                get { return Values[1]; }
            }
    
    	[Description("")]
            [GridCategory("Parameters")]
            public bool Use_Different_timeframe
            {
                get { return use_different_timeframe; }
                set { use_different_timeframe =  value; }
            }
    		
            [Description("")]
            [GridCategory("Parameters")]
            public int Different_timeframe
            {
                get { return different_timeframe; }
                set { different_timeframe = Math.Max(1, value); }
            }


    so, when I do :

    Add(OtherCustomIndi(true, 24));

    it fails.
    In what order I should pass arguments? how should i modify the source of that indi, i cant understand... Does [Gridcategory] tag means, that is only those properties can be set from outside? and what is the order? does [Browsable(false)] tag makes other properties to be ignored in sequence?
    Last edited by ttodua; 09-29-2017, 09:47 AM.

    #2
    Hello,

    Thanks for the post.

    What error are you receiving at compile time? When you type in the indicator constructor and add the parentheses, intelliprompt will show you all available constructors.

    Here is a post with samples of how to sequence your parameters:


    I look forward to your reply.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      1) no, that topic doesnt mention anything about calling from external scripts.


      2) please, clarify this too:
      Does [Gridcategory] tag means, that is only those properties can be set from outside? and what is the order? does [Browsable(false)] tag makes other properties to be ignored in sequence?
      MANY THANKS!

      Comment


        #4
        Does [Gridcategory] tag means, that is only those properties can be set from outside?
        No. It means that those properties are the only ones that you can set/change from the PropertyGrid.
        does [Browsable(false)] tag makes other properties to be ignored in sequence?
        No. It means that those properties are not visible in the PropertyGrid, and so cannot be adjusted from there. You can set any public property or field from outside the class.

        Comment


          #5
          and please mention, how can i determine what sequence should i use while passing parameters?

          Comment


            #6
            Hello,

            Thanks for the reply.

            If you type in the constructor of your indicator in the script, Intelliprompt will show you the order in which the parameters should be listed.

            When the code is compiled, there is an overload function call for every possible parameter list. So you should be able to list through these function calls with IntelliPrompt.

            When you type in the opening '(' Intelliprompt will show you the overloads. Or you can do CTRL+SHIFT+SPACE to bring up Intelliprompt.

            If you require further assistance, please post your script.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by yertle, Yesterday, 08:38 AM
            7 responses
            28 views
            0 likes
            Last Post yertle
            by yertle
             
            Started by bmartz, 03-12-2024, 06:12 AM
            2 responses
            21 views
            0 likes
            Last Post bmartz
            by bmartz
             
            Started by funk10101, Today, 12:02 AM
            0 responses
            6 views
            0 likes
            Last Post funk10101  
            Started by gravdigaz6, Yesterday, 11:40 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by MarianApalaghiei, Yesterday, 10:49 PM
            3 responses
            11 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Working...
            X