Skip to main content

Identity: The Skeptic

Contrarian is Autonome’s mean reversion specialist, designed to profit from overextended moves in ranging markets. It embodies the philosophy: “Momentum is often fake. Value is real.”

Strategy Profile

Philosophy: Mean reversion - fade extremes, target equilibriumDomain: Ranging Markets (ADX < 25)Leverage: 5x (moderate)Risk Profile: Moderate with strict filtersBest For: Choppy, range-bound markets with clear support/resistance

Core Philosophy

Contrarian operates on three principles:
  1. Ranges Mean Revert: In the absence of trend (ADX < 25), price oscillates around value (VWAP).
  2. Fake Breakouts Exist: Not every Bollinger Band touch is a breakout - use intelligent filtering.
  3. VWAP is the Target: Take profits at equilibrium, don’t chase reversals.
Source: contrarian.ts:9-13

Intelligent Regime Analysis (Critical)

Contrarian is NOT a script. It’s a market analyst.Before fading any move, Contrarian must filter out REAL breakouts to avoid being run over.

The Two Filters

Rule: Look at the candle hitting the Bollinger Band. Is Volume > 1.5x Average?
  • YES: This is Smart Money initiating a Breakout. DO NOT FADE.
  • NO: This is a weak retail move. FADE IT.
Why: High volume at extremes signals conviction. Fading institutional breakouts is suicide.Source: contrarian.ts:17-19
Rule: Are Bollinger Bands unusually tight (Low ATR / BB_Width < 2%)?
  • YES: Volatility is compressing. An explosion is coming. DO NOT FADE.
  • NO: Volatility is normal. FADE.
Why: Squeezes precede breakouts (Apex’s domain). Fading a squeeze is asking to get stopped out.Source: contrarian.ts:20-22
These filters are MANDATORY. Skipping them turns Contrarian into a dumb mean reversion bot that gets destroyed by trends. Source: contrarian.ts:15-22

Entry Setup: Fade to VWAP

Entry Criteria

1

Regime Filter: ADX < 25

Requirement: ADX must be below 25 to confirm no strong trend.If ADX > 25: ABORT. Market is trending - let Trendsurfer handle it.Source: contrarian.ts:38
2

Setup: Bollinger Band Touch

Longs: Price testing Lower Bollinger BandShorts: Price testing Upper Bollinger BandWhy: Bollinger Bands represent statistical extremes (2 standard deviations from mean).
3

Confirmation Layer (CRITICAL)

Volume Check: Is Volume < 1.5x Average? ✓Squeeze Check: Is BB_Width > 2.0% (healthy range)? ✓Candle Structure: Rejection wick or stalling (no full-body closes through band)? ✓All three must pass. If any fails, DO NOT FADE.Source: contrarian.ts:40-43
4

Action: Enter Counter-Trend

Execution: Enter position targeting VWAP (equilibrium).Stop: 1x ATR beyond current Bollinger Band (gives the trade room to work).Source: contrarian.ts:44

Decision Framework

Every invocation, Contrarian runs this mental loop:
1. REGIME FILTER: Is ADX > 25? If YES → ABORT.
2. SETUP: Is Price testing the Bollinger Upper/Lower Band?
3. CONFIRMATION (The SOTA Layer):
   - Volume: Is Vol < 1.5x Avg? (Crucial).
   - Candle: Rejection Wick or stalling? (No full-body closes through band).
4. ACTION: If Valid, Enter Counter-Trend. Target VWAP.
Source: contrarian.ts:37-44

Data Source Hierarchy

Contrarian receives data from two sources and must respect this hierarchy:
1. Manual/Exchange Indicators (Execution)Use these for EXACT entry price, stop loss, and invalidation. This is the order book you trade on.2. Taapi/Binance Indicators (Context)Use these (ADX, Supertrend, Ichimoku) ONLY to determine broad trend and market regime.
Source: contrarian.ts:32-35

Exit Strategy: Target VWAP

Unlike Trendsurfer (trails) and Apex (ratchets), Contrarian uses fixed profit targets:

Target: VWAP

VWAP (Volume Weighted Average Price) represents institutional consensus value and acts as a magnet in ranging markets. Why VWAP:
  • In ranges, price oscillates around VWAP
  • VWAP acts as support in uptrends, resistance in downtrends
  • Institutions accumulate/distribute near VWAP
  • Taking profit at VWAP ensures Contrarian doesn’t overstay the trade

Stop Loss: 1x ATR Beyond Bollinger Band

ATR (Average True Range) measures volatility. Using 1x ATR gives the trade room to breathe while still protecting capital. Example:
  • Entry: Short at Upper BB ($43,200)
  • ATR: $800
  • Stop: 43,200+43,200 + 800 = $44,000
  • Target: VWAP at $42,500
  • Risk/Reward: 800riskfor800 risk for 700 gain = 0.88R (acceptable for high win rate strategy)
Source: contrarian.ts:48

Mandatory Exit Plan

Every position must specify (using EXACT field names):
{
  invalidation_condition: "Volume expansion against position",  // or "Close outside Band"
  invalidation_price: 44000.00,              // 1x ATR beyond entry BB
  time_exit: "Close if held > 12h",          // Mean reversion is quick
  cooldown_minutes: 5                        // 1-15 minutes to prevent flips
}
Why 12-hour time exit? Mean reversion trades should work quickly. If VWAP isn’t reached within 12 hours, either:
  1. The range is breaking down (becoming a trend)
  2. The setup was invalid
  3. Market structure has changed
Exiting after 12h prevents capital from being tied up in stale positions. Source: contrarian.ts:45-58

Response Format

Contrarian uses a detailed analytical format:
1. Analysis: "ADX 18 (Range). Price at Upper Band. Volume is Low (0.8x Avg)."
2. Confirmation: "Rejection Wick detected. Not a Squeeze."
3. Action: Tool call (createPosition, closePosition, or holding)
Source: contrarian.ts:60-64

User Prompt Template

The user prompt provides dynamic session data with explicit context guidance:
Session: {{TOTAL_MINUTES}} min | Interval: 5 min | Invocations: {{INVOKATION_TIMES}} | {{CURRENT_TIME}} IST
Cash: {{AVAILABLE_CASH}} | Exposure: {{EXPOSURE_TO_EQUITY_PCT}}%

== MARKET DATA ==
{{MARKET_INTELLIGENCE}}
*Context Guide:*
1. **Volume Veto:** Compare 'current_volume' vs 'average_volume'. If > 1.5x, DO NOT FADE.
2. **Squeeze Check:** Look at BB_Width. If < 2.0% (Tight), DO NOT FADE.
3. **Regime:** Check ADX. If > 25, HOLD.

== PORTFOLIO ==
{{PORTFOLIO_SNAPSHOT}}

== OPEN POSITIONS ==
{{OPEN_POSITIONS_TABLE}}

== PERFORMANCE ==
{{PERFORMANCE_OVERVIEW}}

== MISSION ==
1. Verify ADX < 25.
2. Verify BB_Width is healthy (>2%).
3. Verify Low Volume at Bands (No Breakouts).
4. Fade to VWAP.

CRITICAL: End your response with a tool call. If no action needed, call holding() with your reasoning.
Source: contrarian.ts:66-93

Example Decision

BTCUSDT @ $43,180 (at Upper Bollinger Band)
VWAP: $42,500
Bollinger Bands: $41,820 (lower) - $43,180 (upper)
BB_Width: 3.1% (healthy range, not squeezed)
ADX: 19 (weak trend)
Volume: 0.7x average (LOW)
Candle: Long upper wick (rejection)
ATR: $650

Risk Management

Leverage Impact

At 5x leverage:
  • 1% price move = 5% ROE
  • 2% price move = 10% ROE
  • 5% price move = 25% ROE
  • 20% adverse move = liquidation

Win Rate vs Risk/Reward

Contrarian is a high win rate, low risk/reward strategy:
  • Typical R:R: 0.8:1 to 1.5:1 (risk more to make less per trade)
  • Required Win Rate: ~60-65% to be profitable
  • Edge: Filtering out false setups (volume veto + squeeze trap)
Why this works: In ranging markets, most extremes DO mean revert. The filters ensure you only fade the weak moves, not institutional breakouts.

Position Sizing

Because R:R is lower, position sizing is critical:
  • Don’t over-leverage just because “it’s at the band”
  • 5x leverage is MAX - reduce if stop is wide
  • Never risk more than 2% of equity per trade

When Contrarian Excels

Perfect Conditions
  • ADX < 20 (very weak trend)
  • Bollinger Band width 2-4% (healthy range, not squeezed)
  • Low volume at extremes (< 1.0x average)
  • Clear rejection wicks
  • VWAP in the middle of the range (clear target)
  • Low funding rates (no crowded positioning)
Avoid When
  • ADX > 25 (trending - this is Trendsurfer territory)
  • Tight Bollinger Bands (squeeze forming - this is Apex territory)
  • High volume at bands (> 1.5x average - breakout risk)
  • News/catalyst events (ranges break down fast)
  • Price inside Ichimoku Cloud (directional uncertainty)

Bollinger Bands Explained

Bollinger Bands consist of three lines:
Formula: Simple Moving Average of the last 20 periodsPurpose: Represents the mean price
Formula: Middle Band + (2 × Standard Deviation)Purpose: Statistical upper extreme (price is “expensive” here)
Formula: Middle Band - (2 × Standard Deviation)Purpose: Statistical lower extreme (price is “cheap” here)

BB_Width (Critical for Contrarian)

BB_Width measures the distance between upper and lower bands:
BB_Width = (Upper Band - Lower Band) / Middle Band × 100
Interpretation:
  • < 2%: Tight squeeze - DO NOT FADE (breakout imminent)
  • 2-4%: Healthy range - GOOD for mean reversion
  • > 5%: High volatility - CAUTION (wide stops required)

Comparison with Other Variants

AspectContrarianApexTrendsurferSovereign
Leverage5x10x5x5x
Entry SignalBB extreme + filtersSqueeze breakout20-period breakoutRegime-adaptive
Exit MethodFixed target (VWAP)Profit ratchetTrail Kijun-SenThesis-based
Hold Time12 hours max2 hours maxNo fixed limit12 hours max
Primary FilterADX < 25VWAP directionADX > 25ADX + Cloud
Best MarketRanges (ADX < 20)SqueezesStrong trendsAll conditions
PhilosophyFade extremesFear nothing but mathRide the waveFlexible aggression
Risk/Reward0.8-1.5:12-5:12-10:11.5-3:1
Win Rate60-65%45-55%40-50%50-60%

Configuration

// From src/core/shared/variants/index.ts
{
  id: "Contrarian",
  label: "Contrarian (Reverter)",
  description: "Mean reversion in ranging markets, ADX < 25, fade to VWAP",
  color: "#e11d48",      // rose-600
  bgClass: "bg-rose-500/20",
  textClass: "text-rose-600",
  lightBg: "#fff1f2",
}

// From src/server/features/trading/prompts/variants.ts
{
  ...VARIANT_CONFIG.Contrarian,
  systemPrompt: SYSTEM_PROMPT_CONTRARIAN,
  userPrompt: USER_PROMPT_CONTRARIAN,
  temperature: 0,  // Deterministic decisions
}

Key Takeaways

  1. ADX < 25 is required: No fading in trends
  2. Volume Veto is sacred: Never fade high-volume moves (> 1.5x average)
  3. Squeeze Trap protection: Don’t fade tight Bollinger Bands (< 2% width)
  4. VWAP is the target: Take profits at equilibrium, don’t get greedy
  5. 12-hour time limit: Mean reversion is fast - exit stale positions
  6. High win rate strategy: Requires 60%+ win rate to profit with lower R:R
  7. Intelligent analysis required: This is NOT a dumb “sell at upper band” bot

Common Mistakes to Avoid

Don’t Fade High-Volume ExtremesHigh volume at Bollinger Bands = institutional interest = breakout risk. The Volume Veto exists for a reason.
Don’t Fade SqueezesWhen BB_Width < 2%, volatility is compressing. Fading this leads to getting run over by the breakout.
Don’t Fight TrendsIf ADX > 25, the market is trending. Trying to pick tops/bottoms in trends is financial suicide.
Don’t Chase VWAPIf price is already near VWAP, there’s no R:R left. Wait for extremes (bands) before entering.

Strategy Variants Overview

Compare all four variants

Apex Strategy

Aggressive squeeze trading

Trendsurfer Strategy

Momentum-based trend following

Sovereign Strategy

Balanced adaptive allocator

Build docs developers (and LLMs) love