About trading times

Forums ProRealTime English forum ProOrder support About trading times

Viewing 9 posts - 1 through 9 (of 9 total)
  • #110687

    Hi,

    I´ve a couple of question about trading times in code.

    1. My code snippet for when I´m not allowed to take a trade is attached. It works fine. Now I want to add one more time span. It´s not possible to use “less than” and “greater than” because they interfer with each other.  I want to use a command like “between start time and stop time”. Any ideas how to code that?
    2. When I do backtesting and there are time spans involved it takes more time than necessary to backtest. For example time span 090000-120000 – it test also numeric value 097000 and 098000 which are no real times. Is there a way to work around that to save time?

    Greatful for som help here!

    /Bengt

     

    #110689

    A1.

    Why not use NoEntryStart2 and NoEntryStop2 as the second set of time constraints?

    A2.

    No way round it as I have found unless you can limit your time constraints to < 1 hour and use 1 min in range 1 to 60 etc

    What I do is use a coarse step first … 001500 or even 003000 or even 010000 … then narrow in as necessary.

    1 user thanked author for this post.
    #110693

    seatrout – Please use the ‘Insert PRT Code’ button when posting code rather than attaching an image of it.

     

    #110694

    Just use OR:

     

     

    1 user thanked author for this post.
    #110695

    When back testing you can speed it up by ignoring the main code or quitting in tests that don’t involve use-able times. I would use two variables. For example when testing every hour – one variable is starttime (000000 to 230000) and the other is addedhours (010000 to 240000). You can code something along similar lines when dealing with minutes or seconds. Here is the hourly example.

     

     

    #110918

    Sorry – I don´t understand how to use it. So I don´t know how to code it for minutes either… Vonasi, can you please clarify!

    #110925

    Here is an example of the theory applied to a simple strategy to show how it works. To test every 15 minutes set up four optimised variables.

    • StartTime from 0 to 23 step 1
    • AddedHours from 1 to 24 step 1
    • AddedEndMinutes from 0 to 45 step 15
    • AddedStartMinutes from 0 to 45 step 15

     

    This will then test every possible start time at 15 minute intervals and every possible end time at 15 minute intervals and ignore and quit any test that has an end time that is not a possible end time to speed up the back test. This obviously gives 9216 possible optimisations which does not leave much capacity for optimising other variables!

    I would always advise against optimising time unless there are very sound reasons to such as market hours because optimising time will often turn out to be pure data mining.

     

    1 user thanked author for this post.
    #110926

    Thank you very much!

    I gonna adjust it to my needs.

    #110928

    Added as Log 178 to here …

    Snippet Link Library

Viewing 9 posts - 1 through 9 (of 9 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login