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

Parameters decimal??

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

    Parameters decimal??

    Hi all,

    I'm trying to make a parameter for an indicator, however when I use:

    private int SMAinput = 0.75; I get an error but when I use private int SMAinput= 1 ; it works fine. How do I resolve this error?

    Regards,

    Kyle

    #2
    private double SMAinput = 0.75

    Comment


      #3
      Thanks Baruch,

      I got it to work but my indicator gets rounded up or down to the nearest integer.

      How can I get it to reference it in decimal form?

      Comment


        #4
        skikg,

        Please provide the context in which you are using it. SMA periods are indeed integers which cannot be decimal values.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hi Josh,

          I'm looking for a ticksize off an ema. Here is the code context:


          #region Variables
          // Wizard generated variables
          private double dec = 0.75 ; // tick size off ema




          protected override void OnBarUpdate()

          // Condition example looks for a bar high greater then .75+EMA for ES
          condition4 = (High[0] > (Dec) + EMA(20, 40)[0]? true : false);


          Properties

          [Description("Bar high greater then EMA Condition")]
          [Category("Parameters")]
          public double Dec
          {
          get { return dec; }
          set { dec = Math.Max(1, value); }

          Comment


            #6
            skikg,

            Best way to do tick sizes would to be use TickSize variable and then multiply that by an integer.

            3 * TickSize on the ES would equate to 0.75.

            High[0] > someValue + 3 * TickSize.

            Also, your EMA indicator call. I don't believe you can provide two integer parameters there as it only has one period.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Hi Josh,

              Got it working, Thanks for the help.

              Comment


                #8
                Hi Josh,

                I am trying to change default parameters of upper band of an enveloppe from 1.00 to 0.06 and for some reson i get a msg saying that that number cannot be a decimal.

                Read the thread but not sure i understand. Shall i use "private int SMAinput= 0.06"?

                Where to change it.

                Many thanks

                Comment


                  #9
                  mignardf, what parameter declaration / property setup are you now exactly using? If you want to supply floating point values as input, a double instead of an int would be best normally.
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Hi Bertrand,

                    "what parameter declaration / property setup are you now exactly using?" no sure where to look to be honest...

                    Comment


                      #11
                      mignardf, for the indicator you use, we would need to know how the user input you try to change is defined in the code, as that would define which values it could accept. If you're unsure how to find out you can also send it to us directly for example via an email to support at ninjatrader dot com.
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        ok, will do that when i get home from work.

                        Cordialy yours

                        Comment


                          #13
                          Hi Bertrand, culd u gimme ur email please so i can fwd to you the email and indicator package that was sent to me.

                          Many thanks

                          Comment


                            #14
                            Please either use support at ninjatrader dot com - or contact us via your NT Control Center Help > Mail to Support option with the files for review attached.

                            Thanks,
                            BertrandNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by TraderBCL, Today, 04:38 AM
                            2 responses
                            16 views
                            0 likes
                            Last Post TraderBCL  
                            Started by martin70, 03-24-2023, 04:58 AM
                            14 responses
                            106 views
                            0 likes
                            Last Post martin70  
                            Started by Radano, 06-10-2021, 01:40 AM
                            19 responses
                            609 views
                            0 likes
                            Last Post Radano
                            by Radano
                             
                            Started by KenneGaray, Today, 03:48 AM
                            0 responses
                            5 views
                            0 likes
                            Last Post KenneGaray  
                            Started by thanajo, 05-04-2021, 02:11 AM
                            4 responses
                            471 views
                            0 likes
                            Last Post tradingnasdaqprueba  
                            Working...
                            X