OPEN-SOURCE SCRIPT

hamster-bot MRS 2 (simplified version)

Diupdate
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) [Closing]
A conventional MA is being built. (fuchsia line). A limit order is placed on this line to close the position.
2) [BUY | LONG]
(green line) A limit order is placed on this line to open a long position
3) [SELL | SHORT]
(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
Catatan Rilis
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
Catatan Rilis
Added new MA type - ATR
Catatan Rilis
Added pump filter
Catatan Rilis
Settings for pump filter (source and offset)
Catatan Rilis
Experimental function. Pump filter 2.
If the Maximum for N candles ago is more than X greater than the minimum, then a filter is turned on that disables opening new positions.
Catatan Rilis
new source type: oc2 = (open + close) / 2
Moving Averages

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?


hamster-bot.com/phoenix - инвестиционный алгофонд - консервативный доход
t.me/bothamster - канал бота
t.me/bitmextrue - чат бота
t.me/phoenixxmbt - чат алгофонда
Juga di:

Pernyataan Penyangkalan