How can I screen such a signal with values of 0 and 1??
Forums › ProRealTime English forum › ProScreener support › How can I screen such a signal with values of 0 and 1??
- This topic has 10 replies, 4 voices, and was last updated 4 years ago by
thomas2004ch.
-
-
07/16/2020 at 8:51 PM #139449
Hi,
I create an indicator to check BULL and NON-BULL signals. If BULL the signal = 1. If NON-BULL the signal = 0. It looks like the screenshot in attachment.
Now I want to create a screener to find stocks which just change from NON-BULL to BULL (i.e from 0 to 1).
The following is my code but it screens nothing out.
123456indicator = CALL "Check_BULL"[10, 20]c1 = indicator >=1c2 = indicator[1] <= 0SCREENER[c1 and c2] ((close/DClose(1)-1)*100 AS "%Chg yest.")Where is the problem?
07/16/2020 at 9:42 PM #1394520 cannot be returned by indicators.
You can return any other value. Usually 1 is returned for bullish signals and -1 for bearish ones.
Your screener cannot return anything because you are asking that it returns only when opposite conditions are both true, which is impossible!
With the SCREENER keyword use OR within brackets, instead of AND.
07/16/2020 at 10:04 PM #139453thomas2004ch – Please use the ‘Insert PRT Code’ button when putting code in your posts as required by the few simple forum rules that you are asked to follow. I have edited your post to tidy it up for you on this occasion. 🙂
07/17/2020 at 8:37 AM #139481Hi robertogozzi ,
“Your screener cannot return anything because you are asking that it returns only when opposite conditions are both true, which is impossible!”
That is not correct. indicator and indicator[1] mean different, right? I want to scan stocks which changes from NON-BULL (yesterday) to BULL (today) as shown in my screenshot.
I tried your method and use 1 for BULL and -1 for NON-BULL. But it doesn’t work. I find nothing.
Here is my Check Indicator:
123456789101112131415161718192021222324// MAMA1 = ExponentialAverage[10](close)MA2 = ExponentialAverage[30](close)MA3 = ExponentialAverage[50](close)cL1 = (MA1 > MA2) and (MA2 > MA3)cL2 = close > MA1cL3 = (close crosses over MA3) and (close crosses over MA2)cL4 = (close crosses over MA2) and (close crosses over MA1)cE1 = (close crosses under MA1) and (close crosses under MA2)cE2 = (close crosses under MA2) and (close crosses under MA3)cE3 = (close[1] crosses under MA1) and (close crosses under MA2)cE4 = (close[1] crosses under MA2) and (close crosses under MA3)cE5 = (close[1] crosses under MA3) and (close < MA3)exit = cE1 or cE2 or cE3 or cE4 or cE5if not exit and cL1 thenoutput = 1elseoutput = -1endifRETURN output as "Check Triple MA"And here again my Screener:
12345indicator = CALL "20200716_Check_MA_10_20_30"[10, 20, 30]c1 = indicator > 0 // today is BULLc2 = indicator[1] < 0 // yesterday NON-BULLSCREENER[c1 and c2] ((close/DClose(1)-1)*100 AS "%Chg yest.")07/17/2020 at 11:39 AM #139500You are righe about my remark, I did not notice the difference between c1 and c2. That’s because in such cases I usually write just one line:
1c1 = indicator CROSSES OVER 0I have tried several changes, but nothing worked. I also posted some code, but within seconds I realized it did not work and I deleted it (you may have received an email about this).
It still does not return what you want.
I suggest that you hit Ctrl+M from your platform to open a ticket with PRT’s assistance.
07/18/2020 at 9:54 AM #13954007/20/2020 at 9:08 AM #139645Hi Nicolas,
Now I combine the indicator and screener as follow but it still doesn’t work. :-\
123456789101112131415161718192021222324252627// sample screener code// MAMA1 = ExponentialAverage[10](close)MA2 = ExponentialAverage[30](close)MA3 = ExponentialAverage[50](close)cL1 = (MA1 > MA2) and (MA2 > MA3)//cL2 = close > MA1//cL3 = (close crosses over MA3) and (close crosses over MA2)//cL4 = (close crosses over MA2) and (close crosses over MA1)cE1 = (close crosses under MA1) and (close crosses under MA2)cE2 = (close crosses under MA2) and (close crosses under MA3)cE3 = (close[1] crosses under MA1) and (close crosses under MA2)cE4 = (close[1] crosses under MA2) and (close crosses under MA3)cE5 = (close[1] crosses under MA3) and (close < MA3)exit = cE1 or cE2 or cE3 or cE4 or cE5if not exit and cL1 thenoutput = 1elseoutput = -1endifc1 = output crosses over 0SCREENER[c1] ((close/DClose(1)-1)*100 AS "%Chg yest.")07/20/2020 at 9:23 AM #139652At line 22 use a positive digit for bearish values.
Ngative values are accepted by indicators, but not by screeners.
07/20/2020 at 12:39 PM #139679Ok. Now I change the code as follow, but still doesn’t work:
12345678910...if not exit and cL1 thenoutput = 3elseoutput = 1endifc1 = output crosses over 2...07/20/2020 at 1:53 PM #139685You are right, there’s no way to make it work.
I suggest that you press Ctrl+M from the platform to ask for assistance from PRT.
07/20/2020 at 7:35 PM #139704 -
AuthorPosts