42 Market Conditions: A Technical Guide to Mercury Bot's Trading Logic
Introduction
Mercury Bot's market analysis system is built on a foundation of 42 precisely defined market conditions. Each condition represents a specific technical setup that can trigger trading signals. This guide details how these conditions are implemented and how they drive the bot's decision-making process.
Core Components
The market condition system is built on three key pillars:
- Indicator-Based Analysis: Pure technical indicator signals without reliance on candlestick patterns
- Timeframe Optimization: Each condition is optimized for a specific timeframe
- Clear Exit Rules: Time-based take profit targets with indicator confirmation
Implementation in Mercury Bot
The conditions are implemented through a modular system:
interface MarketCondition {
name: string; // e.g., "CROSSOVER_BUY_MARKET_TP_IN_4H"
timeframe: string; // e.g., "4h"
indicators: string[]; // Required indicators
entryLogic: IndicatorCheck[]; // Entry conditions
exitLogic: IndicatorCheck[]; // Exit conditions
targetHoldTime: number; // Hold time in minutes
}
interface IndicatorCheck {
indicator: string; // e.g., "MA_FAST"
condition: string; // e.g., "CROSSES_ABOVE"
target: string; // e.g., "MA_SLOW"
threshold?: number; // Optional numeric threshold
}
Example Condition Implementation
Here's how a typical condition is defined:
const CROSSOVER_BUY_MARKET: MarketCondition = {
name: 'CROSSOVER_BUY_MARKET_TP_IN_4H',
timeframe: '4h',
indicators: ['MA_FAST', 'MA_SLOW', 'MACD'],
entryLogic: [
{
indicator: 'MA_FAST',
condition: 'CROSSES_ABOVE',
target: 'MA_SLOW',
},
{
indicator: 'MACD',
condition: 'ABOVE',
target: '0',
},
],
exitLogic: [
{
indicator: 'MA_FAST',
condition: 'CROSSES_BELOW',
target: 'MA_SLOW',
},
],
targetHoldTime: 240, // 4 hours in minutes
};
Key Condition Categories
The 42 conditions are organized into several categories:
-
Moving Average Based (6 conditions)
- Crossovers
- Multi-MA Stack
- Hull MA Trends
-
Momentum Indicators (8 conditions)
- RSI Recovery/Cool-off
- MACD Zero Line
- MFI Flow
-
Volatility Based (8 conditions)
- Bollinger Band Expansion
- ATR Surge
- Squeeze Release
-
Volume Analysis (6 conditions)
- Volume Bursts
- OBV Patterns
- VWAP Breaks
-
Trend Strength (6 conditions)
- ADX Breakouts
- Supertrend Signals
- Trendline Respect
-
Multi-Timeframe (4 conditions)
- RSI Alignment
- MACD Divergence
-
Advanced Setups (4 conditions)
- Ichimoku Signals
- Fibonacci Confluence
Integration with Mercury Bot
The conditions are integrated into Mercury Bot's analysis pipeline:
async analyzeMarket(symbol: string): Promise<MarketAnalysis> {
// Fetch technical indicators
const indicators = await this.mercuryTA.getTechnicalAnalysis(symbol);
// Check each condition
const activeConditions = this.conditions
.filter(condition => this.checkCondition(condition, indicators))
.map(condition => ({
name: condition.name,
confidence: this.calculateConfidence(condition, indicators),
timeframe: condition.timeframe,
targetExit: this.calculateTargetExit(condition)
}));
return {
symbol,
timestamp: Date.now(),
conditions: activeConditions,
indicators
};
}
Confidence Scoring
Each condition's confidence is calculated based on multiple factors:
interface ConfidenceMetrics {
indicatorAlignment: number; // How well indicators align
volumeConfirmation: number; // Volume support
trendStrength: number; // Overall trend strength
timeframeAlignment: number; // Multi-timeframe confirmation
}
Usage in Trading
The conditions drive Mercury Bot's trading decisions through:
- Signal Generation: Conditions trigger initial trade signals
- Risk Management: Condition-specific stop losses and take profits
- Position Sizing: Confidence scores influence position sizes
- Exit Timing: Time-based exits with indicator confirmation
Future Enhancements
Planned improvements include:
- Machine Learning Integration: Using historical condition performance to optimize parameters
- Dynamic Timeframe Selection: Automatically adjusting timeframes based on market volatility
- Condition Combinations: Creating meta-conditions from multiple base conditions
- Performance Analytics: Tracking success rates per condition
Conclusion
These 42 market conditions form the backbone of Mercury Bot's technical analysis system. By focusing on pure indicator signals and optimizing for specific timeframes, we've created a robust framework for automated trading decisions.
The system's modular design allows for easy updates and extensions, while the clear exit rules help maintain disciplined trading. As we continue to gather performance data, we'll refine and optimize these conditions to improve trading results.
Note: This is a technical overview. Always use proper risk management and consider market conditions before trading.
