This strategy identifies market trend and reversal opportunities by calculating the deviation of price from its smoothed moving average. It belongs to the trend following strategies that trade based on the breakout of moving averages. The core idea is to buy or sell when the price breaks through the smooth moving average line.
Calculate the 3-period weighted moving average of price FPrice as the smoothed MA line.
Calculate the 17-day standard deviation stdev and 17-day simple moving average ema2 of FPrice.
Calculate the deviation Rate1 of price from the average as (FPrice-ema2)/stdev.
When Rate1 drops below -1 and starts to rise, it signals a breakout below the down trendline and generates a buy signal.
When Rate1 rises above 1 and starts to fall, it signals a breakout above the up trendline and generates a sell signal.
Open or close positions according to the signals.
The strategy uses the standard deviation range of price deviation from MA to identify trend reversals. By dynamically adjusting the reference range it adapts to market volatility. When price breaks out of the MA by more than one standard deviation, it triggers a trading signal. This effectively filters out short-term market noise and catches mid-to-long term trend shifts.
The dynamic reference range automatically adapts to changing market volatility.
The smoothed MA filters out short-term noise effectively.
The standard deviation sets reasonable breakout thresholds and avoids overtrading.
The momentum filter avoids false breakouts.
The strategy logic is simple and clear, easy to understand and implement.
The parameters can be adjusted for different trading instruments.
It can be combined with other indicators to improve performance.
There may be fewer trading opportunities during prolonged low volatility periods.
Improper standard deviation parameters may lead to missing good trades or generating excessive false signals.
Standard deviation may fail during extreme price swings, causing wrong signals.
More false breakouts may occur around trend transitions.
MA systems have lag in detecting short-term shifts. Some short-term opportunities may be missed.
Parameters and filters need to be tuned properly for specific market environments.
Optimize MA days and type based on instrument characteristics.
Adjust standard deviation multiplier to find the optimal reference range.
Add price momentum filters to reduce false signals.
Incorporate volatility indicators to dynamically adjust parameters by volatility.
Combine with other similar breakout strategies to improve win rate.
Consider lowering position size around trend turning points to manage risk.
Add stop loss to control single trade loss.
The strategy has clear logic to identify trend reversals. With parameter tuning and combinations it can be adapted to different markets. But risk management is crucial to avoid false signals during high volatility periods. If optimized properly, it is a simple and practical trend following system.
/*backtest start: 2023-09-22 00:00:00 end: 2023-10-22 00:00:00 period: 4h basePeriod: 15m exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © Mustafaozver //@version=4 strategy("Escaping of Rate from Avarage By Mustafa OZVER", "EoRfA", overlay=false) //strategy("Escaping of Rate from Avarage By Mustafa OZVER", "EoRfA", overlay=false) src = input(ohlc4,"Source") FPrice = wma(src,3) len = input(17,"Length") stdev = stdev(FPrice,len) ema2 = ema(FPrice,len) Rate1 = (FPrice - ema2) / stdev //bgcolor(color=((stdev/ema)>0.0015)?color.green:#00000000,transp=80) colorG = color.lime colorR = color.red hline(0,linestyle=hline.style_solid,editable=false) hline1=hline(1,linestyle=hline.style_dotted,editable=false) hlinen1=hline(-1,linestyle=hline.style_dotted,editable=false) fill(hline1,hlinen1,color=color.silver,transp=85,editable=true) //plot(Rate,color=(Rate>0?colorG:colorR),transp=75,style=plot.style_area,editable=false) plot(Rate1,title="ESC1",color=(Rate1>0?colorG:colorR),style=plot.style_line,linewidth=1,editable=true) BUYSIGNAL = Rate1 < -1 and change(Rate1) > 0 SELLSIGNAL = Rate1 > 1 and change(Rate1) < 0 if (BUYSIGNAL) strategy.order("LONG1",true) //strategy.close("SHORT1") if (SELLSIGNAL) // strategy.order("SHORT1",false) strategy.close("LONG1")