287 lines
9.7 KiB
Markdown
287 lines
9.7 KiB
Markdown
|
|
# Strategy Guide
|
||
|
|
|
||
|
|
Learn how to create, configure, and manage trading strategies in Crypto Trader.
|
||
|
|
|
||
|
|
## What is a Strategy?
|
||
|
|
|
||
|
|
A trading strategy is a set of rules that determine when to buy and sell cryptocurrencies. Strategies analyze market data and generate trading signals.
|
||
|
|
|
||
|
|
## Pre-built Strategies
|
||
|
|
|
||
|
|
Crypto Trader includes several pre-built strategies:
|
||
|
|
|
||
|
|
### RSI Strategy
|
||
|
|
|
||
|
|
Uses the Relative Strength Index to identify overbought and oversold conditions.
|
||
|
|
|
||
|
|
- **Buy Signal**: RSI below 30 (oversold)
|
||
|
|
- **Sell Signal**: RSI above 70 (overbought)
|
||
|
|
- **Parameters**: RSI period (default: 14)
|
||
|
|
|
||
|
|
### MACD Strategy
|
||
|
|
|
||
|
|
Uses Moving Average Convergence Divergence for trend following.
|
||
|
|
|
||
|
|
- **Buy Signal**: MACD crosses above signal line
|
||
|
|
- **Sell Signal**: MACD crosses below signal line
|
||
|
|
- **Parameters**: Fast period, slow period, signal period
|
||
|
|
|
||
|
|
### Moving Average Crossover
|
||
|
|
|
||
|
|
Uses two moving averages to identify trend changes.
|
||
|
|
|
||
|
|
- **Buy Signal**: Short MA crosses above long MA
|
||
|
|
- **Sell Signal**: Short MA crosses below long MA
|
||
|
|
- **Parameters**: Short MA period, long MA period
|
||
|
|
|
||
|
|
### Confirmed Strategy (Multi-Indicator)
|
||
|
|
|
||
|
|
Requires multiple indicators (RSI, MACD, Moving Average) to align before generating signals. This significantly reduces false signals by requiring confirmation from 2-3 indicators.
|
||
|
|
|
||
|
|
- **Buy Signal**: When majority of indicators agree on buy signal
|
||
|
|
- **Sell Signal**: When majority of indicators agree on sell signal
|
||
|
|
- **Parameters**:
|
||
|
|
- RSI period, oversold, overbought thresholds
|
||
|
|
- MACD fast, slow, signal periods
|
||
|
|
- MA fast, slow periods, MA type (SMA/EMA)
|
||
|
|
- Minimum confirmations required (default: 2)
|
||
|
|
- Which indicators to require (RSI, MACD, MA)
|
||
|
|
|
||
|
|
### Divergence Strategy
|
||
|
|
|
||
|
|
Detects price vs. indicator divergences which are powerful reversal signals. Works exceptionally well in ranging markets.
|
||
|
|
|
||
|
|
- **Buy Signal**: Bullish divergence (price makes lower low, indicator makes higher low)
|
||
|
|
- **Sell Signal**: Bearish divergence (price makes higher high, indicator makes lower high)
|
||
|
|
- **Parameters**:
|
||
|
|
- Indicator type: RSI or MACD (default: RSI)
|
||
|
|
- Lookback period for swing detection (default: 20)
|
||
|
|
- Minimum swings required (default: 2)
|
||
|
|
- Minimum confidence threshold (default: 0.5)
|
||
|
|
|
||
|
|
### Bollinger Bands Mean Reversion
|
||
|
|
|
||
|
|
Trades mean reversion using Bollinger Bands. Buys at lower band in uptrends, exits at middle band. Works well in ranging markets.
|
||
|
|
|
||
|
|
- **Buy Signal**: Price touches lower Bollinger Band in uptrend
|
||
|
|
- **Sell Signal**: Price reaches middle band (profit target) or touches upper band (stop loss)
|
||
|
|
- **Parameters**:
|
||
|
|
- Bollinger Bands period (default: 20)
|
||
|
|
- Standard deviation multiplier (default: 2.0)
|
||
|
|
- Trend filter enabled (default: True)
|
||
|
|
- Trend MA period (default: 50)
|
||
|
|
- Entry threshold (how close to band, default: 0.95)
|
||
|
|
- Exit threshold (when to take profit, default: 0.5)
|
||
|
|
|
||
|
|
### Consensus Strategy (Ensemble)
|
||
|
|
|
||
|
|
Combines signals from multiple strategies with voting mechanism. Only executes when multiple strategies agree, improving signal quality through ensemble methods.
|
||
|
|
|
||
|
|
- **Buy Signal**: When minimum number of strategies agree on buy
|
||
|
|
- **Sell Signal**: When minimum number of strategies agree on sell
|
||
|
|
- **Parameters**:
|
||
|
|
- Strategy names to include (None = all available)
|
||
|
|
- Minimum consensus count (default: 2)
|
||
|
|
- Use performance-based weights (default: True)
|
||
|
|
- Minimum weight threshold (default: 0.3)
|
||
|
|
- Strategies to exclude
|
||
|
|
|
||
|
|
## Strategy Management Page
|
||
|
|
|
||
|
|
The Strategy Management page provides a comprehensive interface for creating, editing, and managing all your trading strategies.
|
||
|
|
|
||
|
|
### Accessing Strategy Management
|
||
|
|
|
||
|
|
1. Click on **Strategies** in the navigation menu
|
||
|
|
2. You'll see a table listing all your strategies with:
|
||
|
|
- Strategy name and description
|
||
|
|
- Strategy type
|
||
|
|
- Trading symbol
|
||
|
|
- Timeframes
|
||
|
|
- Status (Enabled/Disabled)
|
||
|
|
- Paper Trading mode
|
||
|
|
- Action buttons (Start, Stop, Edit, Delete)
|
||
|
|
|
||
|
|
## Creating a Strategy
|
||
|
|
|
||
|
|
1. Navigate to the **Strategies** page
|
||
|
|
2. Click **Create Strategy** button
|
||
|
|
3. The strategy dialog has three tabs:
|
||
|
|
|
||
|
|
**Basic Settings Tab**:
|
||
|
|
- **Name**: Give your strategy a descriptive name (required)
|
||
|
|
- **Description**: Optional description
|
||
|
|
- **Strategy Type**: Select from RSI, MACD, Moving Average, Confirmed, Divergence, Bollinger Mean Reversion, Consensus, DCA, Grid, or Momentum
|
||
|
|
- **Symbol**: Trading pair (e.g., BTC/USD)
|
||
|
|
- **Exchange**: Select the exchange (required)
|
||
|
|
- **Timeframes**: Select one or more timeframes (1m, 5m, 15m, 30m, 1h, 4h, 1d)
|
||
|
|
- **Paper Trading Mode**: Toggle for paper trading (recommended for testing)
|
||
|
|
|
||
|
|
**Parameters Tab**:
|
||
|
|
- Configure strategy-specific parameters
|
||
|
|
- Parameters vary by strategy type
|
||
|
|
- Default values are provided for all parameters
|
||
|
|
- See strategy-specific sections below for parameter details
|
||
|
|
|
||
|
|
**Risk Settings Tab**:
|
||
|
|
- **Position Size (%)**: Percentage of capital to use per trade
|
||
|
|
- **Stop Loss (%)**: Maximum loss percentage before exit
|
||
|
|
- **Take Profit (%)**: Profit target percentage
|
||
|
|
- **Max Position Size**: Optional maximum position size limit
|
||
|
|
|
||
|
|
4. Click **Create** to save the strategy
|
||
|
|
|
||
|
|
The strategy will appear in the strategies table. New strategies start as **Disabled** - you must enable and start them manually.
|
||
|
|
|
||
|
|
## Managing Strategies
|
||
|
|
|
||
|
|
### Starting a Strategy
|
||
|
|
|
||
|
|
1. Find the strategy in the table
|
||
|
|
2. Click the **Start** button (green play icon)
|
||
|
|
3. The strategy status will change to **Enabled** and it will begin generating signals
|
||
|
|
|
||
|
|
### Stopping a Strategy
|
||
|
|
|
||
|
|
1. Find the running strategy in the table
|
||
|
|
2. Click the **Stop** button (red stop icon)
|
||
|
|
3. The strategy will stop generating new signals
|
||
|
|
|
||
|
|
### Editing a Strategy
|
||
|
|
|
||
|
|
1. Click the **Edit** button (pencil icon) for the strategy
|
||
|
|
2. Modify any settings in the dialog
|
||
|
|
3. Click **Update** to save changes
|
||
|
|
|
||
|
|
**Note**: Strategy type cannot be changed after creation. You must create a new strategy with a different type.
|
||
|
|
|
||
|
|
### Deleting a Strategy
|
||
|
|
|
||
|
|
1. Click the **Delete** button (red trash icon)
|
||
|
|
2. Confirm the deletion in the dialog
|
||
|
|
3. The strategy and all its configuration will be permanently deleted
|
||
|
|
|
||
|
|
## Strategy Types
|
||
|
|
|
||
|
|
### DCA (Dollar Cost Averaging)
|
||
|
|
Invests a fixed amount at regular intervals (daily, weekly, or monthly). Ideal for long-term accumulation.
|
||
|
|
|
||
|
|
**Parameters:**
|
||
|
|
- Amount: Fixed investment amount per interval
|
||
|
|
- Interval: Daily, weekly, or monthly
|
||
|
|
- Target Allocation: Target portfolio allocation percentage
|
||
|
|
|
||
|
|
### Grid Trading
|
||
|
|
Places buy orders at lower price levels and sell orders at higher levels. Profits from price oscillations.
|
||
|
|
|
||
|
|
**Parameters:**
|
||
|
|
- Grid Spacing: Percentage between grid levels
|
||
|
|
- Number of Levels: Grid levels above and below center price
|
||
|
|
- Profit Target: Profit percentage to take
|
||
|
|
|
||
|
|
### Momentum
|
||
|
|
Trades based on price momentum with volume confirmation. Enters on strong upward momentum, exits on reversal.
|
||
|
|
|
||
|
|
**Parameters:**
|
||
|
|
- Lookback Period: Period for momentum calculation
|
||
|
|
- Momentum Threshold: Minimum momentum to enter
|
||
|
|
- Volume Threshold: Volume increase multiplier for confirmation
|
||
|
|
- Exit Threshold: Momentum reversal threshold
|
||
|
|
|
||
|
|
## Strategy Configuration
|
||
|
|
|
||
|
|
### Basic Settings
|
||
|
|
|
||
|
|
- **Name**: Descriptive name for your strategy
|
||
|
|
- **Symbol**: Trading pair (e.g., BTC/USD)
|
||
|
|
- **Timeframe**: Data timeframe (1m, 5m, 15m, 1h, 4h, 1d)
|
||
|
|
- **Enabled**: Turn strategy on/off
|
||
|
|
|
||
|
|
### Parameters
|
||
|
|
|
||
|
|
Each strategy has specific parameters:
|
||
|
|
|
||
|
|
- **RSI Strategy**: RSI period, overbought threshold, oversold threshold
|
||
|
|
- **MACD Strategy**: Fast period, slow period, signal period
|
||
|
|
- **Moving Average**: Short period, long period, MA type (SMA/EMA)
|
||
|
|
- **Confirmed Strategy**: RSI, MACD, and MA parameters, minimum confirmations
|
||
|
|
- **Divergence Strategy**: Indicator type, lookback period, confidence threshold
|
||
|
|
- **Bollinger Mean Reversion**: Period, std dev, trend filter settings
|
||
|
|
- **Consensus Strategy**: Strategy selection, consensus threshold, weighting options
|
||
|
|
|
||
|
|
### Risk Settings
|
||
|
|
|
||
|
|
- **Position Size**: Amount to trade per signal
|
||
|
|
- **Max Position**: Maximum position size
|
||
|
|
- **Stop Loss**: Percentage, price level, or ATR-based dynamic stop
|
||
|
|
- **ATR-based stops**: Automatically adjust stop distance based on market volatility
|
||
|
|
- **ATR Multiplier**: Multiplier for ATR calculation (default: 2.0)
|
||
|
|
- **ATR Period**: Period for ATR calculation (default: 14)
|
||
|
|
- **Take Profit**: Profit target
|
||
|
|
- **Trend Filter**: Optional ADX-based trend filter to avoid trading in choppy markets
|
||
|
|
|
||
|
|
## Multi-Timeframe Strategies
|
||
|
|
|
||
|
|
Strategies can use multiple timeframes:
|
||
|
|
|
||
|
|
1. Primary timeframe for signal generation
|
||
|
|
2. Higher timeframes for trend confirmation
|
||
|
|
3. Lower timeframes for entry timing
|
||
|
|
|
||
|
|
## Strategy Scheduling
|
||
|
|
|
||
|
|
Strategies can be scheduled to run:
|
||
|
|
|
||
|
|
- **Continuous**: Runs on every new candle
|
||
|
|
- **Time-based**: Runs at specific times
|
||
|
|
- **Condition-based**: Runs when conditions are met
|
||
|
|
|
||
|
|
## Managing Strategies
|
||
|
|
|
||
|
|
### Enabling/Disabling
|
||
|
|
|
||
|
|
- Toggle strategy on/off without deleting
|
||
|
|
- Disabled strategies don't generate signals
|
||
|
|
- Useful for testing multiple strategies
|
||
|
|
|
||
|
|
### Editing Strategies
|
||
|
|
|
||
|
|
1. Select the strategy
|
||
|
|
2. Click "Edit"
|
||
|
|
3. Modify parameters
|
||
|
|
4. Save changes
|
||
|
|
|
||
|
|
### Deleting Strategies
|
||
|
|
|
||
|
|
1. Select the strategy
|
||
|
|
2. Click "Delete"
|
||
|
|
3. Confirm deletion
|
||
|
|
|
||
|
|
## Strategy Performance
|
||
|
|
|
||
|
|
Monitor strategy performance:
|
||
|
|
|
||
|
|
- **Win Rate**: Percentage of profitable trades
|
||
|
|
- **Total Return**: Overall return
|
||
|
|
- **Sharpe Ratio**: Risk-adjusted return
|
||
|
|
- **Max Drawdown**: Largest peak-to-trough decline
|
||
|
|
- **Number of Trades**: Total trades executed
|
||
|
|
|
||
|
|
## Best Practices
|
||
|
|
|
||
|
|
1. **Backtest First**: Always backtest strategies before live trading
|
||
|
|
2. **Start Small**: Use small position sizes initially
|
||
|
|
3. **Monitor Performance**: Regularly review strategy results
|
||
|
|
4. **Adjust Parameters**: Optimize based on performance
|
||
|
|
5. **Use Paper Trading**: Test changes in paper trading first
|
||
|
|
|
||
|
|
## Creating Custom Strategies
|
||
|
|
|
||
|
|
For advanced users, you can create custom strategies:
|
||
|
|
|
||
|
|
1. See [Developer Guide](../developer/creating_strategies.md)
|
||
|
|
2. Extend the `BaseStrategy` class
|
||
|
|
3. Implement signal generation logic
|
||
|
|
4. Register your strategy
|
||
|
|
|