Skip to content

Phase 5 Week 1 - Paper Trading Test Plan

Test Period: 2025-11-04 to 2025-11-06 (2 days minimum) Improvements Testing: ATR-based dynamic stops + Volume confirmation filter Expected Results: Win rate 42-45%, Sharpe ≥2.4, zero critical bugs


Test Configuration

Portfolio Settings

From /trading_agents/config/portfolio_config.yaml:

micro_cap:
  enabled: true                 # ✅ READY FOR TESTING
  strategy_type: "momentum_breakout"
  max_position_size: 1000       # $1000 per trade
  max_positions: 3              # Max 3 concurrent
  stop_loss_pct: 0.10           # Now uses ATR-based (15-24%)

Capital Allocation: - Total capital: $99,000 (Alpaca Paper) - Micro-cap allocation: 20% = $19,800 - Max per position: $1,000 - Cash reserve: 15% = $14,850

Week 1 Improvements Being Tested

1. ATR-Based Dynamic Stops

Implementation: trading_agents/position_management_agent.py:556-601

Changes: - Old: Fixed 9% stops for all micro-caps - New: 15-24% ATR-based stops (2x ATR) - Maintains: 3:1 reward-to-risk ratio

Expected Impact: - Win rate: +2-3% - P&L: +200-300% - Sharpe: +0.5-0.6

How to Verify: - Check position logs for "Micro-cap ATR stop: X.X%" - Confirm stop_price uses ATR calculation, not fixed 9% - Verify fallback to 9% if ATR unavailable

2. Volume Confirmation Filter

Implementation: trading_agents/strategy_agent.py:210-222

Changes: - Old: Volume > average (1.0x threshold) - New: Volume ≥ 1.5x average (50% above)

Expected Impact: - Win rate: +2-3% - Better fills (reduced slippage 0.5-1%) - Filters weak setups

How to Verify: - Check strategy logs for "Volume confirmed (X.XXx average)" - Verify rejected setups show "Volume too low" - Confirm volume_multiple in observability spans


Success Criteria

Primary Metrics (MUST PASS)

Metric Target Pass/Fail
Win Rate ≥42% [ ]
Sharpe Ratio ≥2.4 [ ]
Completed Trades ≥3 [ ]
Critical Bugs 0 [ ]

Secondary Metrics (NICE TO HAVE)

Metric Target Actual
Total P&L Positive ___
Max Drawdown ≤18% ___
Avg Win +20-22% ___
Avg Loss -15% (ATR stop) ___
Volume Filter Usage >0 rejections ___

Technical Validation

  • [ ] ATR calculation working (check logs for "ATR calculated: $X.XX")
  • [ ] ATR caching functional (60-min cache)
  • [ ] Volume confirmation filtering active
  • [ ] Stops placed correctly (15-24% for micro-caps)
  • [ ] Position tracking accurate
  • [ ] No exceptions or crashes
  • [ ] All agents communicating via Redis

Pre-Flight Checklist

Environment Setup

  • [x] Portfolio config: Micro-cap enabled
  • [ ] Alpaca Paper: Account active and funded
  • [ ] Redis: Running on localhost:6379
  • [ ] PostgreSQL: Running on localhost:5433
  • [ ] Qdrant: Vector index complete (970k+ points)
  • [ ] Logs directory: Exists at logs/trading/

Code Validation

  • [x] ATR implementation: position_management_agent.py updated
  • [x] Volume filter: strategy_agent.py updated
  • [x] Documentation: MICRO_CAP_PHASE_3_4_COMPLETE.md updated
  • [x] Git commit: 2b7d011 (Phase 5 Week 1)

Monitoring Setup

  • [ ] Jaeger: Traces enabled (http://localhost:16686)
  • [ ] Logs: Tail logs/trading/micro_cap.log
  • [ ] Redis monitor: redis-cli MONITOR (optional)

Test Execution Plan

Day 1 (Nov 4 - PM Session)

Time: 2-3 hours before market close

Tasks: 1. Start all required services:

# Start Redis
redis-server

# Start PostgreSQL (if not running)
docker ps | grep postgres

# Start Qdrant
docker ps | grep qdrant

  1. Start trading agents:

    cd /Users/bertfrichot/mem-agent-mcp/trading_agents
    
    # Start position management agent
    python -m trading_agents.position_management_agent
    
    # Start strategy agent (in separate terminal)
    python -m trading_agents.strategy_agent
    
    # Start risk management agent (in separate terminal)
    python -m trading_agents.risk_management_agent
    

  2. Monitor logs in real-time:

    tail -f logs/trading/micro_cap.log
    tail -f logs/trading/portfolio_manager.log
    

  3. Expected behavior:

  4. Strategy agent scans for candidates
  5. Volume filter rejects some setups (look for "Volume too low")
  6. ATR calculation for approved setups
  7. Positions opened with ATR-based stops (15-24%)

Success Indicators: - At least 1 position opened - ATR calculation logged - Volume filtering active - No exceptions

Day 2 (Nov 5 - Full Day)

Time: Market hours (9:30 AM - 4:00 PM ET)

Tasks: 1. Continue monitoring positions 2. Track entry/exit executions 3. Verify stop loss behavior 4. Document any edge cases

Success Indicators: - Total 2-3 completed trades minimum - Win rate tracking toward 42%+ - No system crashes - Proper risk management

Day 3 (Nov 6 - Analysis)

Time: After market close

Tasks: 1. Calculate final metrics 2. Review all trades in PostgreSQL 3. Analyze ATR vs. fixed stop comparison 4. Document lessons learned 5. Decide: Proceed to Week 2 or iterate?


Monitoring Checklist

Real-Time Monitoring

Every 30 minutes: - [ ] Check logs/trading/micro_cap.log for errors - [ ] Verify Redis connectivity (redis-cli PING) - [ ] Check Jaeger for trace errors - [ ] Monitor Alpaca paper account balance

Every trade: - [ ] Entry price logged correctly - [ ] ATR stop calculated and logged - [ ] Volume confirmation passed - [ ] Position tracked in system

End of Day

  • [ ] Export trades from PostgreSQL
  • [ ] Calculate daily metrics (P&L, win rate)
  • [ ] Review volume rejections count
  • [ ] Check ATR cache hit rate
  • [ ] Backup logs to /docs/trading/test_logs/

Data Collection

Trades Table (PostgreSQL)

Record for each trade:

SELECT
    symbol,
    entry_price,
    stop_price,
    target_price,
    exit_price,
    pnl,
    entry_time,
    exit_time,
    stop_pct,          -- Should be 15-24% for micro-caps
    volume_multiple,   -- Should be ≥1.5x
    strategy_type
FROM trades
WHERE channel = 'micro_cap'
AND entry_time >= '2025-11-04'
ORDER BY entry_time;

Metrics to Track

Metric Formula Target
Win Rate Wins / Total Trades ≥42%
Sharpe (Avg Return - Risk Free) / StdDev ≥2.4
Avg Win Sum(Winning Trades) / Win Count +20-22%
Avg Loss Sum(Losing Trades) / Loss Count -15%
Profit Factor Gross Profit / Gross Loss >1.5
Max Drawdown Largest Peak-to-Trough Decline ≤18%
Volume Rejections Count(Volume < 1.5x avg) >0

Risk Monitoring

Portfolio-Level Limits

From portfolio_config.yaml: - Max total positions: 18 (across all channels) - Max drawdown: 20% (CIRCUIT BREAKER) - Max single position: 10% of capital - Max sector exposure: 30%

Micro-Cap Channel Limits

  • Max positions: 3 concurrent
  • Max per position: $1,000
  • Total capital: $19,800 (20% of $99k)
  • Stop loss: ATR-based 15-24%

Halt Conditions

Automatic halt if: - Portfolio drawdown >20% - Any single position >10% of capital - Critical bug detected - Redis connection lost

Manual intervention required: - Win rate <35% after 5 trades - Sharpe ratio <1.0 after 10 trades - Multiple ATR calculation failures


Troubleshooting Guide

Common Issues

1. ATR Calculation Fails

Symptom: Logs show "ATR unavailable, using fixed stops"

Diagnosis:

# Check if Alpaca data client is working
python -c "from alpaca.data.historical import StockHistoricalDataClient; print('OK')"

Fix: Fallback to 9% stops is acceptable for testing. Note frequency in logs.

2. Volume Filter Too Restrictive

Symptom: No trades executing, all rejected for low volume

Diagnosis: Check strategy logs for volume_multiple values

Fix: If all setups <1.5x, temporarily lower to 1.3x for testing

3. No Candidates Found

Symptom: Strategy agent running but no candidates

Check: - Market hours (9:30 AM - 4:00 PM ET) - Alpaca data feed active - Redis connectivity - Strategy criteria too strict

4. Positions Not Tracked

Symptom: Orders filled but not in position management

Check: - Redis order.filled events published - Position management agent subscribed - PostgreSQL connection active


Go/No-Go Decision (After 2 Days)

GO (Proceed to Week 2)

Criteria (ALL must pass): - ✅ Win rate ≥42% - ✅ Sharpe ≥2.4 - ✅ Completed ≥3 trades - ✅ Zero critical bugs - ✅ ATR stops working correctly - ✅ Volume filter functioning

Action: Begin Week 2 implementation (catalyst decay, position sizing, liquidity filter)

NO-GO (Iterate on Week 1)

Criteria (ANY fail): - ❌ Win rate <42% - ❌ Sharpe <2.4 - ❌ <3 completed trades - ❌ Critical bugs found - ❌ ATR stops not working - ❌ Volume filter broken

Action: Debug issues, fix bugs, test again for 2 more days


Success Report Template

After test completion, create PHASE_5_WEEK_1_TEST_RESULTS.md:

# Phase 5 Week 1 Test Results

**Test Period**: 2025-11-04 to 2025-11-06
**Total Trades**: ___
**Status**: ✅ PASS / ❌ FAIL

## Metrics

| Metric | Target | Actual | Pass/Fail |
|--------|--------|--------|-----------|
| Win Rate | ≥42% | ___% | ___ |
| Sharpe | ≥2.4 | ___ | ___ |
| Trades | ≥3 | ___ | ___ |
| Bugs | 0 | ___ | ___ |

## Trade Log

[List all trades with entry/exit/P&L]

## Observations

[Key findings, surprises, issues]

## Recommendation

**PROCEED TO WEEK 2** / ❌ **ITERATE WEEK 1**

[Reasoning]

Quick Start Commands

# 1. Check all services running
docker ps | grep -E "(redis|postgres|qdrant)"

# 2. Start trading agents (run each in separate terminal)
cd /Users/bertfrichot/mem-agent-mcp/trading_agents
python -m trading_agents.position_management_agent &
python -m trading_agents.strategy_agent &
python -m trading_agents.risk_management_agent &

# 3. Monitor logs
tail -f logs/trading/micro_cap.log

# 4. Check Jaeger traces
open http://localhost:16686

# 5. Query trades
psql -U trading_user -d trading_db -h localhost -p 5433 \
  -c "SELECT * FROM trades WHERE channel='micro_cap' ORDER BY entry_time DESC LIMIT 10;"

Test Owner: Bert Frichot Phase: 5 (Week 1) Date Created: 2025-11-04 Expected Completion: 2025-11-06 Next Phase: Week 2 (Catalyst decay, position sizing, liquidity filter)