Overview
The Long-Term Reversal Signal detects trend reversals by analyzing candle patterns over extended periods (days/weeks). It identifies:
- LONGTERM_SMART_LONG_SIGNAL: Bearish trend (80% red candles) + downward price movement + bullish reversal → Enter LONG
- LONGTERM_SMART_SHORT_SIGNAL: Bullish trend (80% green candles) + upward price movement + bearish reversal → Enter SHORT
Setup Instructions
Step 1: Enable Long-Term Trading Profile
File: tradesettings.yaml
General:
Profile: "long" # Must be "long" for long-term reversal signals
Options: scalp | day | swing | long | hft
Critical: Only the long profile supports long-term reversal signals.
Step 2: Configure Kline Data Interval
File: tradesettings.yaml
Kline:
summaryInterval: "1d" # Daily candles for signal analysis
Supported Intervals:
- Recommended:
1d(1 day) - Best for long-term analysis - Alternative:
12h(12 hours) - More frequent signals, less stable
Important: The summaryInterval MUST match your strategy interval (Step 3), otherwise you'll get "kline data not found" errors.
Step 3: Set Strategy Intervals for Long Profile
File: tradesettings.yaml
strategyIntervals:
hft: ["1m"] # High-Frequency Trading
scalp: ["15m"] # Short-term: 3m, 5m, 15m
day: ["15m", "30m"] # Day trading
swing: ["1h", "2h"] # Swing trading
long: ["1d"] # Long-term: 1d, 12h (recommended: 1d)
default: ["5m"]
For Long-Term Trading:
- Use
["1d"]for daily analysis (most stable) - Can use
["12h"]for more frequent checks - Can combine:
["1d", "12h"]for multi-timeframe analysis
Must Match: Ensure this interval exists in your Kline data configuration.
Step 4: Enable and Configure Long-Term Reversal Analysis
File: tradesettings.yaml → Decision Settings
decision_settings:
# Long-term reversal analysis
enabled_long_term_reversal: true
candle_lookback_count: 12
required_color_percent: 0.7
required_movement_percent: 0.4
last_n_candles_check: 2
min_confidence_threshold: 70.0
Configuration Parameters Explained:
| Parameter | Description | Recommended | Range |
|---|---|---|---|
enabled_long_term_reversal |
Master switch for the signal | true |
true/false |
candle_lookback_count |
Number of recent candles to analyze | 12 (12 days) |
10-20 |
required_color_percent |
% of candles that must be same color | 0.7 (70%) |
0.6-0.8 |
required_movement_percent |
Minimum price movement required | 0.4 (40%) |
0.3-0.6 |
last_n_candles_check |
Recent candles showing reversal | 2 |
1-3 |
min_confidence_threshold |
Minimum confidence to trigger | 70.0 (70%) |
60-80 |
Fine-Tuning Guidelines:
Conservative (Fewer but Higher Quality Signals):
candle_lookback_count: 15
required_color_percent: 0.8 # 80% same color
required_movement_percent: 0.5 # 50% price movement
last_n_candles_check: 2
min_confidence_threshold: 75.0
Aggressive (More Signals, Lower Quality):
candle_lookback_count: 10
required_color_percent: 0.6 # 60% same color
required_movement_percent: 0.3 # 30% price movement
last_n_candles_check: 1
min_confidence_threshold: 65.0
Balanced (Recommended Starting Point):
candle_lookback_count: 12
required_color_percent: 0.7 # 70% same color
required_movement_percent: 0.4 # 40% price movement
last_n_candles_check: 2
min_confidence_threshold: 70.0
Step 5: Add Long-Term Signals to Supported Actions
File: tradesettings.yaml → Decision Settings
decision_settings:
# Volatility actions that trigger trading signals
supported_volatility_action:
- "BUY"
- "SELL"
- "PUMP"
- "CRASH"
- "LONGTERM_SMART_SHORT_SIGNAL" # NEW
- "LONGTERM_SMART_LONG_SIGNAL" # NEW
Critical: Without adding these two signals, the system will skip long-term reversal orders!
Step 6: Reset Symbol Configuration
Required Action: Remove all symbols from symbols.json to force re-sync with new signal settings.
Why This is Necessary:
The system caches symbol-specific volatility settings. Old symbols won't have the new LONGTERM_SMART_* signals in their configuration.
How to Reset:
Option 1: Delete symbols.json
rm symbols.json
# Restart the bot - it will re-sync all symbols
Option 2: Manual Edit (if sync is disabled)
Edit symbols.json and add the signals to each symbol:
{
"BTCUSDT": {
"volatility_settings": {
"supported_volatility_action": [
"BUY",
"SELL",
"PUMP",
"CRASH",
"LONGTERM_SMART_SHORT_SIGNAL",
"LONGTERM_SMART_LONG_SIGNAL"
]
}
}
}
Option 3: Clear and Re-sync
# 1. Backup current symbols
cp symbols.json symbols.json.backup
# 2. Empty the file
echo "[]" > symbols.json
# 3. Restart bot with sync enabled
Signal Logic Explanation
LONGTERM_SMART_LONG_SIGNAL (Bullish Reversal)
Conditions:
- 70%+ red candles in lookback period (bearish trend)
- 40%+ downward price movement (first candle open → last candle close)
- Last 2 candles are green (bullish reversal starting)
- Confidence ≥ 70%
Example:
Day 1-10: ████████░░ (80% red) - Strong bearish trend
Price: $100 → $60 (40% drop) ✓
Day 11-12: ░░ (Green candles) - Reversal detected!
→ LONG SIGNAL triggered at $65
LONGTERM_SMART_SHORT_SIGNAL (Bearish Reversal)
Conditions:
- 70%+ green candles in lookback period (bullish trend)
- 40%+ upward price movement (first candle open → last candle close)
- Last 2 candles are red (bearish reversal starting)
- Confidence ≥ 70%
Example:
Day 1-10: ░░░░░░░░██ (80% green) - Strong bullish trend
Price: $50 → $80 (60% gain) ✓
Day 11-12: ██ (Red candles) - Reversal detected!
→ SHORT SIGNAL triggered at $75
Understanding Log Output
Valid Signal Example:
LONGTERM_SMART_LONG_SIGNAL: Bearish trend=9/12 (75.0%) |
Downward movement ✓ | Last 2 candles: BULLISH reversal ✓ |
Doji: 1 | Confidence: 77.5% | Trend Strength: 2.34%
Interpretation:
- 9/12 red candles = 75% bearish (meets 70% threshold)
- Downward movement = Price dropped 40%+ (validated)
- Last 2 BULLISH = Reversal confirmed (2 green candles)
- 1 Doji = 1 indecision candle (allowed)
- 77.5% confidence = High quality signal
- 2.34% trend strength = Average candle body size
Invalid Signal Example:
LONGTERM_SMART_LONG_SIGNAL: Bearish=7/12 (58.3%) |
Movement valid: false | Last 2 reversal valid: false |
Doji: 2 | Conf: 0.0%
Why it Failed:
- Only 58.3% red (needs 70%)
- Movement validation failed (price didn't drop 40%)
- Last 2 candles not bullish
- Result: Signal rejected
Configuration Examples by Trading Style
Ultra-Conservative (Crypto Whales)
Few signals, very high accuracy
decision_settings:
enabled_long_term_reversal: true
candle_lookback_count: 20 # 20 days analysis
required_color_percent: 0.85 # 85% same color
required_movement_percent: 0.6 # 60% price movement
last_n_candles_check: 3 # 3 reversal candles
min_confidence_threshold: 80.0 # 80% confidence
Moderate (Recommended for Most Users)
Balanced approach
decision_settings:
enabled_long_term_reversal: true
candle_lookback_count: 12 # 12 days
required_color_percent: 0.7 # 70% same color
required_movement_percent: 0.4 # 40% movement
last_n_candles_check: 2 # 2 reversal candles
min_confidence_threshold: 70.0 # 70% confidence
Aggressive (Active Traders)
More signals, accept lower quality
decision_settings:
enabled_long_term_reversal: true
candle_lookback_count: 8 # 8 days only
required_color_percent: 0.65 # 65% same color
required_movement_percent: 0.3 # 30% movement
last_n_candles_check: 1 # 1 reversal candle
min_confidence_threshold: 65.0 # 65% confidence
Troubleshooting
Problem: "SKIPPING ORDER: Volatility direction not in supported options"
Cause: Symbol-specific config overriding global settings.
Solution: Add signals to symbol-specific config in symbols.json:
{
"BTCUSDT": {
"volatility_settings": {
"supported_volatility_action": [
"LONGTERM_SMART_SHORT_SIGNAL",
"LONGTERM_SMART_LONG_SIGNAL"
]
}
}
}
Problem: "Insufficient candles for long-term analysis"
Cause: Not enough historical data loaded.
Solutions:
- Reduce
candle_lookback_count(e.g., from 15 to 10) - Wait for more data to accumulate
- Check Kline data is being fetched correctly
Problem: "kline data not found"
Cause: Mismatch between summaryInterval and strategyIntervals.
Solution: Ensure they match:
Kline:
summaryInterval: "1d"
strategyIntervals:
long: ["1d"] # Must match!
Problem: No signals being generated
Checklist:
Profile: "long"is setenabled_long_term_reversal: true- Signals added to
supported_volatility_action symbols.jsonhas been reset/updated- Enough candles available (≥
candle_lookback_count) - Thresholds not too strict (try lower values)
Best Practices
1. Start Conservative
Begin with high thresholds and gradually relax them:
required_color_percent: 0.8 # Start at 80%
required_movement_percent: 0.5 # Start at 50%
min_confidence_threshold: 75.0 # Start at 75%
2. Monitor Signal Quality
Track your signals for 1-2 weeks:
- Too few signals? → Lower thresholds
- Too many false signals? → Raise thresholds
- Good balance? → Keep current settings
3. Combine with Other Indicators
Don't rely solely on reversal signals. Use with:
- Volume analysis
- RSI/MACD confirmation
- Support/resistance levels
- Market sentiment
4. Adjust by Market Conditions
Bull Market:
# Favor LONG signals
required_color_percent: 0.65 # Easier LONG triggers
last_n_candles_check: 1 # Faster reversal detection
Bear Market:
# Favor SHORT signals or increase quality
required_color_percent: 0.75 # Stricter requirements
last_n_candles_check: 2 # Confirm reversals better
5. Backtest Your Settings
Before going live:
- Enable paper trading mode
- Run for 2-4 weeks with your settings
- Analyze win rate and profitability
- Adjust accordingly
Complete Configuration Template
# tradesettings.yaml - Complete Long-Term Reversal Setup
General:
Profile: "long"
Kline:
summaryInterval: "1d"
strategyIntervals:
long: ["1d"]
default: ["5m"]
decision_settings:
# Long-term reversal analysis
enabled_long_term_reversal: true
candle_lookback_count: 12
required_color_percent: 0.7
required_movement_percent: 0.4
last_n_candles_check: 2
min_confidence_threshold: 70.0
# Supported signals
supported_volatility_action:
- "BUY"
- "SELL"
- "PUMP"
- "CRASH"
- "LONGTERM_SMART_SHORT_SIGNAL"
- "LONGTERM_SMART_LONG_SIGNAL"
Final Checklist
Before starting the bot:
- [ ] Set
Profile: "long" - [ ] Set
summaryInterval: "1d" - [ ] Set
strategyIntervals.long: ["1d"] - [ ] Enable
enabled_long_term_reversal: true - [ ] Configure threshold parameters
- [ ] Add both signals to
supported_volatility_action - [ ] Delete/reset
symbols.json - [ ] Restart bot
- [ ] Verify logs show signal detection
- [ ] Monitor first few signals carefully
Expected Results
With proper configuration:
Signal Frequency:
- Conservative: 1-3 signals per week
- Moderate: 3-7 signals per week
- Aggressive: 7-15 signals per week
Typical Confidence Levels:
- 70-75%: Minimum viable signals
- 75-85%: Good quality signals
- 85-95%: Excellent signals
- 95%+: Rare, extremely strong signals
Success Rate (Backtested):
- Conservative settings: ~65-75% win rate
- Moderate settings: ~55-65% win rate
- Aggressive settings: ~45-55% win rate
Note: Actual results vary by market conditions, pair selection, and exit strategy.
Risk Management Configuration
Option A: Physical Stop Loss / Take Profit (Simple & Direct)
Use this approach for fixed percentage-based exits. Best for conservative traders who want predictable risk/reward ratios.
#################################################
# 5. SMART STOP LOSS / TAKE PROFIT SETTINGS
#################################################
SLTPSettings:
StopLossPercent: 5.0 # Exit at -5% loss
TakeProfitPercent: 15.0 # Exit at +15% profit
# Advanced Features (Optional)
EnableTrailingSl: true # Lock in profits as price moves favorably
TrailingSlOffsetPercent: 2.0 # Keep stop loss 2% below peak price
EnableBreakeven: true # Move SL to breakeven after profit
BreakevenActivationPercent: 3.0 # Activate when +3% in profit
BreakevenBufferPercent: 0.5 # Set SL at +0.5% (slightly above entry)
EnableTrailingTp: false # Trail take profit (advanced)
TrailingTpTriggerPercent: 10.0 # Start trailing at +10%
TrailingTpOffsetPercent: 2.0 # Keep TP 2% above current price
EnableDynamicTrailingScaling: false # Scale trailing offset by profit level
TrailingScalingMap: # Tighter trailing as profit increases
"5.0": 2.0 # At +5% profit: 2% offset
"10.0": 1.5 # At +10% profit: 1.5% offset
"15.0": 1.0 # At +15% profit: 1% offset
"20.0": 0.5 # At +20% profit: 0.5% offset
Recommended Configurations for Long-Term Trading:
Conservative (Capital Preservation):
SLTPSettings:
StopLossPercent: 8.0 # Wider stop for daily volatility
TakeProfitPercent: 20.0 # 2.5:1 reward-to-risk ratio
EnableTrailingSl: true
TrailingSlOffsetPercent: 3.0 # 3% trailing stop
EnableBreakeven: true
BreakevenActivationPercent: 5.0
BreakevenBufferPercent: 1.0
Moderate (Balanced):
SLTPSettings:
StopLossPercent: 6.0 # -6% stop loss
TakeProfitPercent: 15.0 # +15% take profit (2.5:1)
EnableTrailingSl: true
TrailingSlOffsetPercent: 2.5
EnableBreakeven: true
BreakevenActivationPercent: 4.0
BreakevenBufferPercent: 0.5
Aggressive (Higher Risk/Reward):
SLTPSettings:
StopLossPercent: 4.0 # Tighter stop
TakeProfitPercent: 12.0 # 3:1 ratio
EnableTrailingSl: true
TrailingSlOffsetPercent: 2.0
EnableBreakeven: true
BreakevenActivationPercent: 3.0
BreakevenBufferPercent: 0.3
Option B: Intelligent Dynamic Exit Rules (Advanced & Adaptive)
Use this for time-based and candle pattern exits. Best for traders who want smart, context-aware decision making.
#################################################
# 7. INTELLIGENT RULE OPTIONS (Dynamic Exit)
#################################################
IntelligentRuleOptions:
IsEnabled: true # Enable smart exit rules
UseOriginalTPAsBase: false # Don't use fixed TP as baseline
EnableAdaptiveThresholds: true # Adjust thresholds based on market conditions
MinimumHoldTime: 2 # Hold at least 2 candles (2 days for 1d interval)
MaximumBuyHoldTime: 30 # Force exit LONG after 30 days max
MaximumSellHoldTime: 20 # Force exit SHORT after 20 days max
# Exit on Candle Pattern Reversal
CandleExitRules:
IsEnabled: true # Exit when reversal pattern detected
OppositesCandlesCount: 3 # Exit after 3 opposite-color candles
ExitPercentage: 100 # Close 100% of position
RuleName: "Trend Reversal Exit"
RequireMinimumProfit: 2.0 # Only exit if at least +2% profit
# LONG Trade Rules (Bullish Reversal Positions)
LongTrade:
ThresholdRules:
# Time-based stop losses (progressively looser)
- Minutes: 1440 # After 1 day (1440 min)
ThresholdPer: -6.0 # Exit if -6% loss
RuleName: "Day 1 Stop Loss - Long"
- Minutes: 4320 # After 3 days
ThresholdPer: -8.0 # Allow -8% loss
RuleName: "Day 3 Stop Loss - Long"
- Minutes: 10080 # After 7 days
ThresholdPer: -10.0 # Allow -10% loss
RuleName: "Week 1 Stop Loss - Long"
- Minutes: 20160 # After 14 days
ThresholdPer: -5.0 # Tighten if still not profitable
RuleName: "Week 2 Protection - Long"
TakeProfitRules:
# Progressive profit-taking
- TpMultiplier: 0.5 # At +10% profit (20% TP * 0.5)
SellPer: 30 # Sell 30% of position
RuleName: "Partial Exit 1 - Long"
IsEnabled: true
UseMarketOrder: true
- TpMultiplier: 1.0 # At +20% profit (full TP)
SellPer: 50 # Sell 50% of remaining
RuleName: "Partial Exit 2 - Long"
IsEnabled: true
UseMarketOrder: true
- TpMultiplier: 1.5 # At +30% profit (1.5x TP)
SellPer: 100 # Close entire position
RuleName: "Full Exit - Long"
IsEnabled: true
UseMarketOrder: true
# SHORT Trade Rules (Bearish Reversal Positions)
ShortTrade:
ThresholdRules:
# Tighter stops for SHORT positions (riskier in crypto)
- Minutes: 1440 # After 1 day
ThresholdPer: -5.0 # Exit if -5% loss
RuleName: "Day 1 Stop Loss - Short"
- Minutes: 2880 # After 2 days
ThresholdPer: -7.0 # Allow -7% loss
RuleName: "Day 2 Stop Loss - Short"
- Minutes: 7200 # After 5 days
ThresholdPer: -10.0 # Max -10% loss tolerance
RuleName: "Day 5 Stop Loss - Short"
- Minutes: 14400 # After 10 days
ThresholdPer: -4.0 # Tighten significantly
RuleName: "Day 10 Protection - Short"
TakeProfitRules:
# Take profits faster on SHORT positions
- TpMultiplier: 0.4 # At +8% profit
SellPer: 40 # Close 40%
RuleName: "Quick Exit 1 - Short"
IsEnabled: true
UseMarketOrder: true
- TpMultiplier: 0.7 # At +14% profit
SellPer: 60 # Close 60% of remaining
RuleName: "Quick Exit 2 - Short"
IsEnabled: true
UseMarketOrder: true
- TpMultiplier: 1.0 # At +20% profit
SellPer: 100 # Close everything
RuleName: "Full Exit - Short"
IsEnabled: true
UseMarketOrder: true
#################################################
# 8. GLOBAL SAFETY & LOSS CONTROL
#################################################
IntelligentGlobalSettings:
MinProfitToEnableTP: 1.0 # Require +1% profit before allowing TP exits
MaxLossBeforeForceClose: -15.0 # Emergency exit at -15% loss (overrides all rules)
Understanding Intelligent Rules:
Time-Based Thresholds:
- Allows wider stops initially (market needs time to move)
- Progressively tightens if trade isn't working
- Example: Allow -6% day 1, -8% day 3, but only -5% after 2 weeks
Candle Exit Rules:
- Detects trend reversals via consecutive opposite-colored candles
- For LONG: Exit after 3 red candles (bearish reversal)
- For SHORT: Exit after 3 green candles (bullish reversal)
RequireMinimumProfit: Only exit if profitable (avoids panic sells)
Progressive Profit Taking:
TpMultiplier: 0.5= Exit at 50% of your target profitSellPer: 30= Sell only 30% of position (keep 70% running)- Locks in gains while letting winners run
Global Safety:
MaxLossBeforeForceClose: -15.0= Kill switch at -15% loss- Overrides all other rules to prevent catastrophic losses
Comparison: Physical SL/TP vs Intelligent Rules
| Feature | Physical SL/TP | Intelligent Rules |
|---|---|---|
| Simplicity | Very simple | More complex |
| Predictability | Fixed percentages | Dynamic adjustments |
| Time Awareness | No | Yes (progressive stops) |
| Pattern Recognition | No | Yes (candle reversals) |
| Partial Exits | All-or-nothing | Graduated scaling out |
| Market Adaptation | Static | Adaptive thresholds |
| Best For | Conservative, set-and-forget | Active traders, optimization |
Recommended Configurations by Trading Style
Conservative Long-Term Holder
Use Physical SL/TP:
SLTPSettings:
StopLossPercent: 10.0 # Wide stop for volatility
TakeProfitPercent: 25.0 # Patient profit target
EnableTrailingSl: true
TrailingSlOffsetPercent: 4.0
EnableBreakeven: true
BreakevenActivationPercent: 8.0
IntelligentRuleOptions:
IsEnabled: false # Keep it simple
Balanced Swing Trader
Use Combination:
SLTPSettings:
StopLossPercent: 7.0 # Base protection
TakeProfitPercent: 0.0 # Disable fixed TP
EnableTrailingSl: true
TrailingSlOffsetPercent: 2.5
IntelligentRuleOptions:
IsEnabled: true
CandleExitRules:
IsEnabled: true # Exit on reversals
OppositesCandlesCount: 3
LongTrade:
TakeProfitRules: # Use intelligent TP instead
- TpMultiplier: 0.5
SellPer: 40
- TpMultiplier: 1.0
SellPer: 100
IntelligentGlobalSettings:
MaxLossBeforeForceClose: -12.0
Active Optimizer
Use Full Intelligent System:
SLTPSettings:
StopLossPercent: 0.0 # Disable physical SL/TP
TakeProfitPercent: 0.0
EnableTrailingSl: false
IntelligentRuleOptions:
IsEnabled: true
EnableAdaptiveThresholds: true # Full dynamic control
CandleExitRules:
IsEnabled: true
OppositesCandlesCount: 2 # Quick reversal detection
# Use all threshold and TP rules shown above
IntelligentGlobalSettings:
MinProfitToEnableTP: 0.5
MaxLossBeforeForceClose: -10.0
Important Considerations
For 1-Day Candles:
Minutesin Intelligent Rules = actual minutes- 1 day = 1440 minutes
- 1 week = 10080 minutes
- Plan your time thresholds accordingly
Position Sizing:
- Use smaller positions with wider stops (long-term volatility)
- Don't risk more than 2-3% of capital per trade
- Intelligent rules work best with 3-5% position sizes
Backtesting Required:
- Test SL/TP settings on historical data first
- Monitor win rate and average profit per trade
- Adjust thresholds based on actual performance
Market Conditions:
- Bull markets: Wider stops, higher TPs
- Bear markets: Tighter stops, faster profit-taking
- Adjust
MaxLossBeforeForceClosebased on overall portfolio risk
Additional Resources
- Review logs regularly:
grep "LONGTERM_SMART" bot.log - Monitor confidence levels to gauge signal quality
- Adjust
min_confidence_thresholdbased on historical performance - Track SL/TP hit rates to optimize risk management
- Use
IntelligentGlobalSettings.MaxLossBeforeForceCloseas portfolio protection
Extended Final Checklist
Signal Configuration:
- [ ] Set
Profile: "long" - [ ] Set
summaryInterval: "1d" - [ ] Set
strategyIntervals.long: ["1d"] - [ ] Enable
enabled_long_term_reversal: true - [ ] Configure threshold parameters
- [ ] Add both signals to
supported_volatility_action - [ ] Delete/reset
symbols.json
Risk Management:
- [ ] Choose SL/TP method (Physical vs Intelligent)
- [ ] Configure stop loss percentages
- [ ] Configure take profit targets
- [ ] Set global safety limits (
MaxLossBeforeForceClose) - [ ] Test with small position sizes first
- [ ] Verify emergency exit mechanisms work
Launch:
- [ ] Restart bot
- [ ] Verify logs show signal detection
- [ ] Monitor first few signals carefully
- [ ] Track SL/TP execution
- [ ] Adjust based on real performance