AIS Adaptive Nonlinear Smoothing
Very often, in the study of financial series apply their smoothing. Using smoothing, you can remove high-frequency components - it is believed that they are caused by random factors and therefore irrelevant. Smoothing always includes some way of averaging the data, in which random changes in the time series mutually absorb each other. Most often, for this purpose, simple or weighted moving average methods are used, as well as exponential smoothing.
Each of these methods has its advantages and disadvantages. Thus, a simple moving average is simple and intuitive, but its application requires the relative stability of the periodic and trend components of the time series. In addition, a signal delay is characteristic of a moving average. The exponential smoothing method is free from the lag effect. But even here there are flaws - exponential smoothing is effective only when aligning the series with random outliers.
A reasonable compromise between simple and exponential averages is the use of a weighted moving average. However, there is the problem of choosing specific weight values. Let's try to sort this out together.
So, first define what we would like to achieve from the smoothing procedure:
• first, we need to remove random changes and noise from the price series;
• secondly, we would like to identify abnormal emissions and unusual price behavior, which can also be used in trade;
• and finally, the averaging procedure should identify sustainable trends if they are present in the market.
And, of course, we would like the smoothing procedure to be adapted to the current market situation.
In order to get the desired result, we will calculate weights depending on how far this price level is from the maximum and minimum prices for the study period. Through this approach, we get a filter that implements the smoothing procedure depending on the distribution of prices for the period of interest.
The main advantage of such a smoothing algorithm is its stability with respect to various kinds of emissions: price deviations can be very large, but the filter will still follow the most significant trends. In addition, with different initial data, we can get different in its essence effects. So, if prices are distributed more or less evenly, then we will get a moving median filter. If prices accumulate around one value and a sufficiently large difference between the maximum and minimum we get modal smoothing. If all prices lie within a very narrow interval, then we get a simple moving average.
The main disadvantage of this method is that smoothing is performed without taking into account price changes over time. Indeed, we can arbitrarily change the order of the prices within the analyzed period - this does not affect the result of the calculations. Thus, we can say that this algorithm considers the price change as a random process.
Despite this drawback, let's see how this algorithm works on real data. In this case, we proceed as follows: first, we will smooth the prices of Open, High and Low separately from each other, and then all prices together. Smoothing all prices at the same time will allow us to judge how stable the price behavior is in general. The blue line will show the smoothing of High prices, the red line - Low, and the green line will indicate the smoothing of opening prices. The white dotted line shows the smoothing of all prices at the same time.
- LH is a parameter that sets the number of bars used for analysis. Its allowable value is in the range of 0 - 255, while the real number of bars is one more.