This strategy is based on the technical indicator “Momentum Mean Deviation Index” described in William Blau’s book “Momentum, Direction and Divergence” published in 1995. This indicator focuses on three key elements of price momentum, price direction and price divergence, and deeply analyzes the relationship between price and momentum.
This strategy uses the Momentum Mean Deviation Index to determine price trends and breakout points. It first calculates the EMA line of the price, then calculates the deviation of the price from this EMA line. This deviation is then double smoothed by EMA to get the final momentum mean deviation index curve. Trading signals are generated when this curve crosses above or below its own signal line. Specifically, the calculation process is as follows:
Enter long or short positions according to the possig signal.
The advantages of this strategy include:
This strategy also has some potential risks:
These risks can be reduced by optimizing parameters, setting filtering criteria, introducing trend judgment modules, etc.
The optimization directions for this strategy include:
This strategy is based on the momentum mean deviation index which captures price reversal points based on the price-momentum relationship. Its parameterized and optimizable design can adapt to different cycles and varieties. But it also has some false signal and contrarian trading risks. Further optimizing parameters and models and incorporating trend judgment etc. can improve its performance.
/*backtest start: 2023-12-17 00:00:00 end: 2024-01-16 00:00:00 period: 1h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version = 2 //////////////////////////////////////////////////////////// // Copyright by HPotter v1.0 12/12/2016 // This is one of the techniques described by William Blau in his book "Momentum, // Direction and Divergence" (1995). If you like to learn more, we advise you to // read this book. His book focuses on three key aspects of trading: momentum, // direction and divergence. Blau, who was an electrical engineer before becoming // a trader, thoroughly examines the relationship between price and momentum in // step-by-step examples. From this grounding, he then looks at the deficiencies // in other oscillators and introduces some innovative techniques, including a // fresh twist on Stochastics. On directional issues, he analyzes the intricacies // of ADX and offers a unique approach to help define trending and non-trending periods. // // You can change long to short in the Input Settings // Please, use it only for learning or paper trading. Do not for real trading. //////////////////////////////////////////////////////////// strategy(title="Ergotic MDI (Mean Deviation Indicator) Bactest") r = input(32, minval=1) s = input(5, minval=1) u = input(5, minval=1) SmthLen = input(3, minval=1) reverse = input(false, title="Trade reverse") hline(0, color=blue, linestyle=line) xEMA = ema(close, r) xEMA_S = close - xEMA xEMA_U = ema(ema(xEMA_S, s), u) xSignal = ema(xEMA_U, u) pos = iff(xEMA_U > xSignal, 1, iff(xEMA_U < xSignal, -1, nz(pos[1], 0))) possig = iff(reverse and pos == 1, -1, iff(reverse and pos == -1, 1, pos)) if (possig == 1) strategy.entry("Long", strategy.long) if (possig == -1) strategy.entry("Short", strategy.short) barcolor(possig == -1 ? red: possig == 1 ? green : blue ) plot(xEMA_U, color=green, title="Ergotic MDI") plot(xSignal, color=red, title="SigLin")