To know the open,close, highest, lowest of the previous hour

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #169736 quote
    fafa2502
    Participant
    Junior

    Hello,

    On a 1 min timeframe, and I would like to know the Open, close, highest and lowest of the previous hour.

    How to do it?

    Thank you

    #169741 quote
    robertogozzi
    Moderator
    Master

    Use OpenMinute as an index (not tested):

    OpenH1  = open[OpenMinute+1]
    CloseH1 = close[OpenMinute+1]
    HighH1  = high[OpenMinute+1]
    LowH1   = low[OpenMinute+1]
    fafa2502 thanked this post
    #169764 quote
    fafa2502
    Participant
    Junior

    It returns the previous minute candle

    #169765 quote
    robertogozzi
    Moderator
    Master

    It’s impossible, the previous minute is [1], [OpenMinute+1] is the same minute of the previous hour.

    #169766 quote
    fafa2502
    Participant
    Junior

    I think I found it.

    T = 10000
    
    If (Time mod T) = 0 then
    HH = Highest[60](High)
    O = Open[59]
    C = Close
    LL = Lowest[60](Low)
    Endif
    return HH As “High”, O As “Open”, C As “Close”, LL As “Low”
    #169772 quote
    robertogozzi
    Moderator
    Master

    That’s a pretty smart solution 😉

    Now I understand what you meant.

    Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.

    #169831 quote
    Nicolas
    Keymaster
    Master

    Clean and simple way would be to use the 1-hour timeframe with MTF instruction:

    timeframe(1 hour, updateonclose)
    OpenH1  = open
    CloseH1 = close
    HighH1  = high
    LowH1   = low
    
    return openh1,closeh1,highh1,lowh1
    #169838 quote
    fafa2502
    Participant
    Junior

    Thank you Nicolas,

    Does it work with proOrder?

    #169859 quote
    Nicolas
    Keymaster
    Master

    Yes sure!

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

To know the open,close, highest, lowest of the previous hour


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
fafa2502 @fafa2502 Participant
Summary

This topic contains 8 replies,
has 3 voices, and was last updated by Nicolas
4 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/15/2021
Status: Active
Attachments: No files
Logo Logo
Loading...