OPEN-SOURCE SCRIPT
六脉齐发多空策略

六脉齐发多空策略
# Six Meridians Unified Long/Short Strategy
## Overview
The "Six Meridians Unified Long/Short Strategy" is a comprehensive quantitative trading strategy built on TradingView Pine Script v6, designed for cross-asset long/short trading (stocks, cryptocurrencies, futures, forex, etc.). It leverages the resonance of **6 classic technical indicators** to filter high-confidence trading signals, reducing false signals caused by single-indicator bias and improving the reliability of entry/exit decisions.
## Core Indicators (6 "Meridians")
The strategy evaluates bullish/bearish trends by calculating 6 key technical indicators, with a "bullish count" system to quantify trend strength:
| Indicator | Calculation Parameters | Bullish Condition | Bearish Condition |
|-------------------------|------------------------------|--------------------------------------------|--------------------------------------------|
| MACD | Fast=12, Slow=26, Signal=9 | MACD line crosses above Signal line | MACD line crosses below Signal line |
| KDJ (Stochastic Oscillator) | Length=14, SmoothK=3, SmoothD=3 | K line > D line | K line < D line |
| RSI (Relative Strength Index) | Short=6, Long=12 | Short-period RSI (6) > Long-period RSI (12) | Short-period RSI (6) < Long-period RSI (12) |
| LWR (Modified Williams %R) | Length=14, Smooth=6 | LWR1 (WMA-smooth) > LWR2 (6-period WMA) | LWR1 < LWR2 |
| BBI (Bollinger Band Index) | EMA(3)+EMA(6)+EMA(12)+EMA(24) /4 | Close price > BBI line | Close price < BBI line |
| MTM (Momentum) | Period=12, MMS=6, MMM=14 | Short momentum line (MMS) > Long momentum line (MMM) | Short momentum line (MMS) < Long momentum line (MMM) |
## Trading Logic
The strategy uses a "count-based" trigger mechanism to execute position management (no pyramiding allowed):
### Long Position Rules
1. **Entry**: Open long position only when all 6 indicators show bullish signals (`bullCount = 6`).
2. **Partial Exit**: Reduce 50% of long position when 4 indicators remain bullish (`bullCount = 4`).
3. **Full Exit**: Close all long positions when ≤3 indicators are bullish (`bullCount ≤ 3`).
### Short Position Rules
1. **Entry**: Open short position only when all 6 indicators show bearish signals (`bearCount = 6`).
2. **Partial Exit**: Cover 50% of short position when 4 indicators remain bearish (`bearCount = 4`).
3. **Full Exit**: Close all short positions when ≤3 indicators are bearish (`bearCount ≤ 3`).
## Strategy Parameters (Risk & Capital Management)
| Parameter | Value | Description |
|--------------------------|----------------|----------------------------------------------|
| Initial Capital | $100,000 | Starting equity for backtesting |
| Default Order Size | $10,000 (cash) | Fixed cash amount per trade (instead of lots) |
| Commission | 0.1% per trade | Realistic transaction cost (percent-based) |
| Margin Requirement | 100% | No leverage (1:1 trading) |
| Pyramiding | 0 | No additional positions on existing trades |
## Key Features
1. **Multi-Indicator Resonance**: Eliminates noise from single-indicator false signals by requiring consensus across 6 diverse technical metrics.
2. **Gradual Position Management**: Partial exit (50%) before full closure to lock in profits and reduce downside risk.
3. **Full Automation**: Automatically executes entry/exit/position adjustment without manual intervention.
4. **Visualization Tools**: Plots BBI line, long/short signal labels, and bullish indicator count for easy strategy monitoring.
5. **Versatility**: Adaptable to multiple timeframes (15min, 1H, 4H, daily) and asset classes.
## Notes
- The strategy is optimized for trend-following markets and may underperform in choppy/range-bound conditions.
- Backtest results should be validated across different market cycles (bull, bear, sideways) before live trading.
- Parameters (e.g., indicator periods, order size) can be adjusted based on specific asset volatility and trading style.
# Six Meridians Unified Long/Short Strategy
## Overview
The "Six Meridians Unified Long/Short Strategy" is a comprehensive quantitative trading strategy built on TradingView Pine Script v6, designed for cross-asset long/short trading (stocks, cryptocurrencies, futures, forex, etc.). It leverages the resonance of **6 classic technical indicators** to filter high-confidence trading signals, reducing false signals caused by single-indicator bias and improving the reliability of entry/exit decisions.
## Core Indicators (6 "Meridians")
The strategy evaluates bullish/bearish trends by calculating 6 key technical indicators, with a "bullish count" system to quantify trend strength:
| Indicator | Calculation Parameters | Bullish Condition | Bearish Condition |
|-------------------------|------------------------------|--------------------------------------------|--------------------------------------------|
| MACD | Fast=12, Slow=26, Signal=9 | MACD line crosses above Signal line | MACD line crosses below Signal line |
| KDJ (Stochastic Oscillator) | Length=14, SmoothK=3, SmoothD=3 | K line > D line | K line < D line |
| RSI (Relative Strength Index) | Short=6, Long=12 | Short-period RSI (6) > Long-period RSI (12) | Short-period RSI (6) < Long-period RSI (12) |
| LWR (Modified Williams %R) | Length=14, Smooth=6 | LWR1 (WMA-smooth) > LWR2 (6-period WMA) | LWR1 < LWR2 |
| BBI (Bollinger Band Index) | EMA(3)+EMA(6)+EMA(12)+EMA(24) /4 | Close price > BBI line | Close price < BBI line |
| MTM (Momentum) | Period=12, MMS=6, MMM=14 | Short momentum line (MMS) > Long momentum line (MMM) | Short momentum line (MMS) < Long momentum line (MMM) |
## Trading Logic
The strategy uses a "count-based" trigger mechanism to execute position management (no pyramiding allowed):
### Long Position Rules
1. **Entry**: Open long position only when all 6 indicators show bullish signals (`bullCount = 6`).
2. **Partial Exit**: Reduce 50% of long position when 4 indicators remain bullish (`bullCount = 4`).
3. **Full Exit**: Close all long positions when ≤3 indicators are bullish (`bullCount ≤ 3`).
### Short Position Rules
1. **Entry**: Open short position only when all 6 indicators show bearish signals (`bearCount = 6`).
2. **Partial Exit**: Cover 50% of short position when 4 indicators remain bearish (`bearCount = 4`).
3. **Full Exit**: Close all short positions when ≤3 indicators are bearish (`bearCount ≤ 3`).
## Strategy Parameters (Risk & Capital Management)
| Parameter | Value | Description |
|--------------------------|----------------|----------------------------------------------|
| Initial Capital | $100,000 | Starting equity for backtesting |
| Default Order Size | $10,000 (cash) | Fixed cash amount per trade (instead of lots) |
| Commission | 0.1% per trade | Realistic transaction cost (percent-based) |
| Margin Requirement | 100% | No leverage (1:1 trading) |
| Pyramiding | 0 | No additional positions on existing trades |
## Key Features
1. **Multi-Indicator Resonance**: Eliminates noise from single-indicator false signals by requiring consensus across 6 diverse technical metrics.
2. **Gradual Position Management**: Partial exit (50%) before full closure to lock in profits and reduce downside risk.
3. **Full Automation**: Automatically executes entry/exit/position adjustment without manual intervention.
4. **Visualization Tools**: Plots BBI line, long/short signal labels, and bullish indicator count for easy strategy monitoring.
5. **Versatility**: Adaptable to multiple timeframes (15min, 1H, 4H, daily) and asset classes.
## Notes
- The strategy is optimized for trend-following markets and may underperform in choppy/range-bound conditions.
- Backtest results should be validated across different market cycles (bull, bear, sideways) before live trading.
- Parameters (e.g., indicator periods, order size) can be adjusted based on specific asset volatility and trading style.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。