Candles in a row
- This topic has 4 replies, 4 voices, and was last updated 7 years ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
Similar topics:
Forums › ProRealTime English forum › ProScreener support › Candles in a row
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
Topic moved to ProScreener forum section.
This code should do the trick:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
count = 0 for i = 0 to 9 do if close[i]>open[i] then count=count+1 endif if close[i]<open[i] then count=0 break endif next test = count>=5 screener[test] (count as "green candles") |
1 |
IF 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:
1 |
IF summation[10](close > open) = 6 THEN ... |
To adapt it to red candles you just need to replace “close > open” with “open > close”.
Roberto
this my version , first we need the consecutive green counter
1 2 3 4 5 6 |
Increase = (Close > Close[1]) Count = 0 WHILE Increase[Count] DO Count = Count + 1 WEND RETURN Count |
then we need the screener
1 2 3 4 5 6 7 8 9 10 11 12 13 |
//5 t0 10 green candles indicator1 = 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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
//5 t0 10 green candles variable a = 5 b = 10 indicator1 = 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") |
Find exclusive trading pro-tools on