How to find the MAX valure of the last 10 to last 5 days?
Forums › ProRealTime English forum › ProScreener support › How to find the MAX valure of the last 10 to last 5 days?
- This topic has 12 replies, 4 voices, and was last updated 3 weeks ago by
robertogozzi.
-
-
11/25/2025 at 12:10 PM #253944
I can calculate the Amplitude between the highest and the lowest in the last 10 days as follow:
1234MyHighest = highest[10]MyLowest = lowest[10]Ampli = MyHighest - MyLowestBut if I want to calculate the Amplitude between the highest and the lowest between the last 20 and last 10 days. How to do?
11/25/2025 at 1:37 PM #253946there are 2 ways:
12345678910111213141516171819202122MyHighest = highest[10](high)[10]MyLowest = lowest[10](low)[10]Ampli = MyHighest - MyLowestmyHi=0myLo=9999999for i=10 to 19 doif high[i]>myHi thenmyHi=high[i]myHix=barindex[i]endifif low[i]<myLo thenmyLo=low[i]myLox=barindex[i]endifnextamp=myHi-myLoprint amp as "Loop"print Amplireturn1 user thanked author for this post.
11/25/2025 at 2:33 PM #253948if the effect the same, the first way is much simple than the second one, right?
11/25/2025 at 3:41 PM #25395112/13/2025 at 9:52 AM #254520Hi Ivan,
To your code “MyHighest = highest[10](high)[10]”, what does the first 10 mean and what the second 10? I can’t find this syntakt in the manual.
12/13/2025 at 12:08 PM #254524The 10 on the far left means that the search is for the highest price of the last 10 periods.
The 10 on the far right means you want to retrieve what the scan reported 10 bars ago.1MyHighest = highest[10](high)[10]It is equivalent to writing:
12MyHighest1 = highest[10](high)MyHighest2 = MyHighest1[10]I would like to point out that your line is NOT scanning for the highest price, but for the highest CLOSE, since you didn’t specify what to scan and so it defaults to CLOSE:
1MyHighest = highest[10](high) //MyHighest = highest[10] verwendet standardmäßig CLOSE1 user thanked author for this post.
12/13/2025 at 10:11 PM #254532Thanks!
In order to better understand what you said, here an example: Today is 13.12.2025. If I want to find the highst high between 01.12.25 and 05.12.2025, I have to do as follow?
MyHighest = highest[5](high)[8]
12/14/2025 at 10:11 AM #254539Hi,
You are using the instruction syntax correctly; however, you need to take into account that the instruction works with bars rather than dates…
The number of bars does not correspond one-to-one with calendar days due to holidays and weekends…
A bar represents a trading day, and on holidays and weekends the market is closed…
1 user thanked author for this post.
12/14/2025 at 5:08 PM #25454912/14/2025 at 6:45 PM #254550Thanks!
In order to better understand what you said, here an example: Today is 13.12.2025. If I want to find the highst high between 01.12.25 and 05.12.2025, I have to do as follow?
MyHighest = highest[5](high)[8]
Your line retrieves the highest price in a 5-day range, starting from the 8th bar prior to the current day (see attached pic).
1 user thanked author for this post.
12/14/2025 at 7:27 PM #254552Hi Roberto,
Your picture tells more than 1000 words. Many thanks! 🙂
1 user thanked author for this post.
12/15/2025 at 1:02 AM #25455312/15/2025 at 7:03 AM #254554That’s just an example not related to real data, as it’s a bit complicated to scan backwards for actual trading days before executing HIGHEST, etc…
-
AuthorPosts
Find exclusive trading pro-tools on