Identify time to calculate Highest High & Lowest Low

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

    I’m facing issue to define the time of calculation in the code.

    I am implementing a code that calculates the highest high and lowest low of a specific period (form 01:00 am to 16:30 pm)

    startime = 010000
    endtime = 163000
    
    // calculate highest high and lowest low of the last 15 hours , start calculation at 4:30 pm
    if time = endtime then
    HighestHigh = highest[15](Close)
    LowestLow = lowest[15](close)
    ENDIF 
    

    The code is working good without the IF condition, but when I add IF condition to specify the time of calculation it is not working.

    Your support and feedback is highly appreciated

    #237308 quote
    robertogozzi
    Moderator
    Master

    Your code to scan the last 15 hours needs to be used on a 1-hour chart, but in this case endtime is wrong because it ends on a 30-minute boundary.

    Try this one:

    starttime = 010000
    endtime  = 163000
    once HI = 0
    once LO = 999999
    if opentime = starttime then
       HI = high
      LO = low
    endif
    if (opentime > starttime) and (opentime <= endtime( then
       HI = max(HI,high)
       LO = min(LO,low)
    endif
    shabib thanked this post
    #237311 quote
    shabib
    Participant
    New

    Modification :

     

    // calculate highest high and lowest low of the first 14 hours , from 01 am to 4:00 pm , the calculation will happen at 4:30
    if Time >= starttime AND Time <= endtime Then
    HighestHigh = highest[14](close)
    LowestLow = lowest[14](close)
    ENDIF
    #237312 quote
    shabib
    Participant
    New

    Your code to scan the last 15 hours needs to be used on a 1-hour chart, but in this case endtime is wrong because it ends on a 30-minute boundary.

    Try this one:

    Thank you for your solution , I tried it but is doesn’t work too , I used 1 hour time frame already

    My main problem is the ( IF condition doesn’t work ) when I insert it with the calculation of the highest and lowest
    The calculation itself is working with me , which is

    HighestHigh = highest[14](close)

    LowestLow = lowest[14](close)

    but I need to specify the time period of calculated bars ( first 15 bars ) using IF condition , as follows :
    if Time >= starttime AND Time <= endtime Then
    HighestHigh = highest[14](close)
    LowestLow = lowest[14](close)
    ENDIF
    the previous statement doesn’t work.
    #237313 quote
    robertogozzi
    Moderator
    Master

    You DON’T have to use  1-hour TF, as I already said, because the TF  must be on a 30-minute boundary,

    Iván González thanked this post
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Identify time to calculate Highest High & Lowest Low


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
shabib @shabib Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by robertogozzi
1 year, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/08/2024
Status: Active
Attachments: No files
Logo Logo
Loading...