In this post a simple price frequency analysis technique will be revealed and utilized to display support and resistance zones. The concept of support/resistance is commonly used in technical analysis and is usually represented as levels that act as price barriers. Price usually bounces back from these support/resistance lines or if overcome a strong price movement (breakout) is usually observed.
First let’s explain the idea of price frequency analysis. It attempts to show how often the price of an instrument is at a certain level or how many times some price level has been reached. Once we have that information we can then make some interpretations. There are different ways of analyzing the price data and here we will use a simple method. The method that I will show is commonly used in image processing and is called pixel binning. Since images contain a large amount of pixels, it can be very resource intensive to analyze all the pixels one by one. Instead they can be grouped into a smaller number of bins. Each bin contains the number of pixels that have some similarity, like color for example. Then it becomes much easier to analyze the resulting bins or the so called histogram.
In our case we start by first defining how many data points (candles or bars) we want to analyze. Then we find the highest and lowest points in our data set. This gives us also the entire price range that’s being analyzed. The whole range is then divided into several equal smaller price ranges (bins), for example 32. All 32 bins have a value of 0 in the beginning. The hard work then follows: we go through all bars one by one and for each bar we check if it’s high, low or close prices fall into which bin. For example, if it happens that the examined candle’s close price is in sub-range number 3, we increment the value of third bin by one. At the end of the process we have an array of 32 elements, each one containing some number. That number actually is the number of candles that fell into that particular sub-range. From here we just look at the elements that contain the largest numbers. It means that in that particular price are most of the bars appeared. The largest element from the upper half of the array will correspond to the strongest resistance zone, while the largest element from the lower half of the array will give us the strongest support zone.
It should be noted that the number of bins should be in range 16-32 and the number of bars analyzed an order of magnitude greater. Here’s a screenshot of an MT4 indicator that plots the results graphically for EUR/USD:


forex forum