andre_007

DMI Stochastic Momentum Index

andre_007 已更新   
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:

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.
版本注释:
- 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.
版本注释:
1. Modified default parameters.
2. Improved colors.
3. Changed bar graph to histogram.
4. Improved text.
5. Corrected color bar logic.
版本注释:
Fixed histogram color when below zero.
版本注释:
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:

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.
版本注释:
Adjustment of default parameters.
版本注释:
- Added new themes:

Examples:

- Added limits customization for gradient theme (last theme in the list, which is now 26):
版本注释:
Minor fixes:
- The term "Opacity" was not correct. The correct one is "Transparency".
版本注释:
- 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%:


- New themes added.
The themes were reorganized by value ranges, in order to facilitate the choice and future implementations:

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:

- 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:

- 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:


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.
版本注释:
Minor fixes
版本注释:
New parameter to select a different timeframe.

版本注释:
- Correction in theme "1" (User defined). The colors weren't showing up correctly.

Before:

After correction:

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

- Added new themes:
版本注释:
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 - www.tradingview.com/...E-Simple-Trendlines/)
11. Added divergence detector (thanks to TradingView - www.tradingview.com/chart/?solution=4...)
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).
版本注释:
Minor fix in text

To contribute to my work, I accept cryptocurrency donations.
⚡Bitcoin Lightning Network: forwardocean64@walletofsatoshi.com
🟠Bitcoin: bc1qv0j28wjsg6l8fdkphkmgfz4f55xpph893q0pdh
🔵Litecoin: ltc1q4lssqlf6lnmpe4w7npdl5ws2uamm4v5zxwmf5j
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?