Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time property

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

    Time property

    Hi,
    I want to create a time property for my strategy such that I can optimize it based on start and end time. For example, if start time is 8:30 and end time is 12:00 noon, I would want my strategy to only take trades falling within that timeframe. What is the best way to write these properties so that I can use the optimizer to increment the time by 15 minute increments? Clearly, text won't work. What does?
    Thanks ... Ed

    #2
    Hi edstaffin,

    To optimize over the start and end time, use a start hour variable and a separate start minute variable, as well as an end hour variable and an end minute variable.

    Then add them together with:

    ((startHourVariable * 100) + startMinuteVariable) * 100.

    So 14 as the hour and 33 as the minute becomes 143300. 143300 would be equal to 2:33 PM.

    By having these as separate variables, they can be incremented.

    Or these could be used as the hour an minute for timespan.

    TimeSpan startTime;
    startTime = new TimeSpan(StartHour, StartMinute, 0);
    Last edited by NinjaTrader_ChelseaB; 06-17-2021, 11:37 AM.
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X