I can’t think how to code a screener to detect a ‘consolidation range’ similar to attached.
Anybody seen code to do the job on here or got any ideas please?
Many Thanks
GraHal
You can try to test the difference in points between the highest high and lowest low over last X periods.
I’ve done the two below (some of your code I’m sure, Nicolas) but they may or may not result in a horizontal pattern.
hh = highest[60](high)[1]
ll = lowest[60](low)[1]
C1 = (hh-ll)<10*pipsize
C2 = Open > High[1] OR Open < Low[1]
Screener [C1 and C2] (hh-ll AS "Range")
fast = average[10](close)
slow = average[40](close)
spread = ((fast/slow)-1)*100
flatrange = ABS((lowest[60](low)-highest[60](high))/close)*100
c1 = fast>slow AND spread<10 AND close>fast AND flatrange<=15
SCREENER[c1] (flatrange as "Range")
I don’t know about the second one, but for the first one, it would do the job. You should look further back in the past?