Find the maxium of the 4 15min bars of the previous day

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #222408 quote
    ioannispapadakis
    Participant
    New

    Hey,

    I want to find the maximum of the 15 minute bars from 16:30 to 17:15 of the previous day. For the current day I am using this code:

    if OpenTime=171500 then
    SessionHigh=Highest[4](high)
    SessionLow=Lowest[4](low)
    endif

    How it is done for the same time period but for the previous day?

     

    Thanks in advance for your kind help!

     

    John

    #222413 quote
    robertogozzi
    Moderator
    Master

    There you go:

    if OpenTime=171500 then
       SessionHighPrev=SessionHigh
       SessionLowPrev=SessionLow

       SessionHigh=Highest[4](high)

       SessionLow=Lowest[4](low)

    endif

    SessionHighPrev and SessionLowPrev will retain the previous day’s data.

    ioannispapadakis thanked this post
    #222421 quote
    ioannispapadakis
    Participant
    New

    It worked, thank you!

    #222422 quote
    ioannispapadakis
    Participant
    New

    Hey again,

    so I have this code:

    if OpenTime=171500 then
       SessionHighPrev=SessionHigh
       SessionLowPrev=SessionLow
       SessionHigh=Highest[4](high)
       SessionLow=Lowest[4](low)
    endif
    return SessionHighPrev
    that updates the line on the chart at 17:15.
    But I want the line to be updated on the chart at a different time, lets say at 09:00 in the morning. Note that I still want the line to be calculated at 17:15.
    I tried to put return inside an if statement but prorealcode doesn’t accept that.

     

    Can you help me please?

    John

    #222434 quote
    robertogozzi
    Moderator
    Master

    There you go:

    if OpenTime=090000 then
       SessionHighPrev=SessionHigh
       SessionLowPrev=SessionLow
    endif
    if OpenTime=171500 then
       SessionHigh=Highest[4](high)
       SessionLow=Lowest[4](low)
    endif
    return SessionHighPrev
    ioannispapadakis thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Find the maxium of the 4 15min bars of the previous day


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by robertogozzi
2 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/13/2023
Status: Active
Attachments: No files
Logo Logo
Loading...