Skip to Content
VRVP StrategyGuidesConfiguration

Configuration

VRVP Strategy uses a comprehensive configuration system with sensible defaults that can be customized via environment variables.

Configuration Structure

All configurations are defined in config/settings.py using Python dataclasses.

Indicator Settings

Supertrend Configuration

@dataclass class SupertrendConfig: length: int = 10 # ATR calculation period multiplier: float = 3.0 # ATR multiplier for bands
ParameterDefaultDescription
length10Period for ATR calculation
multiplier3.0Multiplier for Supertrend bands

Tuning Tips:

  • Higher multiplier = fewer signals but more reliable
  • Lower multiplier = more signals but more whipsaws
  • Length affects trend sensitivity

Stochastic RSI Configuration

@dataclass class StochRSIConfig: length: int = 14 # RSI period stoch_length: int = 14 # Stochastic period smooth_k: int = 3 # %K smoothing smooth_d: int = 3 # %D smoothing oversold: float = 20.0 # Oversold threshold overbought: float = 80.0 # Overbought threshold
ParameterDefaultDescription
length14RSI calculation period
stoch_length14Stochastic calculation period
smooth_k3%K line smoothing
smooth_d3%D line smoothing
oversold20.0Oversold level (0-100)
overbought80.0Overbought level (0-100)

Volume Profile Configuration

@dataclass class VolumeProfileConfig: row_count: int = 24 # Number of price levels value_area_pct: float = 0.70 # Value area percentage hvn_threshold: float = 1.5 # High volume node multiplier lvn_threshold: float = 0.5 # Low volume node multiplier
ParameterDefaultDescription
row_count24Number of price bins
value_area_pct70%Percentage for value area
hvn_threshold1.5xHigh volume node threshold
lvn_threshold0.5xLow volume node threshold

Fair Value Gap Configuration

@dataclass class FVGConfig: min_gap_percent: float = 0.001 # Minimum gap size (0.1%) max_age_bars: int = 20 # Maximum age in bars mitigation_pct: float = 0.5 # Mitigation threshold
ParameterDefaultDescription
min_gap_percent0.1%Minimum gap to consider valid
max_age_bars20Maximum bars before FVG expires
mitigation_pct50%Percentage fill for mitigation

Risk Management

Risk Configuration

@dataclass class RiskConfig: risk_per_trade: float = 0.02 # 2% per trade max_position_size: float = 0.10 # 10% max position circuit_breaker: float = 0.15 # 15% daily loss limit atr_sl_multiplier: float = 2.0 # Stop loss ATR multiplier atr_tp_multiplier: float = 4.0 # Take profit ATR multiplier breakeven_threshold: float = 0.01 # 1% for trailing
ParameterDefaultDescription
risk_per_trade2%Maximum risk per trade
max_position_size10%Maximum position as % of account
circuit_breaker15%Daily loss limit before halting
atr_sl_multiplier2.0ATR multiplier for stop loss
atr_tp_multiplier4.0ATR multiplier for take profit
breakeven_threshold1%Profit % to move stop to break-even

Environment Variables

Set risk parameters via environment:

RISK_PER_TRADE=0.02 MAX_POSITION_SIZE=0.10 CIRCUIT_BREAKER=0.15 ATR_SL_MULTIPLIER=2.0 ATR_TP_MULTIPLIER=4.0 BREAKEVEN_THRESHOLD=0.01

Trading Configuration

@dataclass class TradingConfig: instruments: List[str] = field(default_factory=lambda: ["EUR_USD"]) htf_timeframe: str = "4H" # Higher timeframe ltf_timeframe: str = "1H" # Lower timeframe lookback_bars: int = 100 # Historical bars to load update_interval: int = 60 # Seconds between updates

Capital.com API Configuration

@dataclass class CapitalComConfig: api_key: str identifier: str password: str demo: bool = True base_url: str = "https://api-capital.backend-capital.com"

Environment Variables

CAPITAL_API_KEY=your_api_key CAPITAL_IDENTIFIER=your_email CAPITAL_PASSWORD=your_password CAPITAL_DEMO=true

Security: Never commit API credentials to version control. Always use environment variables or a .env file.

Example Configuration File

Complete .env example:

# Capital.com API CAPITAL_API_KEY=abc123xyz CAPITAL_IDENTIFIER=trader@example.com CAPITAL_PASSWORD=SecurePassword123 CAPITAL_DEMO=true # Email Notifications RESEND_API_KEY=re_abcdefgh NOTIFICATION_EMAIL=alerts@example.com # Risk Management RISK_PER_TRADE=0.02 MAX_POSITION_SIZE=0.10 CIRCUIT_BREAKER=0.15 ATR_SL_MULTIPLIER=2.0 ATR_TP_MULTIPLIER=4.0 # Trading INSTRUMENTS=EUR_USD,GBP_USD,USD_JPY HTF_TIMEFRAME=4H LTF_TIMEFRAME=1H UPDATE_INTERVAL=60

Loading Configuration

Configuration is automatically loaded when the application starts:

from config.settings import ( SupertrendConfig, StochRSIConfig, VolumeProfileConfig, FVGConfig, RiskConfig, TradingConfig, CapitalComConfig, ) # Configurations are loaded from environment variables supertrend_config = SupertrendConfig() risk_config = RiskConfig()

Next Steps

Last updated on