Volatility System by Wilder [LucF]

The Volatility System was created by J. Welles Wilder, Jr. It first appeared in his seminal masterpiece, "New Concepts in Technical Trading Systems" (1978). He describes the system on pp .23-26, in the chapter discussing the first presentation ever of the "Volatility Index", built using a novel way of calculating a value representing volatility that he named Average True Range (ATR). The latter stuck.

The system is a pure reversal system (it is always either long or short). One of its characteristics is that its stop strategy moves up and down during a trade, widening the gap from price when volatility (ATR) increases. Because of this, this strategy can suffer large drawdowns and is not for the faint of heart.

The strategy uses a length (n) to calculate an ATR. ATR(n) is then multiplied by a factor to calculate the Average Range Constant (ARC). The ARC is then added to the lowest close n bars back to form the high Stop and Reverse points ( SAR ), and subtracted from the highest close n bars back to calculate the low SAR . Reversals occur when price closes above the high SAR or below the low SAR .

The system is best suited to higher time frames: 12H and above. Its performance depends heavily on calibration of the length and ARC factor. Wilder proposes a length of 7 and a factor between 2.8 to 3.1. My summary tests at 12H, 1D and 3D on stocks and cryptos yield better results with values of approximately 9-10/1.8-2.5 for cryptos and 9-10/3.0-4.0 for stocks. Small changes in the values will sometimes yield large variations in results, which I don’t particularly like because it tends to imply fragility, whereas I’d expect more robustness from a system with such simple rules. Additionally, backtests at 1D on cryptos provide so little data that no solid conclusions can be drawn from them.

All in all, the system is not very useful in my opinion; I publish it more for completeness, since as far as I can tell, it did not exist on this platform before. I also publish it out of respect for Wilder’s work. His book laid the foundation for many of the building blocks used by system designers, even today. In less than a hundred pages he presented RSI , ATR, DMI, ADXR and the Parabolic SAR indicators, some of which have become built-in functions in programming languages. This is a colossal feat and has not been repeated. Wilder is a monument.

Some lesser know facts about his book are:
  • It sells for the exact same price it cost in 1978: 65$,
  • The book has always been published by Wilder himself,
  • The layout hasn’t changed in 40 years,
  • He sells >35K copies/year.
Gotta love the guy.

The strategy is shown here on BTC /USD with settings of 12/1.8 (the defaults are 9/1.8). It shows the system under its best light. Other markets will most not reproduce such results. Also, the drawdown is as scary as the results are impressive.

  • The code is written as a strategy but can easily be converted to an indicator if you want to use the alerts it can produce. Instructions are in the code.
  • You can change the length and ARC factor.
  • You can choose to trade only long or short positions.
  • You can choose to display the SARs (the stops) in multiple ways.
  • You can show trigger markers.
  • A date range can be defined.
  • 3 alerts: reversals (both long and short), longs, shorts. Remember that for the moment, strategies cannot generate alerts in TradingView, so the strategy must be converted to an indicator in order to make the alerts available.
Catatan Pelepasan: Tidied up the code.
Catatan Pelepasan: Same.
Skrip sumber terbuka

Dalam semangat TradingView yang sebenar, penulis skrip ini telah menerbitkannya dengan menggunakan sumber terbuka supaya pedagang-pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda dapat menggunakannya secara percuma tetapi penggunaan semula kod ini dalam penerbitan adalah dikawalselia oleh Peraturan Rumah. Anda boleh menyukai skrip ini untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?
"The stock market is a device for transferring money from the impatient to the patient."
— Buffet

Tools and ideas for all Pine coders:


I really love your work dude. Interesting, easy-to-read and new. Thank you and know that your efforts are hugely appreciated. I look forward to seeing what else you cook up
+3 Balas
Is this like the supertrend? The book is a little hard to understand but the formula, the multiplier constant, and the ATR involved in the book seems a lot like supertrend to me.
+1 Balas
LucF SparkyFlary
@SparkyFlary, The building blocks are the same because both use ATR, and so depend on an ATR period and factor, but the logic is very different. You can quickly ascertain this if you load both on your chart, using the same ATR settings on both. As I mention in the description, this logic is interesting because the stop can move against price. The Chandelier stop also does that, but its logic is also different from that of the Volatility System, which is also different from the "Volatility Stop" which I like very much, and rewrote with @midtownsk8rguy for the TradingView account:
@LucF, oh right because supertrend uses something like hl2 whereas volatility system uses something called a sic in its calculation