Screener return values
Forums › ProRealTime English forum › ProScreener support › Screener return values
- This topic has 7 replies, 2 voices, and was last updated 1 year ago by OllieB.
-
-
08/14/2023 at 2:16 PM #219052
Hi,
I have created a screener for searching for bullish and bearish conditions. I have set it to return -1 for the bearish results and 1 for the bullish results.
The screener only ever returns bullish conditions. I have coded up EXACTLY the same indicator and it works a treat.
I then set the screener to return 1 for bullish and 2 for bearish, and it worked fine!
This indicates that the screener cannot return negative values, or i am doing something wrong!
Can anyone please help with this?
Thanks.
08/15/2023 at 7:32 AM #219094Hi,
Here is an example of a screener that shows 1 for bullish and -1 for bearish…
In case of other problems, you will have to display your code…
Bullish and Bearish Engulfing12345678910C1 = Close[1] < Open[1] and Open < Close[1] and Close > Open[1] // Bullish EngulfingC2 = Close[1] > Open[1] and Open > Close[1] and Close < Open[1] // Bearish EngulfingIf C1 thenUp = 1elsIf C2 thenUp = -1EndIfSCREENER[C1 or C2](Up as "Bullish = 1 Bearish = -1")1 user thanked author for this post.
08/16/2023 at 6:40 PM #21920212345678c8MABounce = 0if c8MABounceUp thenc8MABounce = 1elsif c8MABounceDn thenc8MABounce = 2endifscreener[c8MABounce](c8MABounce AS "8MA")Hi,
Many thanks for the reply. I will use that.
The key section from my code is attached. So this returns a 1 or a 2 as expected. If i substitute the return value 2 for a -1 then the -1 doe snot get returned. Its as if the screener can only return positive values.
Thanks.
08/16/2023 at 6:58 PM #219205Hi,
As you can see in my last/previous screenshot, it is not a problem for a screener to display negative values… 🙂
Unfortunately, I can’t try your screener because it’s not complete…
Try your screener without the first line…”c8MABounce=0″…
1 user thanked author for this post.
08/16/2023 at 9:46 PM #219223Hi again,
Yes, I have used your version now with my screener and it works great, thank you. 🙂 I see “1”s and “-1″s. I am now just curious, for my own education, why my version does not work.
A slimmed down edit (functional) of the full version of my screener is attached, so the variable names don’t make sense. However, it works enough to prove my point in that the screener, when written like this, does not return negative values. If you run this code against FX pairs, for example, AUDCAD does not appear in the results. The only results that show are with a “1”.
Its going to be something obvious but I just can’t see it………
Thanks again for your help.
PS, removing the ”c8MABounce=0″ makes no difference
1234567891011121314151617181920timeframe (DAILY)cMA21 = Average[21](Close)cMA50 = Average[50](Close)cMA200 = Average[200](Close)cMAOrderUp = (cMA21 > cMA50) AND (cMA50 > cMA200)cMAOrderDn = (cMA21 < cMA50) AND (cMA50 < cMA200)c21MABounceUp = (cMAOrderUp)c21MABounceDn = (cMAOrderDn)c21MABounce = 0if c21MABounceUp thenc21MABounce = 1elsif c21MABounceDn thenc21MABounce = -1endifscreener[c21MABounce] (c21MABounce AS "21MA")rem screener[TrendTemplate](Ratio AS "Perf")08/16/2023 at 10:20 PM #219229Hi,
In your screener, you need to add the different conditions that can be true or false…
Screener[c21MABounceUp or c21MABounceDn](c21MABounce as “21MA”)
MA Bounce12345678910111213141516171819timeframe (DAILY)cMA21 = Average[21](Close)cMA50 = Average[50](Close)cMA200 = Average[200](Close)cMAOrderUp = (cMA21 > cMA50) AND (cMA50 > cMA200)cMAOrderDn = (cMA21 < cMA50) AND (cMA50 < cMA200)c21MABounceUp = (cMAOrderUp)c21MABounceDn = (cMAOrderDn)c21MABounce = 0if c21MABounceUp thenc21MABounce = 1elsif c21MABounceDn thenc21MABounce = -1endifscreener[c21MABounceUp or c21MABounceDn] (c21MABounce AS "21MA")1 user thanked author for this post.
08/16/2023 at 10:36 PM #219231Hi,
This will make your screener beter readable… if you want that 🙂
MA Bounce1234567891011121314cMA21 = Average[21](Close)cMA50 = Average[50](Close)cMA200 = Average[200](Close)C1 = (cMA21 > cMA50) AND (cMA50 > cMA200)C2 = (cMA21 < cMA50) AND (cMA50 < cMA200)if C1 thenc21MABounce = 1elsif C2 thenc21MABounce = -1endifscreener[C1 or C2] (c21MABounce AS "21MA")1 user thanked author for this post.
08/17/2023 at 2:01 PM #219252 -
AuthorPosts
Find exclusive trading pro-tools on