Using a variable in the screener ?
- This topic has 6 replies, 3 voices, and was last updated 5 years ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
Similar topics:
Forums › ProRealTime English forum › ProScreener support › Using a variable in the screener ?
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:
1 2 3 4 5 6 7 8 9 |
myGap = close[1]/open[0] if myGap > X then myResult = 1 else myResult = 0 endif screener(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 !
Yes.
Replace last line with:
1 |
screener[myResult] |
It didn’t do quite as I want ! I think I wasn’t clear enough.
Here is how “exactly” my code will like.
1 2 3 4 5 6 7 8 9 |
myRSI = 0 if Rsi[14](close) > X then myRSI = 1 else myRSI = 0 endif SCREENER(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!
It 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.
First, replace the last line with:
1 |
screener[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).
Find exclusive trading pro-tools on