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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    67 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    36 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    59 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    62 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    53 views
    0 likes
    Last Post CarlTrading  
    Working...
    X