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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    57 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    143 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    161 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    97 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X