Retrieve highs and lows for a time period

Forums ProRealTime English forum ProScreener support Retrieve highs and lows for a time period

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

    G’day,

    I am looking for a way to retrieve the highs and lows that occur between a period of time. There are few theories that I would like to test using this data.

    My broker offers only PRT 10.2 – I’ve read through the documentation and am unable find a way that would allow me to

    1.  Cycle through a time period, say 9 to 5 and on 5 minute chart and retrieve the OHLC value just for this period
    2. Optionally return a pivot line of some sort with the midpoint calculated using data in #1
    3. Calculate standard deviations, moving averages etc only using data from this period.

    In essence, I would like to be able to segregate price movements that occur over different time periods and apply standard indicators to test strategies.

    Any help or nudge in the right direction would be much appreciated. Thank you!

    #16023

    You can do this I think. If not by changing your chart time settings, by code.

    1. To cycle through only a set time period on the intraday chart, to find the day’s current high for example, after 9 am before 5 pm.
    2.  Midpoint would just be average, between high point as explained above and low point retrieved through same method.
    3.  To calculate moving averages etc., you are in a more tricky situation. You will need to write code that alters the return of the standard indicators. A serious problem with PRT is that you cannot make your own arrays, you can only use built in arrays. However, you can make this work. I took your question as a challenge and made a simple moving average that takes into account what happened only upto 170000 yesterday when showing the morning’s moving average. From 170000 to 090000 it just shows normal moving average, not using custom time. Try it out:

    Note that this was done in a hurry, but I hope it answers your questions.

     

    1 user thanked author for this post.
    #32815

    Hello, Wing!

    Thank you for the initial bit of code to delimit times within a day. B/c of that, I was able to quickly replicate it 6 times to mark session highs and lows for NYC, London, and Tokyo. The user will have to set his own colors/line styles to differentiate them, but this was the fastest (15 mins) I’ve ever conceptualized and finished an indicator! 😀

    I have two observations/questions:

    I had to kludge the Tokyo session with two separate IF statements for each of high and low, where NYC and London only need one for high and one for low, to account for daily rollover at my local midnight. You can see the commented-out prior attempt with an OR condition to account for the daily rollover (didn’t work). Other users will have to enter in their local times for the three market sessions, and adjust accordingly. Is there a more elegant way to do this?

    This indicator freaks out and does not display correctly when I switch to tick charts. I had a similar problem for a previous indicator. Is there a way to account for the difference in ??? timestamp data, duration of bars, I don’t know what, etc.?

    The indicator works well enough for any minute/hour chart, so I am putting this open question out for the sake of learning better scripting/coding.

     

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