Identify time to calculate Highest High & Lowest Low
Forums › ProRealTime English forum › ProBuilder support › Identify time to calculate Highest High & Lowest Low
- This topic has 4 replies, 2 voices, and was last updated 5 months ago by
robertogozzi.
-
-
09/08/2024 at 2:19 AM #237304
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)
12345678startime = 010000endtime = 163000// calculate highest high and lowest low of the last 15 hours , start calculation at 4:30 pmif time = endtime thenHighestHigh = highest[15](Close)LowestLow = lowest[15](close)ENDIFThe 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
09/08/2024 at 8:01 AM #237308Your 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:
123456789101112starttime = 010000endtime = 163000once HI = 0once LO = 999999if opentime = starttime thenHI = highLO = lowendifif (opentime > starttime) and (opentime <= endtime( thenHI = max(HI,high)LO = min(LO,low)endif1 user thanked author for this post.
09/08/2024 at 11:19 AM #237311Modification :
// calculate highest high and lowest low of the first 14 hours , from 01 am to 4:00 pm , the calculation will happen at 4:30if Time >= starttime AND Time <= endtime ThenHighestHigh = highest[14](close)LowestLow = lowest[14](close)ENDIF09/08/2024 at 11:26 AM #237312Your 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:
123456789101112starttime = 010000endtime = 163000once HI = 0once LO = 999999if opentime = starttime thenHI= highLO= lowendifif (opentime > starttime) and (opentime <= endtime( thenHI= max(HI,high)LO= min(LO,low)endifThank 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 lowestThe calculation itself is working with me , which isHighestHigh = 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 ThenHighestHigh = highest[14](close)LowestLow = lowest[14](close)ENDIFthe previous statement doesn’t work.09/08/2024 at 12:39 PM #237313You DON’T have to use 1-hour TF, as I already said, because the TF must be on a 30-minute boundary,
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on