Adaptors Introduction
What is an adaptive indicator and an adaptor?
The most common question we get asked is: what is the difference between an adaptive indicator and a non-adaptive one, and why are adaptive indicators better? A simple moving average makes the idea easy to see. A standard 20-day simple moving average averages the price over the past 20 bars, and does the same on every bar of data. The trouble is that when the market is trending you might prefer a 30-day average to stay on the trend as long as possible, whereas when conditions turn volatile and trends are short and fast you might prefer a 15-day average to get in and out quickly. This is exactly what an adaptive indicator does.
An adaptor is the piece that decides the look-back to use. It is usually some measure of volatility or trend strength. Many adaptors return a value between 0 and 1, where 0 represents a very volatile, fast market and 1 a strong trending market. That value is then used to select how many periods the moving average should use on each bar: if the adaptor reads 0 the average uses 15 days, if it reads 0.5 it uses about 23 days, and so on. The resulting moving average is no longer stuck with a fixed look-back — it changes according to market conditions. In this case the Periods Minimum would be 15 and the Periods Maximum would be 30.
Not every adaptor works on the 0-to-1 scale. Some return the indicator period directly (typically somewhere in the range of about 15 to 60) and are fed straight into the indicator with no further processing. Others return a positive or negative value that is added to the indicator's normal period to produce the array of adjusted periods.
The indicators built into AmiBroker cannot accept a variable look-back — that is why only the indicators included in the toolbox can be made adaptive.
How an adaptor feeds an indicator
Every VariablePeriod* indicator takes a Periods array
— one period value per bar — in place of a single fixed number. That array
is exactly what an adaptor produces, so the two slot together directly:
periods = DominantCycle( Close );
Plot( VariablePeriodRSI( Close, periods ), "Adaptive RSI", colorRed );
Adaptor parameters
When you open the parameters of an adaptive indicator, the following options control the adaptor:
| Parameter | Description |
|---|---|
| Adaptor | Selects which adaptor to use (or None). |
| Adaptor Periods | When R Squared, Statistical or Trend Filter VHF is chosen, this sets the number of look-back periods the adaptor itself uses to measure trend, volatility and so on. |
| Number of Periods | When the adaptor is set to None, this is simply the fixed number of periods used for the indicator. When the adaptor is SNR or Enhanced SNR, this base figure is increased or decreased by the adaptor's output. |
| Periods Minimum / Periods Maximum | The lowest and highest number of periods that may be fed into the indicator. These apply when R Squared, Statistical or Trend Filter VHF is chosen; those adaptors vary the period between these two bounds. |
For example, if you apply the Adaptive Smoothed RSI with the adaptor set to None, the indicator's look-back is just the Number of Periods value. If you then switch the adaptor to R Squared, the adaptor's own look-back becomes equal to Number of Periods, and the period fed into the RSI is varied between Periods Maximum and Periods Minimum.
The adaptors
The adaptive indicators in the plugin can be driven by any of the following adaptors. The value range tells you what kind of output each one produces and therefore how it is applied to the indicator's period.
| Adaptor | Description & value range |
|---|---|
| Trend Filter VHF | The Vertical Horizontal Filter, created by Adam White, identifies trending versus ranging markets. It measures the level of trend activity, much as ADX does in the Directional Movement System. Returns a value between 0 and 1; the period is varied between Periods Minimum and Maximum. |
| Statistical | Measures the statistical correlation of price to a linear regression and compares it with previous values to judge whether the market is becoming more or less volatile. Returns a value between 0 and 1; the period is varied between Periods Minimum and Maximum. |
| Homodyne Discriminator | Measures the market's cycle using the homodyne discriminator method and adapts the indicator to the current cycle. Returns the indicator period directly. |
| Hilbert Transform | Measures the market's cycle using the Hilbert transform and adapts the indicator to the current cycle. Returns the indicator period directly. |
| Dominant Cycle | Estimates the dominant cycle length present in the market and adapts the indicator to it. Returns the indicator period directly. |
| SNR | Signal-to-noise ratio. Measures the amount of noise in the market: positive when there is a lot of noise, negative when there is little. Returns positive and negative values that adjust the Number of Periods up or down. |
| Enhanced SNR | A refined signal-to-noise measure that works the same way as SNR. Returns positive and negative values that adjust the Number of Periods up or down. |
| R Squared | Measures the strength of the current trend using the statistical R-squared of a linear regression. Returns a value between 0 and 1; the period is varied between Periods Minimum and Maximum. |