docs

Documentation

Complete guide to installing, configuring, and using Diffusion Zones CLI for professional-grade trading signals and backtesting.

01

Quick Start

Prerequisites

Installation

# Download the binary # After purchase, you'll receive a license key and download link # Make executable (macOS/Linux) chmod +x dz # Move to PATH mv dz /usr/local/bin/ # Verify installation dz --version

Configuration

# Set environment variables export ALPACA_API_KEY=your-key-here export ALPACA_SECRET_KEY=your-secret-key-here # Optional export ALPACA_DATA_FEED=iex  # iex (free) or sip (paid) export LOG_LEVEL=warn         # debug, info, warn, error

Generate Your First Signals

# Get signals for multiple symbols dz SPY NVDA TSLA # Backtest a strategy dz backtest SPY --days 90 --monte-carlo # Optimize parameters dz optimize QQQ --strategy regime-switching
02

Trading Strategies

Conservative

1.5% risk per trade, tight stops. Win Rate: 45-50%.

--mt-strategy conservative

Moderate

2% risk per trade, balanced approach. Win Rate: 47-52%.

--mt-strategy moderate

Aggressive

4% risk per trade, wider stops. Win Rate: 50-55%.

--mt-strategy aggressive

Regime-Switching

Auto-switches between momentum and mean reversion based on market ADX.

--strategy regime-switching

Multi-Timeframe Aligned

Requires 1H, 4H, 1D trend alignment. Win Rate: 52-58%.

--mt --mt-strategy aligned

Momentum with Volume

Trades trends with volume confirmation (STRATEGY-001).

--strategy momentum-volume

⚠️ All strategies include walk-forward validation and Monte Carlo simulation to prevent overfitting and provide statistical confidence intervals.

03

Backtesting & Analysis

Professional Backtesting

# Basic backtest dz backtest SPY --days 90 # With Monte Carlo simulation (1000 iterations) dz backtest SPY --days 90 --monte-carlo --monte-carlo-simulations 1000 # Multi-strategy comparison dz multibacktest --strategies "conservative,moderate,aggressive" SPY

Walk-forward validation prevents look-ahead bias. Monte Carlo provides 95% confidence intervals for all metrics.

Parameter Optimization

# Grid search with walk-forward validation dz optimize SPY --days 60 # Optimize specific parameter dz optimize SPY --optimize-param signal.momentum5Weight --optimize-min 0.3 --optimize-max 0.7 # Maximize win rate dz optimize SPY --optimize-objective winrate --optimize-validation walk-forward

Grid search explores parameter combinations systematically. Walk-forward validation ensures robustness across different market regimes.

Validation Suite

# Run comprehensive validation (200+ backtests) dz validation-suite SPY --validation-timeout 120 # Test specific strategies dz validation-suite --validation-strategies "conservative,moderate" SPY # Use watchlist dz validation-suite --watchlist tech --validation-timeout 300

Tests across multiple market periods (COVID-2020, Recovery-2021, RateHike-2022, etc.) and regimes (bull, bear, sideways, high volatility).

04

Diffusion Zones Algorithm

The Diffusion Zones algorithm calculates dynamic support and resistance zones based on price diffusion, volatility-adjusted momentum, and multi-timeframe trend analysis.

Key Components

  • ATR (Average True Range) - Volatility measurement
  • EMA (Exponential Moving Average) - Trend smoothing
  • Momentum Score - 5-period and 20-period
  • Volume Confirmation - Entry validation
  • Regime Detection - ADX-based market state

Signal Confidence

  • 75-100% - Very Strong
  • 65-74% - Strong
  • 55-64% - Moderate
  • <55% - Weak (avoid)

⚠️ The algorithm is designed for research and educational purposes. Past performance does not guarantee future results. Always validate strategies with walk-forward backtesting before risking real capital.

05

Output Formats

Terminal Table (Default)

🎯 DIFFUSION ZONES™ SIGNALS ╔════════════════════════════════════════╗ ║ SYMBOL  TREND    BUY    CURRENT   SELL  ║ ╠════════════════════════════════════════╣ ║▲ SPY     BULL    478.32  482.15   488.91 ║ ║▲ NVDA    BULL    485.20  492.80   512.30 ║ ║▼ TSLA    BEAR    238.50  245.20   258.90 ║ ╚════════════════════════════════════════╝

JSON Output

{
  "signals": [
    {
      "symbol": "SPY",
      "trend": "BULLISH",
      "buy_trade": 478.32,
      "sell_trade": 488.91,
      "confidence": 0.92
    }
  ]
}

CSV Output

symbol,trend,buy_trade,sell_trade,confidence SPY,BULLISH,478.32,488.91,0.92 NVDA,BULLISH,485.20,512.30,0.88 TSLA,BEARISH,238.50,258.90,0.78

Use --output json or --output csv to export signals for automation or further analysis.

⚠️ DISCLAIMER

This tool is for educational and informational purposes only. Not financial advice. Trading involves substantial risk of loss, including the possibility of losing more than your initial investment. Past performance does not guarantee future results. Always do your own research and consider your risk tolerance before making investment decisions.