hamster-bot

hamster-bot MRS 2 (simplified version)

hamster-bot 업데이트됨   
MRS - Mean Reversion Strategy (Countertrend) (Envelope strategy)

This script does not claim to be unique and does not mislead anyone. Even the unattractive backtest result is attached. The source code is open. The idea has been described many times in various sources. But at the same time, their collection in one place provides unique opportunities.

Published by popular demand and for ease of use. so that users can track the development of the script and can offer their ideas in the comments. Otherwise, you have to communicate in several telegram chats.

Representative of the family of counter-trend strategies. The basis of the strategy is Mean reversion. You can also read about the Envelope strategy.

Mean reversion, or reversion to the mean, is a theory used in finance that suggests that asset price volatility and historical returns eventually will revert to the long-run mean or average level of the entire dataset.

The strategy is very simple. Has very few settings. Good for beginners to get acquainted with algorithmic trading. A simple adjustment will help avoid overfitting. There are many variations of this strategy, but for understanding it is better to start with this implementation.

Principle of operation.
1)
A conventional MA is being built. (fuchsia line). A limit order is placed on this line to close the position.
2)
(green line) A limit order is placed on this line to open a long position
3)
(red line) A limit order is placed on this line to open a short position

Attention!
Please note that a limit order is used. Conclude that the strategy has a limited capacity. And the results obtained on low-liquid instruments will be too high in the tester. On real auctions there will be a different result.

Note for testing the strategy in the spot market:
When testing in the spot market, do not include both long and short at the same time. It is recommended to test only the long mode on the spot. Short mode for more advanced users.


Settings:
Available types of moving averages:
  • SMA
  • EMA
  • TEMA - triple exponential moving average
  • DEMA - Double Exponential Moving Average
  • ZLEMA - Zero lag exponential moving average
  • WMA - weighted moving average
  • Hma - Hull Moving Average
  • Thma - Triple Exponential Hull Moving Average
  • Ehma - Exponential Hull Moving Average
  • H - MA built based on highs for n candles | ta.highest(len)
  • L - MA built based on lows for n candles | ta.lowest(len)
  • DMA - Donchian Moving Average
A Kalman filter can be applied to all MA

The peculiarity of the strategy is a large selection of MA and the possibility of shifting lines. You can set up a reverse trending strategy on the Donchian channel for example.

Use Long - enable/disable opening a Long position
Use Short - enable/disable opening a Short position

Lot Long, % - % allocated from the deposit for opening a Long position. In the spot market, do not use % greater than 100%
Lot Short, % - allocated % of the deposit for opening a Short position

Start date - the beginning of the testing period
End date - the end of the testing period (Example: only August 2020 can be tested)

Mul - multiplier. Used to offset lines. Example:
Mul = 0.99 is shift -1%
Mul = 1.01 is shift +1%

Non-strict recommendations:
1) Test the SPOT market on crypto exchanges. (The countertrend strategy has liquidation risk on futures)
2) Symbols altcoin/bitcoin or altcoin/altcoin. Example: ETH/BTC or DOGE/ETH
3) Timeframe is usually 1 hour

If the script passes moderation, I will supplement it by adding separate settings for closing long and short positions according to their MA
릴리즈 노트:
new option "distance_filter" value in %. If you set it to 0, it means the filter is turned off and not used. The filter disables trading and removes orders if the distance between the opening order and the closing one is less than a specified one
릴리즈 노트:
Added new MA type - ATR

오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?