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. קרא עוד ב־תנאי השימוש.