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:
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")
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:
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
Increase = (Close > Close[1])
Count = 0
WHILE Increase[Count] DO
Count = Count + 1
WEND
RETURN Count
then we need the screener
//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
//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")
TO go a step further you could scan for ‘x’ greencandles lookbacking back 1 and no green candles current bar to find potential reversals