Logo hamster-bot
RU EN PT

Loading…

← All strategies

MRS

MRS - Mean Reversion Strategy. It is a counter-trend strategy based on the assumption that the price returns to its average after deviating from it. The opening order is placed at an offset from the average price. The closing order is placed at the average price without an offset. On a sharp price deviation a position opens, and it closes when the price returns to the average.

Trades are generated when the price moves away from the average by a certain percentage. ⚠️ But if the price keeps moving in the same direction without a pullback, the position will be at a loss. The price falls - the strategy buys (going against the trend). The price rises - it sells (also against the trend). But sooner or later the close happens at the average price anyway.

As a rule, positions in this strategy are held briefly. And in a calm market you can stay without a position for a long time.

Order type used: Limit. Placed in advance and moved as the average price changes.

MRS strategy

In the simplest form there are three MA lines (moving averages) on the chart.
● The Fuchsia base MA shows the price of the closing limit order. No offset
● The Green long MA - the price of the limit BUY order that opens a LONG position. It is the base MA shifted down by a %.
● The Red short MA - the price of the limit SELL order that opens a SHORT position. It is the base MA shifted up by a %.

How it works: if both long and short are on, 2 orders are placed. If only long or short is on, 1 order. While waiting for a position, the orders move along their lines on every new candle. When the price reaches our opening order, a position opens and a closing order is placed at the base MA. The closing order also moves along its MA until it is filled. Then the cycle repeats.

MA line settings (opening and closing orders)

There can be several opening lines for each side (ma_long, ma_short) - this gives a grid of orders with averaging in (MultiMA). There is one closing line for each side (ma_close_long, ma_close_short) - the whole position is closed with one order.

Lot setup. In the basic settings set balance_percentage = 100 and risk = 1. Then lot_x = 1 - an order for 100% of the balance, 0.5 - for 50%, 1.5 - for 150%.

Strategy parameters
Position limiter

The limiter is set for an API key with the "open_positions_limiter": 64 parameter in the key file in the settings_account folder. Default 0 - off. Only MRS bots whose position_priority is not 0 take part in the limiter.

In the interface the limiter is shown like this: [100 | (4/64)] - 100 bots on this API, 4 positions open, limit 64.

The same open_positions_limiter parameter also limits the HiDeep, RedFlag, SmartProfit and ShadowOverlap strategies: when there are as many open positions on them as the limit, bots without a position do not open new trades. Priorities are not used for them.

ColorBox - close on the N-th candle

A closing option that turns MRS into ColorBox: the position closes at the close of the N-th candle after entry. You can add a candle color condition, for example close after the 2nd green candle. Set separately for long and short. Details are in the "Position closing and common options" section.

Backtest
Test in the built-in backtester

Script (PineScript) for testing the strategy on historical data in the TradingView strategy tester. The strategy is popular, and you can find many variations under different names.

Recommendations: (not strict, you can break them for research purposes)
● A limit order limits the strategy's capacity. On low-liquidity instruments the tester result will be overstated.
● On spot, test long only. Long and short at the same time is for experienced users.
● On futures a counter-trend strategy carries a liquidation risk.
● Typical timeframe - 1h. Altcoin/bitcoin or altcoin/altcoin pairs.


Backtest the strategy on historical data in the tester and run it in hamster-bot.