OPEN-SOURCE SCRIPT
已更新 SDCA System | TR

📊 OVERVIEW
The SDCA System | TR is an advanced trading indicator that combines three powerful technical metrics (RSI, ROC, and Sharpe Ratio) into a single weighted score, then applies a Symmetric Dollar-Cost Averaging (SDCA) strategy to manage entries and exits. This system provides both visual signals and automated position management based on extreme market conditions.
🎯 CORE CONCEPT
The indicator normalizes and smooths three independent indicators, combines them with user-defined weights, and generates buy/sell signals when the combined score crosses predefined thresholds. The SDCA logic then executes position adjustments using a percentage-based allocation model.
🔧 KEY COMPONENTS
1. RSI (Relative Strength Index)
Length: Adjustable (default 42)
Normalized and smoothed using a two-stage exponential smoothing process
Clipped to prevent extreme values
Range: -100 to +100
2. ROC (Rate of Change)
Length: Adjustable (default 14)
Normalized and smoothed with the same double-smoothing technique
Clipped to control sensitivity
Range: -100 to +100
3. Sharpe Ratio
Calculates risk-adjusted returns
Lookback period: Adjustable (default 42)
Includes risk-free rate adjustment
Normalized and smoothed similarly to RSI and ROC
Range: -100 to +100
4. Combined Weighted Score
Weighted average of all three indicators
User-adjustable weights (default: RSI 1.0, ROC 1.0, Sharpe 0.5)
Final score range: -100 to +100
5. SDCA Position Management
Buy Signal: Score ≤ Lower Threshold (default: -80)
Sell Signal: Score ≥ Upper Threshold (default: +80)
Percentage-based allocation per signal (default: 10% of capital)
Tracks capital, position size, average price, and total return
📈 HOW IT WORKS
Normalization Process:
Each raw indicator is calculated
Values are clipped to control outliers
First exponential smoothing applied
Normalized to 0-100 range
Second exponential smoothing applied
Final transformation: (smooth2 - 50) × 2 → Range: -100 to +100
Signal Generation:
BUY when: Weighted Score ≤ Lower Threshold AND not in a sell cycle
SELL when: Weighted Score ≥ Upper Threshold AND not in a buy cycle
Cycle states prevent conflicting signals
Position Management:
Each buy signal invests a fixed percentage of remaining capital
Each sell signal liquidates the same percentage of current position
Tracks:
Remaining capital
Position size (shares/units)
Average entry price
Total portfolio value
Total return percentage
The SDCA System | TR is an advanced trading indicator that combines three powerful technical metrics (RSI, ROC, and Sharpe Ratio) into a single weighted score, then applies a Symmetric Dollar-Cost Averaging (SDCA) strategy to manage entries and exits. This system provides both visual signals and automated position management based on extreme market conditions.
🎯 CORE CONCEPT
The indicator normalizes and smooths three independent indicators, combines them with user-defined weights, and generates buy/sell signals when the combined score crosses predefined thresholds. The SDCA logic then executes position adjustments using a percentage-based allocation model.
🔧 KEY COMPONENTS
1. RSI (Relative Strength Index)
Length: Adjustable (default 42)
Normalized and smoothed using a two-stage exponential smoothing process
Clipped to prevent extreme values
Range: -100 to +100
2. ROC (Rate of Change)
Length: Adjustable (default 14)
Normalized and smoothed with the same double-smoothing technique
Clipped to control sensitivity
Range: -100 to +100
3. Sharpe Ratio
Calculates risk-adjusted returns
Lookback period: Adjustable (default 42)
Includes risk-free rate adjustment
Normalized and smoothed similarly to RSI and ROC
Range: -100 to +100
4. Combined Weighted Score
Weighted average of all three indicators
User-adjustable weights (default: RSI 1.0, ROC 1.0, Sharpe 0.5)
Final score range: -100 to +100
5. SDCA Position Management
Buy Signal: Score ≤ Lower Threshold (default: -80)
Sell Signal: Score ≥ Upper Threshold (default: +80)
Percentage-based allocation per signal (default: 10% of capital)
Tracks capital, position size, average price, and total return
📈 HOW IT WORKS
Normalization Process:
Each raw indicator is calculated
Values are clipped to control outliers
First exponential smoothing applied
Normalized to 0-100 range
Second exponential smoothing applied
Final transformation: (smooth2 - 50) × 2 → Range: -100 to +100
Signal Generation:
BUY when: Weighted Score ≤ Lower Threshold AND not in a sell cycle
SELL when: Weighted Score ≥ Upper Threshold AND not in a buy cycle
Cycle states prevent conflicting signals
Position Management:
Each buy signal invests a fixed percentage of remaining capital
Each sell signal liquidates the same percentage of current position
Tracks:
Remaining capital
Position size (shares/units)
Average entry price
Total portfolio value
Total return percentage
發行說明
ADD開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。