Using a variable in the screener ?
Forums › ProRealTime English forum › ProScreener support › Using a variable in the screener ?
- This topic has 6 replies, 3 voices, and was last updated 6 years ago by
bewoke2.
-
-
05/07/2019 at 10:05 AM #97826
Hello Folks !
Is it possible to use a variable in a screener ? let say for example I want to find gappers, my code will be something like:
123456789myGap = close[1]/open[0]if myGap > X thenmyResult = 1elsemyResult = 0endifscreener(myResult)So when I launch my screener, I may use X as input (X = 1.1 for example for a gap of 10%), is this kind of manoeuvre possible with PRT ?
Thanks !05/07/2019 at 10:59 AM #97829Yes.
Replace last line with:
1screener[myResult]05/07/2019 at 11:26 AM #9783305/08/2019 at 12:26 PM #97933It didn’t do quite as I want ! I think I wasn’t clear enough.
Here is how “exactly” my code will like.123456789myRSI = 0if Rsi[14](close) > X thenmyRSI = 1elsemyRSI = 0endifSCREENER(myRSI)So when I run the scanner, I should be able to input the variable “X” (65, 70, or 80…), it’s like having a global scanner for an RSI above a certain value.
It is like making a function in C code which takes an input from the user before displaying the result.But now, I get “X” is not defined (which is true)
Thanks!
05/08/2019 at 1:40 PM #97951It is not possible to have externally adjustable variables in a screener. You will need to manually modify the screener to change the value or set up multiple screeners one for each chosen value.
1 user thanked author for this post.
05/08/2019 at 1:41 PM #97952First, replace the last line with:
1screener[myResult]Then you will have to hard code X inside the code; screeners and strategies do not allow users to change data (only indicators can).
1 user thanked author for this post.
05/08/2019 at 2:04 PM #97959 -
AuthorPosts
Find exclusive trading pro-tools on