time constant error?

Forums ProRealTime English forum ProOrder support time constant error?

Viewing 3 posts - 1 through 3 (of 3 total)
  • #13636

    Hi all,

    I try to build some general functions to be used on several different time frames (5 min, 10 min, hour and so on). The time frame is chosen from the security window but I can’t see how to find that value inside the code.

    Therefore I try to get the difference of each bar time by stating time-time[1] with strange results. And then I just tried with “graph time” in 5 and 10 minutes time frames. To my surprise it didn’t produce a straight showing higher and higher. Instead there is a step when coming between xx:40 and xx:50 minutes. Why? I don’t understand.

    Is there some other way to find the selected time frame inside the code?

    Thanks

    Patrick

    #13637

    OK, wrote a solution that might do it. It seem to be ok during the time the security is open for trade. After that some strange results appears but it doesn’t matter. I’m sure there is a better solution than this.

    dayminutes = 1440*(day-day[1])
    hourminutes = 60*(hour-hour[1])
    barminutes = minute – minute[1] + hourminutes + dayminutes
    graph barminutes

    1 user thanked author for this post.
    #13654

    Because each conditions are only tested once per bar, your GRAPH TIME return the time when the script is ran, so every 10 minutes on a 10 minutes timeframe, that’s why you see “steps”.

    There’s no built-in instruction to get the current timeframe the strategy is currently running on. Your code may be a start to build a function to get it simply. This is definitely something we (the community) need to resolve, as it is often needed. Time to rest for me, week-end time 🙂

    FYI, there’s a bunch of date & time instructions to play with : http://www.prorealcode.com/documentation/category/dateandtime/

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

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