DojiEmoji

[KL] Mean Reversion (ATR) Strategy

DojiEmoji Telah dikemas kini   
This strategy will enter into a position when price volatility is relative high, betting that price will subsequently trend in a favourable direction.

Hypothesis: During periods of high price volatility, ATR will divert from its moving average by at least +/- one standard deviation. Eventually, ATR will revert back to the mean. However, just knowing the magnitude of increase/decrease of ATR does not give a trend signal, so we need to introduce a model in this script to predict whether the next bars will be up/down.

  • Trend Prediction: This strategy calculates the expected logarithmic return of the security (the "Drift") and considers prices to be moving in uptrend if the drift curve is upward sloping or if the drift value is positive.

Entry Conditions: Long position is entered when:
  • (a) ATR has diverted from mean by one standard deviation, and
  • (b) trend is predicted to move in our favor.

Exit Condition: When trailing stop loss is hit.

Results from backtesting against VOO (1H timeframe):
- approx 46% win rate over 491 trades, on average holding for 20 hours per trade
- price at the beginning of backtest (Jan. 2015) was $187.52, giving holding period return of ~120% had we not sold in between ("HPR of HODL'ing")
- this strategy gained ~159%, exceeding ~120% HPR of HODL'ing
Nota Keluaran:
Minor changes:
- cleaned up spacings of codes
- uses strategy.exit() with 'close' parameter defined. This gives a more accurate report of backtested results. (previously used strategy.close(), which exited at the opening price of the next bar during stops)
- better alerts
Nota Keluaran:
Added profit taking levels. Also amended risk the management strategy.
Changes:
- Order size is based on user-defined percentage of committed capital
- Profit taking over 3 levels based on risk to reward ratio (i.e. 1R, 2R, 3R). When a target is met at each tier, strategy will close out one third of current position size. Unreached targets will eventually be closed at the trailing stoploss price
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 Dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.

Ingin menggunakan skrip ini pada carta?