OPEN-SOURCE SCRIPT

Volatility System by W. Wilder

Volatility System (Volatility Stops) Similarity
Most traders adjust their stops over time in the direction of the trend in order to lock in profits. Apart from moving averages, one of the most popular techniques is trailing stops using a multiple of Average True Range. There are several variations:
  1. The original Volatility System(Volatility Stops), introduced by Welles Wilder in his 1978 book: New Concepts in Technical Trading Systems
  2. Chandelier exits introduced by Alexander Elder in Come Into My Trading Room (2002) trail the stops from Highs or Lows rather than Closing Price
  3. Average True Range Trailing Stops are similar to the above, but include a ratchet mechanism to prevent stops moving down during an up-trend or rising during a down-trend, as ATR increases
  4. WillTrend intoduced by Larry Williams in 1988


Comparison of systems
All the systems under consideration have one common ingredient - ATR. ATR was developed by Welles Wilder and described in his book in 1978, also in this book the Volatility System was described, which in the future became known as Volatility Stops.
In fact, Wilder is the father of such systems due to the presence of ATR in the calculation of this type of indicator.

The main difference of Volatility System
Followers such as Larry Williams and Alexander Elder made minor changes to the value based on the ATR, mainly focusing on changing the base to which this value is added or subtracted.
Larry Williams uses the square root of 5 as a multiplier and calculates the ATR with a period of 66, and Alexander Elder uses a multiplier of 2.5-3.5 applying it to the ATR with a period of 22. Both authors changed the original value for ATR and multiplier calculations. Alexander Elder is closest to the original Welles Wilder calculation, which used a multiplier of 2.8.-3.1 applying it to an ATR with a period of 7.
As a reference, Elder took the Highest High(22) from which he subtracts ATR*Multiplier in an uptrend or the Lowest Low(22) to which he adds ATR*Multiplier to obtain the turning point (SAR).
Larry Williams uses the average price of extremes (Highest High(10) + Lowest Low(10)) / 2 as a reference base to which he adds or subtracts the ATR*Multilpyer values.
Both systems differ from the original, because Wilder used Significan Close(SIC) in his calculations. SIC is the maximum closing price during an uptrend and the minimum closing price during a downtrend, which
does not go beyond the current trade, as in other systems. To calculate the base when a trend changes, bars that are outside the current trend will be used when calculating WillTrend and Chandelier Exit, in contrast to the Volatility System, which takes SIC values only within the current trade. This is the main difference from subsequent developments of similar systems.

Improvements made
The original Volatility System is present as an indicator on TradingView, but it is an improved version with the addition of a ratchet and works differently from the original Weilder system.
List of improvements:
  1. Added the ability to remove the ratchet. You need to turn off the "Trail one way" checkbox in the setting menu. When this function is turned off, the system will operate in the author-inventor mode. On some instruments, the original system works much better than the improved ratchet system, which cannot be turned off.
  2. Added the ability to use Highest High and Lowest Low as a base instead of the closing price.


Volatility Stops Formula Description
Welles Wilder's system uses Closing Price and incorporates a stop-and-reverse feature (as with his Parabolic SAR).
Determine the initial trend direction
Calculate the Significant Close ("SIC"): the highest close reached in an up-trend or the lowest close in a down-trend
Calculate Average True Range ("ATR") for the selected period (7 days in this example)
Multiply ATR by the Multiple (3.0 in this example, best values author describes as 2.8-3.1)
The first stop is calculated in day 7 and plotted for day 8
If an up-trend, the first stop is SIC - 3 * ATR, otherwise SIC + 3 * ATR for a down-trend
Repeat each day until price closes below the stop (or above in a down-trend)
Set SIC equal to the latest Close, reverse the trend and continue.

Chandelier Exit Description
Chandelier Exits subtract a multiple of Average True Range ("ATR") from the highest high for the selected period. Using the default settings as an example:
Highest High in last 22 days - 3 * ATR for 22 days
In a down-trend the formula is reversed:
Lowest Low in last 22 days + 3 * ATR for 22 days
The time period must be long enough to capture the highest point of the recent up-trend: too short and the stops move downward; too long and the high may be taken from a previous down-trend.
It is not essential to use the same period for up and down trends; down-trends are notoriously faster than up-trends and may benefit from a shorter time period.
The multiple of 3 may be varied, but most traders settle between 2.5 and 3.5.

WillTrend Description
Larry Williams is prefer to used the Square Root from 5 as a multiplayer for ATR. SQRT(5) = 2.236
WillTrend subtract a multiple of Average True Range ("ATR") from the Middle Price (Highest High for the selected period + Lowest Low for the selected period / 2).
(Highest High in last 10 days + Lowest Low in last 10 days) / 2 - 2.236 * ATR for 66 days
In a down-trend the formula is reversed:
(Highest High in last 10 days + Lowest Low in last 10 days) / 2 + 2.236 * ATR for 66 days
wilder

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian