what is the purpose of the indicator? When short-length moving averages are used as trailing stops, they cause exiting the trade too early. Keeping the length value too high will result in exiting the transaction too late and losing most of the profits earned. I aimed to prevent this problem with this indicator.
what is "Adaptive Moving Average"? it is a moving average that can change its length on each candle depending on the selected source.
what it does? The indicator first finds the average lengths of the existing candles and defines different distances accordingly. When the moving average drawn by the indicator enters the area defined as "far" by the indicator, the indicator reduces the length of the moving average, preventing it from moving too far from the price, and continues to do so at different rates until the moving average gets close enough to the price. If the moving average gets close enough to the price, it starts to increase the length of the average and thus the adaptation continues.
how it does it? Since the change of each trading pair is different in percentage terms, I chose to base the average height of the candles instead of using constant percentage values to define the concept of "far". While doing this, I used a weighted moving average so that the system could quickly adapt to the latest changes (you can see it on line 17). After calculating what percentage of the moving average this value is, I caused the length of the moving average to change in each bar depending on the multiples of this percentage value that the price moved away from the average (look at line 20, 21 and 22). Finally, I created a new moving average using this new length value I obtained.
how to use it? Although the indicator chooses its own length, we have some inputs to customize it. First of all, we can choose which source we will use the moving average on. The "source" input allows us to use it with other indicators.
"max length" and "min length" determine the maximum and minimum value that the length of the moving average can take.
Apart from this, there are options for you to add a standard moving average to the chart so that you can compare the adaptive moving average, and bollinger band channels that you can use to create different strategies.
This indicator was developed due to the need for a more sophisticated trailing stop, but once you understand how it works, it is completely up to you to combine it with other indicators and create different strategies.
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.
Möchten Sie dieses Skript auf einem Chart verwenden?
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.