Logo

dev-resources.site

for different kinds of informations.

Quantitative Long-Short Switching Strategy Based on G-Channel and EMA

Published at
1/2/2025
Categories
strategy
trading
cryptocurrency
ema
Author
fmzquant
Author
8 person written this
fmzquant
open
Quantitative Long-Short Switching Strategy Based on G-Channel and EMA

Image description

Overview
This strategy is a quantitative trading system that combines the G-Channel and the Exponential Moving Average (EMA). The core of the strategy is to capture the market trend direction through the G-Channel, and use EMA for signal confirmation and risk control, so as to obtain profits in the two-way fluctuations of the market. The strategy adopts a fully automated trading mode and does not require manual intervention.

Strategy Principle
The strategy operates based on two core indicators: G-channel and EMA. G-channel identifies price trends by dynamically calculating upper and lower tracks, and sends out trading signals when prices break through the channel. Specifically, the strategy uses a 100-period G-channel calculation, and continuously updates the upper and lower boundaries of the channel through mathematical formulas. At the same time, the strategy introduces a 50-period EMA as a secondary confirmation, and only executes a transaction when the relative position of the price and EMA meets expectations. The buying condition is that the G-channel sends a long signal and the closing price is below the EMA, and the selling condition is that the G-channel sends a short signal and the closing price is above the EMA.

Strategy Advantages

  1. Combined with trend tracking and mean reversion features, it can maintain stable performance in different market environments
  2. Using EMA as auxiliary confirmation effectively reduces the risk of false breakthroughs
  3. Use fully automated transactions to avoid human emotional interference
  4. The calculation logic is simple and clear, easy to understand and maintain
  5. Parameters are highly adjustable to adapt to different market characteristics

Strategy Risks

  1. Frequent trading may occur in volatile markets, increasing transaction costs
  2. Improper setting of G channel parameters may cause signal lag
  3. Improper selection of EMA period may miss important trend turning points
  4. When the market fluctuates violently, a large retracement may occur . Countermeasures: a). Introducing a stop-loss mechanism to control risk; b). Optimize parameter configuration to improve system stability; c). Add market environment filtering mechanism; d). Set up a reasonable position management strategy.

Strategy Optimization Direction

  1. Introduce volatility indicators, adjust strategy parameters or suspend trading in a high volatility environment
  2. Add volume analysis to improve signal reliability
  3. Added trend strength filter to avoid frequent trading in weak trending markets
  4. Optimize EMA parameter adaptive mechanism to improve system adaptability
  5. Build a multi-time period signal confirmation mechanism to improve trading stability

Summary
This strategy builds a robust quantitative trading system by combining the two technical indicators of G channel and EMA. The strategy has clear logic, simple implementation and good scalability. Through reasonable parameter optimization and risk control measures, this strategy is expected to achieve stable returns in real trading. It is recommended to carry out targeted optimization in combination with market characteristics when applying it in real trading, and strictly implement the risk management system.

Strategy source code

/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This Pine Scriptβ„’ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Β© stanleygao01


//@version=5
strategy('G-Channel with EMA Strategy', overlay=true)

// G-Channel parameters
length = input(100, title='G-Channel Length')
src = input(close, title='Source')

a = 0.0
b = 0.0
a := math.max(src, nz(a[1])) - nz(a[1] - b[1]) / length
b := math.min(src, nz(b[1])) + nz(a[1] - b[1]) / length
avg = math.avg(a, b)

crossup = b[1] < close[1] and b > close
crossdn = a[1] < close[1] and a > close
bullish = ta.barssince(crossdn) <= ta.barssince(crossup)

// EMA parameters
emaLength = input(50, title='EMA Length')
ema = ta.ema(close, emaLength)

// Buy and Sell Conditions
buyCondition = bullish and close < ema
sellCondition = not bullish and close > ema

// Plot G-Channel
c = bullish ? color.lime : color.red
p1 = plot(avg, title='Average', color=c, linewidth=1, transp=90)
p2 = plot(close, title='Close Price', color=c, linewidth=1, transp=100)
fill(p1, p2, color=c, transp=90)

// Plot EMA
plot(ema, title='EMA', color=color.new(color.blue, 0), linewidth=2)

// Strategy Entries and Exits
if buyCondition
    strategy.entry('Buy', strategy.long)
if sellCondition
    strategy.close('Buy')

// Plot Buy/Sell Labels
plotshape(buyCondition, title='Buy Signal', location=location.belowbar, color=color.new(color.lime, 0), style=shape.labelup, text='Buy')
plotshape(sellCondition, title='Sell Signal', location=location.abovebar, color=color.new(color.red, 0), style=shape.labeldown, text='Sell')

Enter fullscreen mode Exit fullscreen mode

Strategy parameters

Image description

The original address: https://www.fmz.com/strategy/475598

trading Article's
30 articles in total
Favicon
EMA-MACD Composite Strategy for Trend Scalping
Favicon
Dynamic Timing and Position Management Strategy Based on Volatility
Favicon
Multi-Market Adaptive Multi-Indicator Trend Following Strategy
Favicon
Multi-EMA Trend Following Strategy with SMMA Confirmation
Favicon
Multi-Indicator Trend Following Strategy with Bollinger Bands and ATR Dynamic Stop Loss
Favicon
Dynamic Pivot Points with Crossup Optimization System
Favicon
Multi-Timeframe Trend Dynamic ATR Tracking Strategy
Favicon
Multi-dimensional Gold Friday Anomaly Strategy Analysis System
Favicon
Mean Reversion Bollinger Band Dollar-Cost Averaging Investment Strategy
Favicon
Dynamic ATR Trend Following Strategy Based on Support Level Breakthrough
Favicon
Price Pattern Based Double Bottom and Top Automated Trading Strategy
Favicon
Multi-Indicator Adaptive Trading Strategy Based on RSI, MACD and Volume
Favicon
Multi-Moving Average Trend Following Strategy - Long-term Investment Signal System Based on EMA and SMA Indicators
Favicon
Dual EMA Crossover Strategy with Smart Risk-Reward Control
Favicon
Multi-Period EMA Crossover with RSI Momentum and ATR Volatility Based Trend Following Strategy
Favicon
Dual EMA Stochastic Trend Following Trading Strategy
Favicon
Multi-Wave Trend Crossing Risk Management Quantitative Strategy
Favicon
Dynamic EMA Trend Crossover Entry Quantitative Strategy
Favicon
Enhanced Mean Reversion Strategy with MACD-ATR Implementation
Favicon
Bollinger Bands Momentum Breakout Adaptive Trend Following Strategy
Favicon
Multi-Indicator Synergistic Trend Following Strategy with Dynamic Stop-Loss System
Favicon
Adaptive Range Trading System Based on Dual RSI Indicators
Favicon
Advanced Five-Day Cross-Analysis Strategy Based on RSI and MACD Integration
Favicon
Advanced Quantitative Trend Capture Strategy with Dynamic Range Filter
Favicon
Multi-Technical Indicator Trend Following Strategy with RSI Momentum Filter
Favicon
Advanced Trend Following Strategy with Adaptive Trailing Stop
Favicon
Multi-Timeframe Trend Following Strategy with ATR-Based Take Profit and Stop Loss
Favicon
Triple Supertrend and Bollinger Bands Multi-Indicator Trend Following Strategy
Favicon
Dual Moving Average Trend Following Strategy with Risk Management
Favicon
Quantitative Long-Short Switching Strategy Based on G-Channel and EMA

Featured ones: