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

Problem with user variable that is a Double

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

    Problem with user variable that is a Double

    I am working on optimizing an automated strategy that has a double variable that it's supposed to test. -.0004;.0004;.0001
    When doing any variation on that, NinjaTrader appears to ignore the fact that its a double and just goes straight to "1". Any way around this?

    #2
    Hello,

    Thank you for your post and welcome to our forums!

    From your Properties section of your code, what do you have the Max/Min function set to? Is this at 1 or do you have it as low as 0.0001 to accommodate the variables you wish to optimize on?

    For example if it was set such as the following, the lowest value it would take would be a value of 1

    Code:
                set { myVariable = Math.Max(1, value); }
    MatthewNinjaTrader Product Management

    Comment


      #3
      I don't see an option in the User Defined Input screen for a "maximum" though I did alter the "minimum" to -.004, but it still doesn't step properly in optimization. It appears to jump to integers and or the max. ie: -.004;.004;.001 does -.004, 0, and .004 and nothing in between

      Comment


        #4
        From the User Defined Input Screen, you would need to set the minimum to at least 0.0001. Or you can just set the minimum to 0 and that will allow any double input.

        Regarding the results you're seeing, when you say

        .004;.004;.001 does -.004, 0, and .004 and nothing in between
        Do you mean you have it set to Optimization parameters set to Min. Value and Max value of 0.004 and the increment to .001?

        That would only give you results from 0.004.

        What you want to do is define a range between the min and max value, and then say how you want it to increment. For example you could set the Min. value to 0.001, and the Max to 0.004 and then increment to 0.001.

        This would then run on 0.001, 0.002, 0.003 and end on 0.004.
        MatthewNinjaTrader Product Management

        Comment


          #5
          So how do I have it also run through NEGATIVE variables?
          Example:

          Go through NEGATIVE .0004 through POSITIVE .0004 at an increment of .0001? I understand what you're saying, but I need negatives.

          Comment


            #6
            This should work as long as you have it setup correctly. Please see the attached screen shot where I've used "-1.0000" as the min value in the User Variables.

            This then allows us to start the parameter at -0.0004 and increment to 0.0004 by a value 0.0001
            Attached Files
            MatthewNinjaTrader Product Management

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rhyminkevin, Today, 04:58 PM
            3 responses
            48 views
            0 likes
            Last Post Anfedport  
            Started by iceman2018, Today, 05:07 PM
            0 responses
            5 views
            0 likes
            Last Post iceman2018  
            Started by lightsun47, Today, 03:51 PM
            0 responses
            7 views
            0 likes
            Last Post lightsun47  
            Started by 00nevest, Today, 02:27 PM
            1 response
            14 views
            0 likes
            Last Post 00nevest  
            Started by futtrader, 04-21-2024, 01:50 AM
            4 responses
            50 views
            0 likes
            Last Post futtrader  
            Working...
            X