Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Avoid arguments for external calls

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

    Avoid arguments for external calls

    Hi friends.

    I am calling an external indicator value from other indicator, but i want to avoid a Color argument.

    Eg:

    MyIndicator ( Int, Color).MyValue;

    How could avoid the second (Color) argument when i call from other?

    In the called indicator i declare this argument as a public SerializableColor, but i dont need to declare when i call from other indicator.

    Thanks

    #2
    marynja, that could unfortunately not be avoided as parameter unless you create a second indicator not having the color input that you would use for programmatic access of the values only.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by marynja View Post
      Hi friends.

      I am calling an external indicator value from other indicator, but i want to avoid a Color argument.

      Eg:

      MyIndicator ( Int, Color).MyValue;

      How could avoid the second (Color) argument when i call from other?

      In the called indicator i declare this argument as a public SerializableColor, but i dont need to declare when i call from other indicator.

      Thanks
      Create a named instance of the indicator using the "new" keyword, with a blank constructor (i.e., no parameters), then access that named instance.

      Comment


        #4
        Could you accomplish what you want by editing the called indicator and in the Properties section change the 'GridCategory' for the color entry to 'Category' or am I misinterpreting what you are asking?

        Dan
        eDanny
        NinjaTrader Ecosystem Vendor - Integrity Traders

        Comment


          #5
          Originally posted by eDanny View Post
          Could you accomplish what you want by editing the called indicator and in the Properties section change the 'GridCategory' for the color entry to 'Category' or am I misinterpreting what you are asking?

          Dan
          Yes, Danny, one can do that. As long as the Category itself is also not "Parameters".

          Comment


            #6
            I see no problem with having a Category 'Parameters' and also a GridCategory 'Parameters' . They will be separated in the indicator settings listing. Does this cause any problems?
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              Originally posted by eDanny View Post
              I see no problem with having a Category 'Parameters' and also a GridCategory 'Parameters' . They will be separated in the indicator settings listing. Does this cause any problems?
              His problem is the parameter that he does not want to be part of the indicator signature. Anything in Category 'Parameters' will be part of the signature, and so does not solve his particular problem. Yes, they will be separated in the User Dialog.

              Comment


                #8
                You are right about that. The easy fix is to change the name from Parameters to something else for the Color setting.
                eDanny
                NinjaTrader Ecosystem Vendor - Integrity Traders

                Comment


                  #9
                  Originally posted by koganam View Post
                  Create a named instance of the indicator using the "new" keyword, with a blank constructor (i.e., no parameters), then access that named instance.
                  Oh, fantastic koganam, thanks, but then, i cannot send the first int argument.

                  I tried it, but NT dont accept any arguments in declaration:

                  //Vars
                  private
                  MyIndicator myInstance;

                  //Initialice
                  myInstance= new MyIndicator();

                  //OnUpdate
                  myInstance.MyValue;

                  Comment


                    #10
                    Originally posted by marynja View Post
                    Oh, fantastic koganam, thanks, but then, i cannot send the first int argument.

                    I tried it, but NT dont accept any arguments in declaration:

                    //Vars
                    private
                    MyIndicator myInstance;

                    //Initialice
                    myInstance= new MyIndicator();

                    //OnUpdate
                    myInstance.MyValue;
                    I answered your question in the general sense, but without knowing the other details of what you are trying to do, there is little more to be said.

                    The indicator is a class/object. By creating a named instance, you have created a specific object. In order to change it properties, you can assign a value to any of its exposed writable properties.

                    The last piece of your code performs no action: it is merely a statement of a value of the object. What were you expecting?

                    Comment


                      #11
                      Thanks koganam.

                      Sorry me please.
                      I want to call my external indicator and send the arguments that i want.

                      Eg.

                      int LocalValue = MyIndicator ( Int, Color).MyValue;

                      The external indicator needs 2 arguments, an int and a color, but both are initialize in the external indicator, then isnt necessary. But when i call from other indicator Ninjatrader needs the 2 arguments mandatorily.

                      I dont understand why is necessary send mandatorily the 2 arguments when i call this external indicator. I want to skip send the Color argument when i call from other indicator.

                      Bertrand said that unfortunately not be avoided as parameter, then its ok. I resigned to it.


                      Thanks, bye.

                      Comment


                        #12
                        Originally posted by marynja View Post
                        Thanks koganam.

                        Sorry me please.
                        I want to call my external indicator and send the arguments that i want.

                        Eg.

                        int LocalValue = MyIndicator ( Int, Color).MyValue;

                        The external indicator needs 2 arguments, an int and a color, but both are initialize in the external indicator, then isnt necessary. But when i call from other indicator Ninjatrader needs the 2 arguments mandatorily.

                        I dont understand why is necessary send mandatorily the 2 arguments when i call this external indicator. I want to skip send the Color argument when i call from other indicator.

                        Bertrand said that unfortunately not be avoided as parameter, then its ok. I resigned to it.


                        Thanks, bye.
                        In which case you should have in Initialize() or OnStartup(), the assignation statement:

                        Code:
                        myInstance.int = ValueYouWantToAssign;
                        If it is a user required parameter, then it is writable, so just assign the value that you want it to have. It will have been already set to the default value when the instance was created.
                        Last edited by koganam; 01-10-2012, 11:05 AM.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by diabacorehealth, Today, 06:02 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post diabacorehealth  
                        Started by diabacorehealth, Today, 06:01 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post diabacorehealth  
                        Started by georgeinharmony, Today, 12:06 AM
                        2 responses
                        12 views
                        0 likes
                        Last Post NinjaTrader_Jason  
                        Started by Prisalice, Yesterday, 07:07 AM
                        2 responses
                        16 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Started by Futurestrader00, Yesterday, 12:04 AM
                        1 response
                        10 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Working...
                        X