• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Optimization for Time

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

    Optimization for Time

    Hi,

    I was wondering if its possible to optimize entry and close times (clock time) on NT8. When I used the drop down menu to optimize I usually get the same results as selecting True.
    Attached Files
    Last edited by ashmanz80; 02-07-2018, 09:18 AM.

    #2
    Hello ashmanz80,
    Thanks for your post.

    Is this a strategy that you made yourself, or did you download this from somewhere?

    What drop down menu or option are you setting to "True"?
    Josh G.NinjaTrader Customer Service

    Comment


      #3
      Its actually something I made myself with the help of a programmer. I'm setting the time schedule which allows signals in a 24hrs market to run. For example if I limit the strategy for US open 9:30AM and end time to 4:00PM with a close of all open positions by 4:30PM EST. I was wondering if time can be optimized as to when the strategy should ideally run.

      Comment


        #4
        Hello ashmanz80,

        Thanks for your note.

        One thing you could do to optimize time in the Strategy Analyzer, without modifying your code, is set 'Optimize Data Series' to 'true'. This will effectively offer to run through a range of timeframes, and the period would offer you to set the ranges to run through. Then you could apply a session template to limit your trading hours.

        If you wanted to actually modify your code to optimize a particular time of day, what you would need to do is use a switch statement or a bunch of if statements and have a parameter for time that would optimize as a range of integers. For example, if you divide the day up into 6 parts and assign an integer to each of those parts you would be able to discern which of those 6 segments provided the best results. Something similar to the following snippet would accomplish this.

        Code:
        			if( TimeFrame == 1 )
        			{
        				// 12:00 AM and 4:00 AM time frame
        				if( ToTime(Time[0]) >= 000000 && ToTime(Time[0]) <= 040000)
        				{
        					//your strategy logic here
        				}
        			}
        
        			if( TimeFrame== 2 )
        			{
        				// 4:00 AM and 8:00 AM time frame
        				if( ToTime(Time[0]) >= 040000 && ToTime(Time[0]) <= 080000 )
        				{
        					//your strategy logic here
        				}
        			}
        
        The above code would be for just two segments of the day so you would need to create a condition for the other 4 segments, assuming your day was broken into 6 segments.

        I am including a link to our help guide documentation for ToTime(), for your convenience. I am also including a link to a forum post you should find helpful that discusses how to limit trading hours with a time filter.

        ToTime()
        https://ninjatrader.com/support/help...us/?totime.htm

        Using a time filter to limit trading hours
        https://ninjatrader.com/support/foru...ead.php?t=3226

        Please let me know if you have any further questions.
        Josh G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by guvenators, Today, 05:18 PM
        1 response
        13 views
        0 likes
        Last Post NinjaTrader_ShawnB  
        Started by LANwarr1or, Today, 03:00 PM
        2 responses
        8 views
        0 likes
        Last Post LANwarr1or  
        Started by Newtrader101, Today, 02:53 PM
        2 responses
        10 views
        0 likes
        Last Post Newtrader101  
        Started by JuanPabloQuevedo, Today, 02:53 PM
        2 responses
        9 views
        0 likes
        Last Post JuanPabloQuevedo  
        Started by samir, Today, 03:16 PM
        2 responses
        14 views
        0 likes
        Last Post samir
        by samir
         
        Working...
        X