I am not sure NumInRange itself is suitable since it counts bars without considering their range.

Instead decide a bin width, let's say 10 pips. Make a loop and count bins by checking low and high of each bar. Now you have a histogram. Then you can check peaks, valleys or low count bins next to high count bins for SR zones. You need to quantify "low count" and "high count" for computer as well.

Last edited by ozgur; 08/20/20 05:58.