OPEN-SOURCE SCRIPT

Directional Movement Indicator (DMI and ADX) - Tartigradia

Güncellendi
Direction Movement Indicator (DMI) is a trend indicator invented by Welles Wilder, who also authored RSI.

DMI+ and DMI- respectively indicate pressure towards bullish or bearish trends.

ADX is the average directional movement, which indicates whether the market is currently trending (high values above 25) or ranging (below 20) or undecided (between 20 and 25).

DMX is the non smoothed ADX, which allows to detect transitions from trending to ranging markets and inversely with zero lag, but at the expense of having much more noise.

This is an extended indicator, from the original one by BeikabuOyaji, please show them some love if you appreciate this indicator:
ADX and DI


Usage: To use this indicator for entry: when DMI+ crosses over DMI-, there is a bullish sentiment, however ADX also needs to be above 25 to be significant, otherwise the move is not necessarily sustainable.

Inversely, when DMI+ crosses under DMI- and ADX is above 25, then the sentiment is significantly bearish, but if ADX is below 20, the signal should be disregarded.

This indicator automatically highlights the background in green when ADX is above 25, and in red when ADX is below 20, to ease interpretation.

Also, arrows can be activated in the Style menu to automatically show when the two conditions described above are met, or these can be used in a strategy.
Sürüm Notları
Set weekly timeframe as default, as it is much more useful on this timeframe than in any other.
Sürüm Notları
Update:
* Add other MA types, and set default to ZLMA, to make ADX react faster to trend changes.
* Add "Trend bar", which neatly summarizes all the infos given by this indicator in a colored bar.

Updated usage instructions:

To use this indicator for entry: when DMI+ crosses over DMI-, there is a bullish sentiment, however ADX also needs to be above 25 to be significant, otherwise the market is not trending.
When ADX is below 20, the market is ranging (no trend), and when ADX is between 20 and 25, the market is undecided (we don't know if it's trending or ranging).
Inversely, when DMI+ crosses under DMI- and ADX is above 25, then the sentiment is significantly bearish, but if ADX is below 20, the signal should be disregarded, since market is ranging.

This indicator automatically highlights the background in blue when ADX is above 25 to indicate that there is a trend, regardless of its direction, and in orange when ADX is below 20, indicating that the market is ranging.

There is a "Trend bar" at the bottom that allows for easy interpretation:
  • it is colored in green when the market is bullishly trending (DMI+ over DMI- and ADX > 25)
  • in red when market is bearishly trending (DMI+ under DMI- and ADX > 25)
  • in orange when market is ranging (ADX < 20)
  • in gray when market is undecided (20 <= ADX < 25)


To make trend changes signals appear faster, the default SMA calculations embedded inside the ADX and DMI calculations are replaceable by other types of moving averages. By default, a Zero-Lag Moving Average (ZLMA) is selected, as it provides a smooth yet very reactive signal.

To get the most reactive signal, smoothing can be disabled by highlighting the background and trend bar using DMX, which is the non-smoothed ADX, and is hence much more reactive but also much more noisy (disabled by default).

Finally, arrows can be activated in the Style menu to automatically show when the two conditions described above are met, or these can be used in a strategy.

By default, this indicator is set to always calculate on the weekly timeframe, as this is when the signals appear to be the most reliable. The timeframe can however be changed in the parameters, and can be set to "Chart" to adapt to currently user selected timeframe in TradingView.
Sürüm Notları
Update:
* Refactor code to make the moving average of DMI+ and DMI- configurable. But in practice, it's better to use the default "approximate_sma" for DMI+ and DMI-. However, for ADX, using another MA such as ZLMA greatly improves reactivity.
* Refactor code to standardize variables naming to conventional names (eg, DI -> DMI).
Sürüm Notları
Update:
* Add tooltips for DMI and ADX moving average type selectors in INPUTS parameters to describe the values to set to get the original indicators as defined by Welles Wilder.
Sürüm Notları
Update:
* fix plotshape so that long/short signals now work.
* change color palette to be visible to color blind individuals, and also to avoid misinterpretations (e.g., misunderstanding the ADX trend coloring the background in aqua does not mean that the market is bullish, just that it is trending in either direction).

Updated instructions:

This indicator automatically highlights the background in purple when ADX is above 25 to indicate that there is a trend, regardless of its direction, and in dark blue when ADX is below 20, indicating that the market is ranging. When the market is undecided, the background is not highlighted.

There is a "Trend bar" at the bottom that allows for easy interpretation:
* it is colored in green when the market is bullishly trending (DMI+ over DMI- and ADX > 25).
* in red when market is bearishly trending (DMI+ under DMI- and ADX > 25).
* in dark blue when market is ranging (ADX < 20).
* in gray when market is undecided (20 <= ADX < 25).
Sürüm Notları
Update:
* add signal when trend disappears
Sürüm Notları
Update:
* Remove -1 offset for bgcolor, it produced nonsensical results.
Sürüm Notları
* Cosmetic change: remove the signals values from being displayed in the indicator price line
ADXdirectionalmovementindexDMITrend Analysis

Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının yazarı komut dosyasını açık kaynak olarak yayınlamıştır, böylece yatırımcılar betiği anlayabilir ve doğrulayabilir. Yazar çok yaşa! Ücretsiz olarak kullanabilirsiniz, ancak bu kodun yayında yeniden kullanımı Ev kurallarına tabidir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?

Feragatname