Announcement

Collapse
No announcement yet.

Time Stops

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

  • Time Stops

    I'm learning ES Backtesting this weekend. I get the general picture but have yet to see any reference to coding Time Stops. Profit targets and stop losses, not problems but if I want to close at a certain time, how do I do this?

    I dont need to know how to test ifLong or ifShort ... Then coverShort or exitLong. I just want a test equivalent to

    if time = 12:00 then strategy.coverShort(... ) ..

    How do I do this?

  • #2
    One way of doing this is shown in the enclosed example
    Alex

    PHP Code:
    if((hour(0)*100)+minute(0) == 1200){
        
    Strategy.doCover(...)

    Comment


    • #3
      Thanks Alexis, whats the reason for multiplying hour(0) by 100?

      Comment


      • #4
        It just makes it easier to write time based conditional statements and to add hours and minutes without having to worry if the minutes are less than 10
        Alex

        Comment

        Working...
        X