
This strategy combines phase crossover signals with multi-period exponential moving averages to capture market buying and selling opportunities. It utilizes the crossover of Leading Phase and Lagging Phase to generate trading signals, while incorporating 13, 26, 50, 100, and 200-period EMAs for trend confirmation, providing a comprehensive solution for trend following and short-term trading.
The core logic consists of two main components: the Phase Crossover System and the EMA Trend Confirmation System. The Phase Crossover System uses a Simple Moving Average (SMA) with upward offset as the Leading Phase and an Exponential Moving Average (EMA) with downward offset as the Lagging Phase. Buy signals are generated when the Leading Phase crosses above the Lagging Phase, and sell signals when it crosses below. The EMA Trend Confirmation System uses multiple period (13/26/50/100/200) exponential moving averages to confirm overall market trends, with the 13 and 26-period EMA crossovers serving as secondary trading signals.
This strategy builds a comprehensive trend following trading system by combining phase crossover and multi-period EMA systems. It features clear signals, accurate trend capture, and reasonable risk control, while also having certain lag and false signal risks. The strategy’s stability and reliability can be further enhanced through optimizations such as adding volatility filters and volume confirmation. It is suitable for application in clearly trending markets, and traders need to adjust parameters based on specific market characteristics and individual risk preferences.
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-08 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Phase Cross Strategy with Zone", overlay=true)
// Inputs
length = input.int(20, title="Smoothing Length")
source = input(close, title="Source")
offset = input.float(0.5, title="Offset Amount", minval=0.0) // Offset for spacing
// Simulating "Phases" with Smoothed Oscillators
lead_phase = ta.sma(source, length) + offset // Leading phase with offset
lag_phase = ta.ema(source, length) - offset // Lagging phase with offset
// Signal Logic
buySignal = ta.crossover(lead_phase, lag_phase)
sellSignal = ta.crossunder(lead_phase, lag_phase)
// Plot Phases (as `plot` objects for `fill`)
lead_plot = plot(lead_phase, color=color.green, title="Leading Phase", linewidth=1)
lag_plot = plot(lag_phase, color=color.red, title="Lagging Phase", linewidth=1)
// Fill Zone Between Phases
fill_color = lead_phase > lag_phase ? color.new(color.green, 90) : color.new(color.red, 90)
fill(plot1=lead_plot, plot2=lag_plot, color=fill_color, title="Phase Zone")
// Plot Buy and Sell Signals
plotshape(buySignal, style=shape.labelup, location=location.belowbar, color=color.new(color.green, 0), title="Buy Signal", size=size.small)
plotshape(sellSignal, style=shape.labeldown, location=location.abovebar, color=color.new(color.red, 0), title="Sell Signal", size=size.small)
// Strategy Entry and Exit
if buySignal
strategy.entry("Buy", strategy.long)
if sellSignal
strategy.close("Buy")
//indicator("EMA 13, 26, 50, 100, and 200 with Crossover, Value Zone, and Special Candles", overlay=true)
// Define the EMAs
ema13 = ta.ema(close, 13)
ema26 = ta.ema(close, 26)
ema50 = ta.ema(close, 50)
ema100 = ta.ema(close, 100)
ema200 = ta.ema(close, 200)
// Plot the EMAs
plot(ema13, color=color.blue, linewidth=2, title="EMA 13")
plot(ema26, color=color.red, linewidth=2, title="EMA 26")
plot(ema50, color=color.orange, linewidth=2, title="EMA 50")
plot(ema100, color=color.green, linewidth=2, title="EMA 100")
plot(ema200, color=color.purple, linewidth=2, title="EMA 200")
// Crossover conditions
uptrend = ta.crossover(ema13, ema26) // EMA 13 crosses above EMA 26 (buy)
downtrend = ta.crossunder(ema13, ema26) // EMA 13 crosses below EMA 26 (sell)
// Plot buy/sell arrows
plotshape(series=uptrend, location=location.belowbar, color=color.green, style=shape.labelup, size=size.small, title="Buy Signal")
plotshape(series=downtrend, location=location.abovebar, color=color.red, style=shape.labeldown, size=size.small, title="Sell Signal")