The Jaws mean reversion strategy is a very simple trend trading strategy. Its core idea is to go long when the short-term moving average falls below the long-term moving average by a certain percentage, and close the position when the short-term moving average crosses above the long-term moving average. The strategy first calculates a short-term and a long-term moving average, and then generates trading signals based on the relationship between the two moving averages.
The strategy mainly relies on two moving averages, one short-term and one long-term. The short-term moving average parameter is smallMAPeriod, and the long-term moving average parameter is bigMAPeriod. The strategy first calculates these two moving averages, and then compares the size relationship between them.
When the short-term moving average falls from above and breaks through a certain percentage (set by the percentBelowToBuy parameter) of the long-term moving average, a buy signal is generated to go long. When the short-term moving average subsequently rises and crosses above the long-term moving average, a sell signal is generated to close the position.
The strategy captures mean reversion opportunities between the short-term and long-term moving averages. When the short-term moving average is below the long-term moving average to a certain extent, it means the asset may be undervalued and should have a chance to revert to the mean, so going long can obtain a rebound profit.
The Jaws mean reversion strategy has the following advantages:
The strategy can achieve good results through simple parameter optimization. By adjusting the moving average and concession percentage parameters, backtesting can be performed on different market assets like stocks, forex, and cryptocurrencies to screen out the optimal parameter combinations.
The Jaws mean reversion strategy also has some risks:
The following methods can be used to mitigate risks:
The Jaws mean reversion strategy can be optimized from the following aspects:
The Jaws mean reversion strategy captures the mean reversion opportunities after short-term prices deviate from long-term trends by comparing short and long-term moving averages. The strategy has simple logic that is easy to understand and implement. Through parameter optimization it can achieve good results. But risks like fewer signals and missing reversals still exist, requiring testing and optimization of parameters and filters to maximize strategy returns.
/*backtest start: 2023-02-20 00:00:00 end: 2024-02-26 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // @version=4 // // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // // @author Sunil Halai // // This very simple strategy is an implementation of PJ Sutherlands' Jaws Mean reversion algorithm. It simply buys when a small moving average period (e.g. 2) is below // a longer moving average period (e.g. 5) by a certain percentage, and closes when the small period average crosses over the longer moving average. // // If you are going to use this, you may wish to apply this to a range of investment assets, as the amount signals is low. Alternatively you may wish to tweak the settings to provide more // signals. strategy("Jaws Mean Reversion [Strategy]", overlay = true) //Strategy inputs source = input(title = "Source", defval = close) smallMAPeriod = input(title = "Small Moving Average", defval = 2) bigMAPeriod = input(title = "Big Moving Average", defval = 5) percentBelowToBuy = input(title = "Percent below to buy %", defval = 3) //Strategy calculation smallMA = sma(source, smallMAPeriod) bigMA = sma(source, bigMAPeriod) buyMA = ((100 - percentBelowToBuy) / 100) * sma(source, bigMAPeriod)[0] if(crossunder(smallMA, buyMA)) strategy.entry("BUY", strategy.long) if(crossover(smallMA, bigMA)) strategy.close("BUY")