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 (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 , ATR, DMI, and the 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.
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.
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.
Tools and ideas for all Pine coders: http://www.pinecoders.com