Bar Index – Proscreener
Forums › ProRealTime English forum › ProScreener support › Bar Index – Proscreener
- This topic has 6 replies, 5 voices, and was last updated 5 years ago by robertogozzi.
-
-
10/28/2017 at 4:08 PM #50785
Can anyone help me on this matter ? I have a problem of finding a way to rerun a bar index of highest or lowest criteria. For example I want to find out what is bar index of this statement?
highest [250](rsi[14](close)).
Is it possible to get the bar index of such statement. Just to make it clear, I want to know what is bar index that maximum or minimum RSI happened in the last 250 bars?
Thanks in advance for your help.
Hamid10/28/2017 at 5:37 PM #50792This could be possible by making a loop through the last 250 periods to find the lowest low and highest high of the RSI:
RSI highest high BARINDEX1234567891011mrsi = rsi[14]hrsi = 0for i = 0 to 250 doif mrsi[i]>hrsi thenhrsi=mrsi[i]hbar=barindex[i]endifnextreturn hbarRSI lowest low BARINDEX1234567891011mrsi = rsi[14]lrsi = 10000for i = 0 to 250 doif mrsi[i]<lrsi thenlrsi=mrsi[i]lbar=barindex[i]endifnextreturn lbarNot tested, please give us feedback if these codes are working correctly.
10/29/2017 at 10:10 AM #50811Thank you for your reply. But I have tested this method before, But I don’t know why proscreener doesn’t accept any loop more than 100, it will give an error as infinite loop exit in the code. I want to write a code to find trend of rsi in rising or falling channel. For example something like the image attached. Below is the code I have done so far, sometime it will work fine sometime not. did you come with this idea before or do you have this kind of code?
123456789101112131415161718192021222324252627282930313233343536373839404142434445MinimumRsi=100meet=0For x=1 to 100 Do //loop through 100 bar to find Min RsiIF rsi[14](close)[x] < MinimumRsi THENMinimumRsi=rsi[14](close)[x]barNb=xENDIFNEXTisBearish=0For x=1 to 20 Do // if first 20 bar RSI is less than 40 is bearish modeIF rsi[14](close)[x] < 40 THENisBearish=1breakENDIFNEXTfail=1m=(rsi[14](close)[0]-MinimumRsi)/(0-barNb) //find equation of a line with two points y=mx+b m is slope and b is is the y-intercept.b=MinimumRsi-(barNb*m)FOR i=1 to barNb DOy=m*i+bIF y+0.1 > rsi[14](close)[i] AND y-0.1 < rsi[14](close)[i] THENmeet=meet+1ENDIFIF y -0.1 > rsi[14][i] THENfail=0breakENDIFNEXTcondition=0IF meet >=1 THENcondition=1ENDIF// if current stock rsi is close to the lineSCREENER [condition AND fail AND isBullish]10/29/2017 at 2:35 PM #5082212/14/2017 at 12:05 AM #55622Hello Hamid and Nicolas, i came to this post casually only now.
To find the barindex of the highest[250] of RSI you can use this code:
barindex finder highest12345678//RSI highest high BARINDEXmyrsi = rsi[14]c1=myrsi>highest[250](myrsi)[1]if a thenmyindex=barindexendifbarHH=barindex[0]-myindexreturn barHHWhen it gives you 0, it means the highest or lowest value of RSI is in the current bar.
barindex finder lowest RSI12345678//RSI lowest low BARINDEXmyrsi = rsi[14]c1=myrsi<lowest[250](myrsi)[1]if c1 thenmyindex=barindexendifbarLL=barindex[0]-myindexreturn barLLI hope this can help you!
Max
1 user thanked author for this post.
11/03/2019 at 7:58 PM #111956Hello maximus78, your code is correct and working perfectly, thank you!
I miss only one thing: how can I exclude from the calculation a certain number of latest bars? For example if I want to find the Bar Index of highest RSI of last 250 excluding last month (20 bars)?
Thank you in advance
Matteo
11/03/2019 at 8:42 PM #111958ProScreen only supports the last 254 bars.
Maximus78’s code should not work. It’s odd if it does!
-
AuthorPosts
Find exclusive trading pro-tools on