- Let S = the set of of all data points you wish to analyze.
- Sort the set by ascending order.
- Chose a margin of error to which your support/resistance levels must conform.
- Progress from one end of the sorted set to the other, examining one data value at a time.
- Add the percentage error to the data value. See how many neighbors are less than this new value and remember exactly how many that is.
- Find the largest number of neighbors within that error margin. Take this group and average them. This is the support/resistance level with the greatest attraction.
Wikipedia has a lot of charts to illustrate support/resistance.