question re time syntax

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #125997 quote
    nonethelessnonetheless
    Participant
    Master

    To specify an algo’s active time I have normally used

    time >= 080000 and time <210000

    Then I got it in my head that i could save a lot of zeros by using this instead:

    hour >= 8 and hour <21

    The two seemed to be interchangeable, until just now when I found an algo that returns completely different results for time as opposed to hour.

    Do they mean different things then? Couldn’t find an answer in the manual.

    #126000 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    000030 is greater than 21, but not than 210000!

    nonetheless thanked this post
    #126002 quote
    VonasiVonasi
    Moderator
    Master

    As Roberto points out – it depends on the time frame that you run your strategy on. On a 1 hour based strategy there is only a candle every hour so  TIME = 080000 is the same as HOUR = 8 but on a 1 minute time frame there are 59 candles in between where HOUR = 8 but TIME does not equal 080000.

    nonetheless thanked this post
    #126003 quote
    nonethelessnonetheless
    Participant
    Master

    OK, got it. Hour =8 includes everything in the 8th hour up to the last candle before 9.

    Second question: the main reason I changed was not of course to save zeros, but because it made it easier to optimize on the half hour. How would I check a range of times eg 170000 to 230000 by half hour? Steps of 3000 won’t work.

    #126004 quote
    nonethelessnonetheless
    Participant
    Master

    What I had been doing is running it twice, first on the hour 170000 to 230000, then on the half hour 173000 to 233000 — both by steps of 10000.

    Is there a better way?

    #126006 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    I use 10000 steps (1 hour), so you can use 3000 (30 minutes), provided your TF ends on a 30-minute boundary, that is it must not have to be greater than 30 minutes.

    nonetheless thanked this post
    #126020 quote
    VonasiVonasi
    Moderator
    Master

    I use 10000 steps (1 hour), so you can use 3000 (30 minutes)

    But that would give you times such as:

    170000

    173000

    176000 (not a valid time)

    179000 (not a valid time)

    182000

    You will have an awful lot of tests with no results to run through.

    Perhaps optimising with two variables would be better and more efficient. MyHour 0 to 23 in steps of 1 and MyMinute 0 to 1 step 1 and then add the following to the start of your strategy:

    extra = 0
    if myminutes = 1 then
    extra = 3000
    endif
    
    mytime = (myhour * 10000) + extra
    #126025 quote
    NicolasNicolas
    Keymaster
    Legend

    80000 is obviously not the same number as 8! 😉

    #126037 quote
    nonethelessnonetheless
    Participant
    Master

    80000 is obviously not the same number as 8

    Yes, my bank manager has been patiently trying to explain that to me.

    Nicolas thanked this post
    #126038 quote
    nonethelessnonetheless
    Participant
    Master

    Perhaps optimising with two variables would be better and more efficient. MyHour 0 to 23 in steps of 1 and MyMinute 0 to 1 step 1 and then add the following to the start of your strategy:

    Very clever! I’ll try that, thanks.

    #126059 quote
    GraHalGraHal
    Participant
    Legend

    Vonasi code above added as Log 205 here …

    Snippet Link Library

    Vonasi thanked this post
    #126129 quote
    MAKSIDEMAKSIDE
    Participant
    Veteran

    Vonasi code above added as Log 205 here …

    td{border:1px solid #ccc}br{mso-data-placement:same-cell} Snippet Link Library

    It’s a treasure ! thx Grahal for the link

    GraHal thanked this post
Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

question re time syntax


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 11 replies,
has 6 voices, and was last updated by MAKSIDEMAKSIDE
6 years, 5 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/13/2020
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...