OPEN-SOURCE SCRIPT

DMI Stochastic Momentum Index

Cập nhật
Concepts

This is an improved version of the "DMI Stochastic Extreme Refurbished" indicator.

For more information on the main concepts of this indicator, please access this link:
DMI Stochastic Extreme Refurbished


The difference is that here, instead of using the traditional stochastic oscillator, I implemented the use of the Stochastic Momentum Index (SMI).


Stochastic Momentum Index (SMI)

The SMI is considered a refinement of the stochastic oscillator.
It calculates the distance of the current closing price as it relates to the median of the high/low range of price.
William Blau developed the SMI, which attempts to provide a more reliable indicator, less subject to false swings.

The original stochastic is limited to values from 0 to 100, while the SMI varies between the range of -100 to 100.
(Investopedia)

It is worth mentioning that the SMI presented in this script applies to the DMI value, not the screen price.
Phát hành các Ghi chú
- Now SMI can be based on DMI or price (conventional way).
- Regrouping of fields.
- Fine tuning in the alerts parameterization.
- Improved parameterization of colors.
- New level lines added.
Phát hành các Ghi chú

1. Modified default parameters.
2. Improved colors.
3. Changed bar graph to histogram.
4. Improved text.
5. Corrected color bar logic.
Phát hành các Ghi chú
Fixed histogram color when below zero.
Phát hành các Ghi chú
1. Updated code to use a library and save code.
2. Added Dynamic Zones.
3. Now the TSI is calculated only based on the DMI that is displayed on the screen via histogram, or via price (original SMI). Previously it could be displayed based on a second DMI parameter (which was not displayed in the histogram). This extra DMI parameter was removed in order to simplify the indicator.
4. Added themes.
5. Removed excess averages options.
6. Added bar\candlesticks coloring options.
7. Added intersection alerts.


▮ Complementing the description

The Directional Movement Index (DMI) is a technical indicator used in technical analysis to help determine whether an asset is in an uptrend, a downtrend, or a period of consolidation. It was developed by J. Welles Wilder Jr. and published in his book "New Concepts in Technical Trading Systems".

The DMI is made up of three lines: the ADX (Average Directional Movement Index) line, which indicates the strength of the current trend; the +DI (Positive Directional Indicator) line, which shows the strength of the uptrend; and the -DI (Negative Directional Indicator) line, which shows the strength of the downtrend.

When the ADX line is above 25, it indicates that there is a strong trend going on. When the +DI line crosses above the -DI line, it is a signal that the trend is changing into an uptrend. When the -DI line crosses above the +DI line, it is a signal that the trend is changing into a downtrend.

The DMI is a useful tool for traders and investors who want to spot trends and make informed decisions based on technical data. It is important to remember, however, that no technical indicator is foolproof and that technical analysis should be used in conjunction with other forms of analysis such as fundamental analysis and market sentiment analysis.

It is worth pointing out that the DMI used here, as proposed by the author of the 'DMI Stochastic Extreme' indicator (Barbara Star), refers to the absolute value between DI+ and DI-, that is, (DI+) - (DI-) = x.

▮ About Dynamic Zones

'Most indicators use a fixed zone for buy and sell signals.
Here's a concept based on zones that are responsive to the past levels of the indicator.'

The concept of Dynamic Zones was described by Leo Zamansky ( Ph .D.) and David Stendahl, in the magazine of Stocks & Commodities V15:7 (306-310).
Basically, a statistical calculation is made to define the extreme levels, delimiting a possible overbought/oversold region.

Given user-defined probabilities, the percentile is calculated using the method of Nearest Rank.
It is calculated by taking the difference between the data point and the number of data points below it, then dividing by the total number of data points in the set.
The result is expressed as a percentage.

This provides a measure of how a particular value compares to other values in a data set, identifying outliers or values that are significantly higher or lower than the rest of the data.

▮ Examples

- SMI DMI versus original SMI:
ảnh chụp nhanh
ảnh chụp nhanh

What the examples suggest is that the SMI is more effective at identifying overbought and oversold regions.
While SMI DMI, due to the nature of DMI, is more useful in identifying trends and divergences, presenting less noise in the histogram.
Phát hành các Ghi chú
Adjustment of default parameters.
Phát hành các Ghi chú
- Added new themes:
ảnh chụp nhanh

Examples:
ảnh chụp nhanh
ảnh chụp nhanh
ảnh chụp nhanh
ảnh chụp nhanh

- Added limits customization for gradient theme (last theme in the list, which is now 26):
ảnh chụp nhanh
ảnh chụp nhanh
Phát hành các Ghi chú
Minor fixes:
- The term "Opacity" was not correct. The correct one is "Transparency".
Phát hành các Ghi chú
- Added a parameter to customize the Histogram transparency level.
This can be useful to make the graph less cluttered in certain situations.
Below is an example with the type changed from Histogram to Area (in the Style tab), and then with the transparency level at 70%:

ảnh chụp nhanh

- New themes added.
The themes were reorganized by value ranges, in order to facilitate the choice and future implementations:
ảnh chụp nhanh

10 to 15 → Spectrum Blue-Green-Red
20 to 21 → Monokai
30 to 31 → Spectrum White-Green-Red
40 to 41 → Green-Purple
50 to 51 → Blue-Red
60 to 61 → Blue-Yellow
70 to 71 → Green-Red
80 to 81 → Green
90 to 91 → Purple
100 to 107 → Blue
120 to 123 → Blue-Aqua
130 to 133 → Blue-Green
140 to 153 → Red
160 to 161 → Red-Yellow
170 to 171 → Red-White
180 to 185 → White-Black
190 to 191 → Spectrum Blue-Red

Codes 190, 191:
ảnh chụp nhanh

- Fine adjustments were made in the standard parameters of Levels for TSI's Theme and Signal's Theme aiming at a better visualization of the colors.

- Added 2 color gradient format theme option for Histogram.
Example:
ảnh chụp nhanh

- Improved crossing alert messages. There are now 8 alerts available:

1. 'TSI crossing above Signal when within limits'
2. 'TSI crossing below the Signal when within limits'
3. 'TSI exiting the Dynamic Zone at the top'
4. 'TSI entering the Dynamic Zone at the top'
5. 'TSI exiting the Dynamic Zone at the bottom'
6. 'TSI entering the Dynamic Zone at the bottom'
7. 'TSI crossing above the centerline'
8. 'TSI crossing below the centerline'

There are now two ways to add alerts over here:

ảnh chụp nhanh

In the first form, technically speaking, the alert() function is used. This is the fastest way and works best with automations.
Alerts are chosen via indicator parameters. That done, then just add the "Any alert()" alert, as indicated in circle 1.

The second way is more laborious, but allows individual insertion of alerts.
Note that in this case, the checkboxes mentioned above make no difference.

Due to the added alerts using the alert() function, I had to remove the timeframe parameterization.
Phát hành các Ghi chú
Minor fixes
Phát hành các Ghi chú
New parameter to select a different timeframe.

ảnh chụp nhanh
ảnh chụp nhanh
Phát hành các Ghi chú
- Correction in theme "1" (User defined). The colors weren't showing up correctly.

Before:
ảnh chụp nhanh

After correction:
ảnh chụp nhanh

- Removed unnecessary "var" declarations in order to follow official best practices.

- Added new themes:
ảnh chụp nhanh
ảnh chụp nhanh
Phát hành các Ghi chú
Changes:

1. Added a repaint option (thanks for PineCoders).
2. Added a new option for Histogram: "Multiplier".
Using longer periods, the histogram can become flattened, making it difficult to see. The multiplier solves that.
3. DI Length for DMI Histogram: default value changed to 55.
4. Minor fixes in tooltips.
5. Source for price changed from hl2 to ohlc4.
6. TSI Long Length changed from 21 to 8.
7. TSI Short Length changed from 8 to 5.
8. Minor change in default colors.
9. Added separate alerts for TSI crosses inside/outside Dynamic Zone, with separate bounds for both.
Crossing points were repositioned to facilitate visualization.
10. Added trend lines with breakouts (thanks to HoanGhetti - tradingview.com/script/85fU3JnE-Simple-Trendlines/)
11. Added divergence detector (thanks to TradingView - tradingview.com/chart/?solution=43000589127)
12. Default values for histogram changed to match new values.
13. Removed alertcondition function to permit show divergence detector (due to limitation of maximum number of elements in screen).
Phát hành các Ghi chú
Minor fix in text
Directional Movement Index (DMI)DMIdmi_extremedmistochasticOscillatorsSMIStochastic Oscillator

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


To contribute to my work:
⚡Bitcoin Lightning: forwardocean64@walletofsatoshi.com
🟠Bitcoin: bc1qv0j28wjsg6l8fdkphkmgfz4f55xpph893q0pdh
🔵PayPal: paypal.com/donate/?hosted_button_id=D9KRKY5HMSL9S
Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm