Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

how to optimize a strategy on time of day

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

    how to optimize a strategy on time of day

    is there a way to optimize a strategy in the strategy analyzer by changing the time (hour, minutes) of day ?

    ie gives which time of day a strategy performs max net profits for example and which settings is best for that time of day ?

    I see there is the option in the strategy anylyzer to see results compiled by time of day and to see the profit/loss distribution graph based on the time of day as well

    but how to automatize the process in the optimizer to test all the parameters for each hour/minutes segment of the day

    I thought of adding a datetime parameter but that seems not to be possible.

    Any other workaround ?

    Thanks

    #2
    Hello,

    Thanks for the note.

    Right you would need to add a date time parameter to do what your looking to do, but since you cant optimize a date time parameter what you would need to do is use a switch statement or a bunch of if statement and have a parameter for time that would optimize as an example as integer 1 to 5 that would then mean a section of time you want to run on.

    if(OptimizeInteger == 1)
    {
    //Run code for time of day
    if(ToTime(Time[0]) > 000500)
    {
    //Your Time filter here.
    }

    }

    Then do OptimizeInterger == 2 and change the times that are run and break down the times of day you want to test into sections.

    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    649 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    370 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    109 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    573 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    576 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X