Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategy parameters on-off

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

    strategy parameters on-off

    Hello,

    in my scripts I use different variables eg to select 3 dataseries or 3 different settings for an indicator. I have added them also in the properties so that I can change in the backtest-menu the values of the parameters for my strategies.

    In the variable region I have set all to 0, but in the paramters appear 1. When there is set 1 by NT per default then within the strategy there is a calculation with this eg with BarsArrray [1] or even with [0])

    What do I have to change or add for working in the backtesting only with the variables I set a value in the parameters?

    Thank you
    Tony

    #2
    tonynt,

    Likely you need to check your properties section of your code.

    Code:
    [Description("RSI's smooth factor")]
            [GridCategory("Parameters")]
            public int Smooth
            {
                get { return smooth; }
                set { smooth = [B]Math.Max(1, value);[/B] }
            }
    The item in bold is automatically assigning this "smooth" variable to 1 if it is less than 1.
    Adam P.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      thank you for your reply. Yes, I have. But what do you mean referring to my question. What would be to change for having only working the parameters where I set a value? And even when 0 this would be BarsArray[0], but the variables should not work if not I fill a value, or can this be somehow enabled and disabled?


      Originally posted by NinjaTrader_AdamP View Post
      tonynt,

      Likely you need to check your properties section of your code.

      Code:
      [Description("RSI's smooth factor")]
              [GridCategory("Parameters")]
              public int Smooth
              {
                  get { return smooth; }
                  set { smooth = [B]Math.Max(1, value);[/B] }
              }
      The item in bold is automatically assigning this "smooth" variable to 1 if it is less than 1.

      Comment


        #4
        Hello Tony,
        To assist you further may I know are you trying to reference the BarsArray dynamically.

        If so then you can do so using a parameter. Say you have a variable named say "barIndex" then you can refer it to the BarsArray as

        Code:
        BarsArray[barIndex]

        Please let me know if I can assist you any further.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          Hello,

          thank you for your reply. Yes, I do so for more easy and fast backtesting with changing values in the backtesting menu instead of always changing the code and compiling with every change of value.

          But the problem is that every value in the parameter menu has an impact for barsarray, because even when I set 0 then the basic-timeframe will be touched with [0], no?

          Therefore I think it must be possible to disable somehow(?) And only when I enable the certain parameters with a value then the referring conditions in the script should work. I can do and change everything fine, but I need one which set to "false" especially for barsarray.

          I hope I could explain what I mean.

          Thanks

          Originally posted by NinjaTrader_Joydeep View Post
          Hello Tony,
          To assist you further may I know are you trying to reference the BarsArray dynamically.

          If so then you can do so using a parameter. Say you have a variable named say "barIndex" then you can refer it to the BarsArray as

          Code:
          BarsArray[barIndex]
          Please let me know if I can assist you any further.

          Comment


            #6
            Hello Tony,
            If you set the variable/parameter to 0 (zero) then the BarsArray will be referenced to the Primary bar. If you set it to 1 then the BarsArray will be referenced to the secondary bar and so on.

            To assist you further can you please send a toy NinjaScript code* replicating the behavior to support[AT]ninjatrader[DOT]com

            Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.

            I look forward to assisting you further.

            *The "toy" just means something that is a stripped down version that isn't necessarily the whole logic. It makes things easier to rout out.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by funk10101, Today, 09:43 PM
            0 responses
            6 views
            0 likes
            Last Post funk10101  
            Started by pkefal, 04-11-2024, 07:39 AM
            11 responses
            37 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Yesterday, 08:51 AM
            8 responses
            44 views
            0 likes
            Last Post bill2023  
            Started by yertle, Today, 08:38 AM
            6 responses
            26 views
            0 likes
            Last Post ryjoga
            by ryjoga
             
            Started by algospoke, Yesterday, 06:40 PM
            2 responses
            24 views
            0 likes
            Last Post algospoke  
            Working...
            X