Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

time value as user input in optimizer

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

    time value as user input in optimizer

    I'm experiencing a problem when I attempt to use a time value as a user input parameter in my strategy, while testing in optimizer. My objective is to be able to easily change the strategy trading hours from within the optimizer user input parameters. I've programmed time values as user inputs in Builder. However, when I run the optimizations, optimizer always uses the initial default values from the user input time value settings in Builder, instead of the values that I've entered in the optimizer user input parameters.

    I've attached a screenshot that shows the optimizer settings indicating the time values from the user inputs in optimizer. Apparently, optimizer recognizes the user input time values as I entered them in optimizer parameters, but those values are ignored when I run optimizations. Instead, optimizer uses the default user input time values that I initially entered when I created those user inputs in Builder. Also, it seems strange to me that there are dates listed alongside the user input time values in the optimizer settings (1/4/2022, 1/10/2022). These are the dates on which I created those user inputs in Builder, but I don't understand why that info would be displayed in the optimizer settings. Maybe that's related to the issue I'm describing. I've also attached screenshots that show how I've set up the user input time values in Builder, and how I added them as conditions.
    Attached Files
    Last edited by 2inthebush; 01-11-2022, 01:51 AM.

    #2
    Hello 2inthebush,

    Thanks for your post.

    Please see the attached example script which demonstrates using Time conditions/Time Filters to limit when trades are entered by a strategy.

    In the attached example script, we have StartTime and EndTime inputs that determine when the strategy will enter trades. If you run an Optimization on the attached strategy and navigate to the Trades display in the Strategy Analyzer, we can see that trades are always entered within the StartTime and EndTime set in the Strategy Analyzer.

    See this help guide page for more information about Time Filters: https://ninjatrader.com/support/help...ateTimeFilters

    Let us know if we may assist further.
    Attached Files
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      I've resolved this issue by recreating this strategy in Builder.

      I had initially created this strategy in Builder last year, in a previous NT8 release, then modified the strategy in Builder using later NT8 releases. I suspect that something became corrupted along the way at some point.

      Comment


        #4
        Hi NinjaTrader_BrandonH

        I have been checked the example shared in your previous message and with this you can choose start time and end time but how can i optimize over a range of start time values and end value to find the right combination of both?

        Regards.

        Comment


          #5
          Hello J2512,

          Thanks for your post.

          The idea to optimize time is to use int inputs (public integer variables using the NinjaScriptProperty attribute) and use ToTime(Time[0]) to check that the bar is between the optimized hour and minute values.

          See the links below to forum posts with sample code and more information.
          https://ninjatrader.com/support/foru...ation-for-time

          https://ninjatrader.com/support/foru...me#post1067014

          https://ninjatrader.com/support/forum/forum/ninjatrader-8/strategy-development/1149892-how-to-optimize-a-time-period-from-xy-to-xy-what-is-the-best-entry-and-exit-time?p=1154666#post1154666


          Let us know if we may assist further.
          Brandon H.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Davidtowleii, Today, 12:15 AM
          0 responses
          2 views
          0 likes
          Last Post Davidtowleii  
          Started by guillembm, Yesterday, 11:25 AM
          2 responses
          9 views
          0 likes
          Last Post guillembm  
          Started by junkone, 04-21-2024, 07:17 AM
          9 responses
          68 views
          0 likes
          Last Post jeronymite  
          Started by trilliantrader, 04-18-2024, 08:16 AM
          4 responses
          20 views
          0 likes
          Last Post trilliantrader  
          Started by mgco4you, Yesterday, 09:46 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X