Candles in a row
Forums › ProRealTime English forum › ProScreener support › Candles in a row
- This topic has 4 replies, 4 voices, and was last updated 7 years ago by
Nobody.
-
-
10/05/2017 at 12:26 PM #48267
Hi,
Could someome provide me with code that I can use in the ProScreener?
I would like the screener to find all stocks that have between 5 to 10 green candles in a row
Thanks
10/05/2017 at 1:16 PM #48285Topic moved to ProScreener forum section.
This code should do the trick:
1234567891011121314count = 0for i = 0 to 9 doif close[i]>open[i] thencount=count+1endifif close[i]<open[i] thencount=0breakendifnexttest = count>=5screener[test] (count as "green candles")10/05/2017 at 1:31 PM #48289Candles in a row1IF summation[5](close > open) = 5 THEN ...Of course you might want to change the value 5 with one that best suits you.
Also, you my assign the result to a variable.
Should you need to check that the green candles need not be consecutive, i.e. 6 out of the last ten:
1IF summation[10](close > open) = 6 THEN ...To adapt it to red candles you just need to replace “close > open” with “open > close”.
Roberto
1 user thanked author for this post.
11/25/2017 at 4:13 AM #53884this my version , first we need the consecutive green counter
123456Increase = (Close > Close[1])Count = 0WHILE Increase[Count] DOCount = Count + 1WENDRETURN Countthen we need the screener
12345678910111213//5 t0 10 green candlesindicator1 = CALL "CC UP"c1 = (indicator1 >= 5)indicator2 = CALL "CC UP"c2 = (indicator2 <= 10)criteria = CALL "CC UP"SCREENER[c1 AND c2] (criteria AS "CC UP")you could make the cl and c2 inputs variables to make scan more versatile as well
12345678910111213141516//5 t0 10 green candles variablea = 5b = 10indicator1 = CALL "CC UP"c1 = (indicator1 >= a)indicator2 = CALL "CC UP"c2 = (indicator2 <= b)criteria = CALL "CC UP"SCREENER[c1 AND c2] (criteria AS "CC UP")11/25/2017 at 4:18 AM #53885 -
AuthorPosts