SRLevelsArgo: Mathematically exact determination of Support and Resistance Levels of price

0011The topic of the present article is automatic determination of the key levels of price, known also as Support and Resistance levels. For many experienced traders, these levels are among the most important elements in their trading strategies. In particular, Support and Resistance levels are the basic tool in the wide class of trading methods known as Price Action. Some traders are convinced that for obtaining the best results, one needs to determine the price levels manually. It might be so – at least, for experienced trades – but even for them it might be useful to compare the results of their analysis with the opinion of an independent and competent automatic expert.

There are plenty of indicators developed for automatic determination of price levels, many of which are available free of charge. However, I haven’t met so far an indicator that satisfies my needs and quality criteria. Some indicators draw too few levels, and some draw too many. Some indicators use rather crude algorithms (the most popular approach is based on fractals and their generalizations), and some overload and hang up even the powerful computers.

My conclusion was that I need a dedicated price level indicator that does exactly what is needed, and does it quickly and precisely. First of all, let us formulate the task. What do we want? We need an indicator that shows just two price levels, one below the current price (support) and the other above the current price (resistance). These price levels need to be the strongest levels in the given range. For example, we define the range of 100 pips from the current price and the indicator shows us two strongest levels in this range. It is highly desirable also to have the possibility to estimate the strength of the levels, e.g., its prominence among the neighboring price levels.

How to use such indicator?

  1. If we have an open trade, we can use the price levels in order to take off the profits.
  2. If we are looking for the entry point for the new trade and believe that the probable scenario is “bouncing back”, we can place a limit order at the price level.
  3. If we are looking for the entry point for the new trade and believe that the probable scenario is “break through”, we can place a stop order behind the price level.
  4. If we are using a grid martingale strategy, the price level is a good place for opening the next grid level.


How do we determine the levels of support and resistance? There are two main approaches to this problem. The first approach collects the turning points of price and determines the levels around which turning points tend to group. There is also an alternative approach, which searches for the price levels that were crossed by price maximally often. On the first glance, these two approaches do completely different jobs, but in practice they turn out to produce very similar results. In other words, the price tend to spend much time at the levels of past turning points, and vice versa, at the levels where the price spent much time in the past, it tends to turn back and make a local extremum.

We will use the second method, namely, looking for the levels where the price has been maximal number of times. If we had the complete tick data at our disposal for a large period of time, it would have been an easy task: just select the tick price that was registered the maximal number of times.  Unfortunately, MetaTrader4 does not store the tick data. So, we have to use the price data on different timeframes, which are stored by MetaTrader4. The smaller timeframe we use, the better the results are. So, should we use M1 timeframe? Not necessarily. The point is, the number of M1 bars that is provided by brokers for MetaTrader4 terminal is usually limited by a couple of months. But we know that for the determination of price levels one needs to analyze a larger period of time. Strong support and resistance levels are known to live for months and even years. So, by default, we will use the period of one year for our analysis. The indicator will automatically use the smallest timeframe for which the historical data for the required period is available.

As a technical basis for our indicator, we used the freeware indicator TPO-Range TPO-Range is a good indicator as it is, but it has also several technical drawbacks and also does not fulfill the requirements we have in mind for our indicator.

So, let me now present indicator SRLevelsArgo.


The indicator shows the strongest level of support and the strongest level of resistance from the given price range, defined by the distance from the current price. Apart from the two levels, the indicators displays vertical histogram of the historical price level distribution in the right field of the price chart. The histogram allows the user to visually estimate the strength of the support and resistance levels and to analyze the market profile.


RangeDays – time period for the analysis (days). Default value is 365 (one year).

RangePips – price range for the analysis. Indicator determines the support and resistance levels in the range: current price +- RangePips pips.

MinPips – minimal distance of the level from the current price.

HGColor – histogram color.

LevelColor – levels color.

LevelStyle – levels style (0 – solid, 1 – dash).

LevelWidth – levels thickness.

Debug – enables printing debug information output in the log.

Information for users:

The indicator needs the historical price quotes for a large period of time (by default, one year). For most brokers, the smallest timeframe with an one-year history depth is M15. So, for optimal results, one need to load the M15 price quotes for the whole period of time. This can be done by switching to the M15 timeframe and pressing the key HOME until the quotes are loaded. It might be convenient to use the script Key_Home that emulates pressing key HOME. The indicator can be then used on any timeframe. It will automatically find and use the quotes from the smallest timeframe which are available.


audcad 1

eurusd 1

gbpusd 1

Download SRLevelsArgo

Author: Vladimir aka loopsider

Tagged with: ,
Posted in Content