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

Creating parameters for user input

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

    Creating parameters for user input

    I am trying to create an indicator that lets me easily switch between using either an EMA or a SMA for calculations.

    I want to have it as one of the parameters options when I add it to the chart. Something like
    Code:
    [Description("Period for third SMA line. (Numbers of bars used for calculations)")]
            [Category("Parameters")]
            public int SMA3
            {
                get { return sma3; }
                set { sma3 = Math.Max(1, value); }
            }
    but maybe instead of inputting an int I can choose from a dropdown menu or at least type "sma" or "ema".
    Last edited by NinjaTrader_JoshP; 07-15-2007, 01:17 AM.
    Josh P.NinjaTrader Customer Service

    #2
    Good suggestion uacvax . . . I would also suggest the capablity for pull down values that would accommodate values like

    "1 - SMA"
    "2 - EMA"
    "3 - HMA"

    Where parameter inputs, in particular for strategies, would be indifferent between the input of a "1" or "1 - SMA". In this way, the optimizer can be used to iterate numeric input values while the user can select more meaningful predetermined input values.

    Regards,

    Whitmark
    whitmark
    NinjaTrader Ecosystem Vendor - Whitmark Development

    Comment


      #3
      You can do this now, just declare an enum outside of the class declaration in your indicator/strategy.

      RayNinjaTrader Customer Service

      Comment


        #4
        Reference Sample

        Attached is a sample indicator demonstrating this concept.

        Import the file via File > Utilities > Import NinjaScript. Then take a look at the source code as a reference.
        Attached Files
        RayNinjaTrader Customer Service

        Comment


          #5
          Great! Thanks Ray. I remembered something similar to that in a programming class I took many years ago just couldn't remember what it was called.
          Josh P.NinjaTrader Customer Service

          Comment


            #6
            Thanks Ray, for the quick turn on the answer and an example. Outstanding, and on Sunday too!

            - Whitmark
            whitmark
            NinjaTrader Ecosystem Vendor - Whitmark Development

            Comment


              #7
              How to do pull-down for text list?

              I would like to do a pull-down for the following list of text to be selected by the user:

              "auto"
              "0"
              "0.00"
              "0.000"
              "0.0000"
              "0.00000"

              (Essential number formats for displaying information).

              These CANNOT be used as "enums" - illegal. Any suggestions?

              Comment


                #8
                Shark,

                Potential work around: make it a "NumberDecimal" input, where 0 is "auto", and anything else is the number of decimals?
                mrlogik
                NinjaTrader Ecosystem Vendor - Purelogik Trading

                Comment


                  #9
                  I have been using that "hack"

                  _auto
                  _0
                  _0_0
                  _0_00
                  _0_000
                  _0_0000

                  Just not very satisfying. Seems like there should be a better way.

                  Comment


                    #10
                    Assuming you're using NT7, (.NET 3.5) you can check this link out.
                    mrlogik
                    NinjaTrader Ecosystem Vendor - Purelogik Trading

                    Comment


                      #11
                      Spent some time working with the suggested link. Here is another that was also helpful:



                      In both instances, NT7 displays the enum string in the drop list. These extension methods provide a mechanism for converting the enum to the string.

                      Generic lists made for interesting display - apparently a way that COULD be used to create a list of stock symbols, add to or remove them... But did not see a way to return an index of an item:

                      Comment


                        #12
                        I just posted BollingerPair to v7 indicators with the ability to select MA type from a drop down list.

                        Comment


                          #13
                          Originally posted by NinjaTrader_Ray View Post
                          Attached is a sample indicator demonstrating this concept.

                          Import the file via File > Utilities > Import NinjaScript. Then take a look at the source code as a reference.
                          Ray,

                          Can you show us (as in me, the code writer challenged minority) how that indicator would be integrated into a strategy, so it (MAType) could be used in optimization?

                          NT7 would be good, since we are driving that way

                          Thanks,
                          Jon

                          Comment


                            #14
                            TraderJon, you can take a look at the dayOfWeek optimizer script Ryan has posted in our sharing, you can optimize an Int input which is 'linked' to the day fo week to trade on, the same concept can be used to switch through the MA's for your strategy -

                            BertrandNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by PhillT, Today, 02:16 PM
                            2 responses
                            6 views
                            0 likes
                            Last Post PhillT
                            by PhillT
                             
                            Started by Kaledus, Today, 01:29 PM
                            3 responses
                            10 views
                            0 likes
                            Last Post NinjaTrader_Jesse  
                            Started by frankthearm, Yesterday, 09:08 AM
                            14 responses
                            47 views
                            0 likes
                            Last Post NinjaTrader_Clayton  
                            Started by gentlebenthebear, Today, 01:30 AM
                            2 responses
                            14 views
                            0 likes
                            Last Post gentlebenthebear  
                            Started by PaulMohn, Today, 12:36 PM
                            2 responses
                            17 views
                            0 likes
                            Last Post PaulMohn  
                            Working...
                            X