type
status
date
slug
summary
AI summary
AI translation
tags
category
password
icon
By registering an account on OKX Crypto Exchange using the invitation link from blackcat1402, you can enjoy several benefits. These include a 10% rebate on spot contract trades, a 20% discount on fees, permanent access to blackcat1402 Membership and Advanced Indicators, free internal testing of the Advanced Trading System, and exclusive services such as member technical indicator customization and development.
OKX Crypto Exchange blackcat1402 invitation registration link:
Today, I'm going to show you a technical analysis tool called the "Directional Movement Indicator" (DMI). This indicator was introduced by the technical analysis master J. Welles Wilder in 1978. Don't underestimate it, because just like the Relative Strength Index (RSI) and Average True Range (ATR), it is also a masterpiece by Wilder!
Firstly, DMI consists of three components, namely the Average Directional Index (ADX), Positive Directional Indicator (+DI), and Negative Directional Indicator (-DI). These three components work together to help traders identify and measure the strength and direction of the market trend. Doesn't it sound like a magical team?
Now, let's talk about how these buddies work. +DI and -DI are calculated by analyzing the highest and lowest prices in the market. Their main task is to tell you, "Hey, is the market going up or down?" Then, ADX steps in and doesn't care if the market is rising or falling, it only cares about "is this trend stable?" Simply put, ADX is like a focused and dedicated driver, only concerned about the smoothness of the speed.
For the specific calculation method, first, we need to find the highest and lowest prices of each period, then calculate the upward and downward movements. If the upward movement is greater than the downward movement, it is considered a positive direction; otherwise, it is considered a negative direction. Next, we need to smooth out these data using something called Average True Range (ATR), and finally multiply them by 100 to obtain +DI and -DI.
Calculating ADX is even more interesting. It is obtained by calculating the absolute difference between +DI and -DI, then dividing it by their sum, and multiplying it by 100. The larger this value, the more stable the trend. Wilder stated that ADX exceeding 25 indicates a significant market trend, while below 20 means a weak or nonexistent trend. However, each market has its own characteristics, so this value is not fixed.
Another important use of DMI is to generate trading signals. When the +DI line and -DI line cross, it could be a signal to buy or sell. However, keep in mind that the reliability of this signal depends on the value of ADX. The higher the ADX value, the more reliable the signal. At the same time, setting appropriate stop-loss is crucial.
Although DMI may sound like a panacea, it does have its limitations. Wilder originally designed DMI for currency and commodity markets, which typically have greater volatility and clearer trends than stock markets. Therefore, when using DMI in the stock market, some adjustments may be necessary.
In summary, DMI is a very powerful tool, but in order to truly master it, continuous learning and practice are necessary. By combining historical analysis and experience, traders can better understand and apply DMI, making it a part of their trading strategies.
This code is an indicator for calculating the Directional Movement Index (DMI). It uses the Pine Script language on the TradingView platform.
First, in the line
//@version=5
, the script declares the version number as 5.Next, in the
indicator()
function, some parameters are set:title="Directional Movement Index"
: The indicator title is set as "Directional Movement Index".
shorttitle="DMI"
: The abbreviation title is set as "DMI".
format=format.price
: The price formatting is set to the default value.
precision=4
: The decimal point precision is set to 4.
timeframe=""
: The timeframe is set as an empty string, indicating the current chart's timeframe.
timeframe_gaps=true
: Allows displaying gaps between timeframes on the chart.
Then, two variables are defined:
lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50)
: Defines an integer input variablelensig
with a default value of 14, a minimum value of 1, and a maximum value of 50. This variable controls the smoothing of ADX.
len = input.int(14, minval=1, title="DI Length")
: Defines another integer input variablelen
with a default value of 14 and a minimum value of 1. This variable controls the length of DI.
Next, the specific calculations are performed:
- First, the
ta.change()
function is called to calculate the price changes for up and down movements, which are assigned to the variablesup
anddown
, respectively.
- Then, the variables
plusDM
andminusDM
are calculated based on certain conditions. Ifup
is greater thandown
and greater than 0,up
is assigned toplusDM
. Ifdown
is greater thanup
and greater than 0,down
is assigned tominusDM
. Otherwise,plusDM
andminusDM
are both set as "na" (not available).
- Next, the
ta.rma()
function is used to calculate three variables:trur
,plus
, andminus
: trur
represents the true range, which is calculated using theta.tr
function.plus
represents the +DI indicator and is calculated based onplusDM
,len
, andtrur
.minus
represents the -DI indicator and is calculated based onminusDM
,len
, andtrur
.
Finally, the script plots the ADX, +DI, and -DI lines on the chart and sets their colors.
- Author:blackcat1402
- URL:https://www.tradingview.com/u/blackcat1402//article/dmi-race-track-en
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts