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:
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 !
bewoke2– Please always use the ‘Insert PRT Code’ button when posting any code as it makes it far more readable for everyone else. I have tidied up your post for you 🙂
It didn’t do quite as I want ! I think I wasn’t clear enough.
Here is how “exactly” my code will like.
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:
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).