| sim_ts | side | path | amount $ | price $ | cost % | realized $ | realized % |
|---|---|---|---|---|---|---|---|
| 2026-02-01 21:00:00 | BUY | E | $3000.00 | $77103.04 | 0.53% | — | — |
| 2026-02-01 22:00:00 | SELL | stop | $2946.08 | $76526.03 | 0.53% | $-53.92 | -1.80% |
| 2026-02-02 03:00:00 | BUY | E | $2983.82 | $76491.17 | 0.53% | — | — |
| 2026-02-02 04:00:00 | SELL | stop | $2944.65 | $76292.98 | 0.53% | $-39.18 | -1.31% |
| 2026-02-02 05:00:00 | BUY | E | $2972.07 | $75894.15 | 0.53% | — | — |
| 2026-02-02 06:00:00 | SELL | stop | $2925.49 | $75502.10 | 0.53% | $-46.59 | -1.57% |
| 2026-02-02 16:00:00 | BUY | E | $2958.10 | $78850.06 | 0.53% | — | — |
| 2026-02-02 17:00:00 | SELL | stop | $2918.86 | $78634.76 | 0.53% | $-39.23 | -1.33% |
| 2026-02-03 01:00:00 | BUY | A | $4910.54 | $79065.24 | 0.55% | — | — |
| 2026-02-03 02:00:00 | SELL | tp | $4853.85 | $79017.63 | 0.55% | $-56.69 | -1.15% |
| 2026-02-04 05:00:00 | BUY | E | $2929.32 | $76479.75 | 0.53% | — | — |
| 2026-02-04 07:00:00 | SELL | stop | $2904.95 | $76652.68 | 0.53% | $-24.37 | -0.83% |
| 2026-02-04 08:00:00 | BUY | E | $2922.01 | $76514.30 | 0.53% | — | — |
| 2026-02-04 09:00:00 | SELL | stop | $2893.92 | $76587.26 | 0.53% | $-28.09 | -0.96% |
| 2026-02-04 11:00:00 | BUY | E | $2913.58 | $76302.10 | 0.53% | — | — |
| 2026-02-04 12:00:00 | SELL | stop | $2872.07 | $76017.25 | 0.53% | $-41.51 | -1.42% |
| 2026-02-04 13:00:00 | BUY | E | $2901.13 | $76180.85 | 0.53% | — | — |
| 2026-02-04 14:00:00 | SELL | stop | $2821.03 | $74867.00 | 0.53% | $-80.10 | -2.76% |
| 2026-02-04 17:00:00 | BUY | E | $2877.10 | $73636.01 | 0.53% | — | — |
| 2026-02-04 18:00:00 | SELL | stop | $2805.79 | $72576.08 | 0.53% | $-71.31 | -2.48% |
| 2026-02-05 03:00:00 | BUY | E | $2855.71 | $71454.44 | 0.53% | — | — |
| 2026-02-05 04:00:00 | SELL | stop | $2816.46 | $71223.25 | 0.53% | $-39.24 | -1.37% |
| 2026-02-05 06:00:00 | BUY | E | $2843.93 | $70732.72 | 0.53% | — | — |
| 2026-02-05 07:00:00 | SELL | tp | $2822.66 | $70951.51 | 0.53% | $-21.27 | -0.75% |
| 2026-02-05 23:00:00 | BUY | E | $2837.55 | $63907.86 | 0.53% | — | — |
| 2026-02-06 00:00:00 | SELL | stop | $2763.82 | $62909.86 | 0.53% | $-73.74 | -2.60% |
| 2026-02-06 01:00:00 | BUY | A | $4692.39 | $63509.39 | 0.55% | — | — |
| 2026-02-06 02:00:00 | SELL | stop | $4802.31 | $65714.96 | 0.55% | +$109.93 | +2.34% |
| 2026-02-06 19:00:00 | BUY | E | $2848.41 | $69776.68 | 0.53% | — | — |
| 2026-02-06 20:00:00 | SELL | tp | $2856.94 | $70731.46 | 0.53% | +$8.53 | +0.30% |
| 2026-02-06 21:00:00 | BUY | E | $2850.97 | $70000.13 | 0.53% | — | — |
| 2026-02-06 22:00:00 | SELL | tp | $2835.35 | $70358.43 | 0.53% | $-15.62 | -0.55% |
| 2026-02-07 01:00:00 | BUY | A | $4743.81 | $69958.00 | 0.55% | — | — |
| 2026-02-07 02:00:00 | SELL | stop | $4726.45 | $70471.49 | 0.55% | $-17.36 | -0.37% |
| 2026-02-07 05:00:00 | BUY | A | $4735.13 | $70768.13 | 0.55% | — | — |
| 2026-02-07 06:00:00 | SELL | stop | $4643.32 | $70161.50 | 0.55% | $-91.81 | -1.94% |
| 2026-02-07 09:00:00 | BUY | A | $4689.22 | $68495.01 | 0.55% | — | — |
| 2026-02-07 10:00:00 | SELL | stop | $4613.93 | $68138.20 | 0.55% | $-75.29 | -1.61% |
| 2026-02-07 11:00:00 | BUY | A | $4651.58 | $67987.00 | 0.55% | — | — |
| 2026-02-07 12:00:00 | SELL | stop | $4599.92 | $67972.65 | 0.55% | $-51.66 | -1.11% |
| 2026-02-07 21:00:00 | BUY | A | $4625.75 | $69631.18 | 0.55% | — | — |
| 2026-02-07 22:00:00 | SELL | stop | $4566.61 | $69497.99 | 0.55% | $-59.13 | -1.28% |
| 2026-02-07 23:00:00 | BUY | E | $2757.71 | $69399.34 | 0.53% | — | — |
| 2026-02-08 00:00:00 | SELL | stop | $2724.37 | $69289.38 | 0.53% | $-33.34 | -1.21% |
| 2026-02-08 01:00:00 | BUY | E | $2747.71 | $69133.79 | 0.53% | — | — |
| 2026-02-08 02:00:00 | SELL | stop | $2728.46 | $69379.57 | 0.53% | $-19.24 | -0.70% |
| 2026-02-08 06:00:00 | BUY | E | $2741.93 | $69220.52 | 0.53% | — | — |
| 2026-02-08 08:00:00 | SELL | tp | $2732.30 | $69710.69 | 0.53% | $-9.64 | -0.35% |
| 2026-02-08 10:00:00 | BUY | E | $2739.04 | $70107.19 | 0.53% | — | — |
| 2026-02-08 12:00:00 | SELL | tp | $2744.74 | $70999.98 | 0.53% | +$5.69 | +0.21% |
| 2026-02-09 08:00:00 | BUY | E | $2740.75 | $70422.59 | 0.53% | — | — |
| 2026-02-09 10:00:00 | SELL | stop | $2681.42 | $69630.35 | 0.53% | $-59.33 | -2.16% |
| 2026-02-09 11:00:00 | BUY | E | $2722.95 | $68727.88 | 0.53% | — | — |
| 2026-02-09 12:00:00 | SELL | stop | $2702.19 | $68928.72 | 0.53% | $-20.76 | -0.76% |
| 2026-02-09 19:00:00 | BUY | E | $2716.72 | $70418.68 | 0.53% | — | — |
| 2026-02-09 20:00:00 | SELL | tp | $2708.70 | $70957.01 | 0.53% | $-8.02 | -0.30% |
| 2026-02-09 23:00:00 | BUY | E | $2714.32 | $70372.96 | 0.53% | — | — |
| 2026-02-10 00:00:00 | SELL | stop | $2676.81 | $70138.00 | 0.53% | $-37.50 | -1.38% |
| 2026-02-10 01:00:00 | BUY | A | $4505.11 | $69827.33 | 0.55% | — | — |
| 2026-02-10 02:00:00 | SELL | tp | $4498.21 | $70486.82 | 0.55% | $-6.90 | -0.15% |
| 2026-02-10 04:00:00 | BUY | A | $4501.66 | $69511.83 | 0.55% | — | — |
| 2026-02-10 05:00:00 | SELL | stop | $4473.21 | $69831.62 | 0.55% | $-28.45 | -0.63% |
| 2026-02-10 06:00:00 | BUY | E | $2692.46 | $69447.64 | 0.53% | — | — |
| 2026-02-10 11:00:00 | SELL | stop | $2643.99 | $68921.68 | 0.53% | $-48.47 | -1.80% |
| 2026-02-10 15:00:00 | BUY | A | $4463.20 | $68460.40 | 0.54% | — | — |
| 2026-02-10 19:00:00 | SELL | stop | $4442.70 | $68894.36 | 0.54% | $-20.50 | -0.46% |
| 2026-02-10 22:00:00 | BUY | E | $2671.77 | $68656.21 | 0.53% | — | — |
| 2026-02-11 02:00:00 | SELL | tp | $2656.24 | $68982.00 | 0.53% | $-15.53 | -0.58% |
| 2026-02-11 04:00:00 | BUY | E | $2667.11 | $68187.99 | 0.53% | — | — |
| 2026-02-11 05:00:00 | SELL | stop | $2615.74 | $67584.46 | 0.53% | $-51.37 | -1.93% |
| 2026-02-11 07:00:00 | BUY | E | $2651.70 | $66820.32 | 0.53% | — | — |
| 2026-02-11 08:00:00 | SELL | stop | $2632.19 | $67032.72 | 0.53% | $-19.51 | -0.74% |
| 2026-02-12 01:00:00 | BUY | E | $2645.85 | $67365.56 | 0.53% | — | — |
| 2026-02-12 02:00:00 | SELL | tp | $2618.07 | $67365.56 | 0.53% | $-27.78 | -1.05% |
| 2026-02-12 03:00:00 | BUY | E | $2637.52 | $67365.56 | 0.53% | — | — |
| 2026-02-12 04:00:00 | SELL | stop | $2609.83 | $67365.56 | 0.53% | $-27.69 | -1.05% |
| 2026-02-12 05:00:00 | BUY | E | $2629.21 | $67365.56 | 0.53% | — | — |
| 2026-02-12 07:00:00 | SELL | tp | $2601.61 | $67365.56 | 0.53% | $-27.60 | -1.05% |
| 2026-02-12 08:00:00 | BUY | E | $2620.93 | $67365.56 | 0.53% | — | — |
| 2026-02-12 09:00:00 | SELL | stop | $2593.42 | $67365.56 | 0.53% | $-27.51 | -1.05% |
| 2026-02-12 10:00:00 | BUY | E | $2612.68 | $67365.56 | 0.53% | — | — |
| 2026-02-12 11:00:00 | SELL | tp | $2585.26 | $67365.56 | 0.53% | $-27.42 | -1.05% |
| 2026-02-12 14:00:00 | BUY | E | $2604.45 | $67365.56 | 0.53% | — | — |
| 2026-02-12 18:00:00 | SELL | tp | $2577.13 | $67365.56 | 0.53% | $-27.33 | -1.05% |
| 2026-02-12 23:00:00 | BUY | E | $2596.25 | $67365.56 | 0.53% | — | — |
| 2026-02-13 00:00:00 | SELL | stop | $2569.02 | $67365.56 | 0.53% | $-27.24 | -1.05% |
| 2026-02-13 07:00:00 | BUY | E | $2588.08 | $67365.56 | 0.53% | — | — |
| 2026-02-13 08:00:00 | SELL | tp | $2560.94 | $67365.56 | 0.53% | $-27.15 | -1.05% |
| 2026-02-13 15:00:00 | BUY | E | $2579.94 | $67365.56 | 0.53% | — | — |
| 2026-02-13 16:00:00 | SELL | stop | $2552.88 | $67365.56 | 0.53% | $-27.06 | -1.05% |
| 2026-02-14 04:00:00 | BUY | E | $2571.82 | $67365.56 | 0.53% | — | — |
| 2026-02-14 06:00:00 | SELL | tp | $2544.86 | $67365.56 | 0.53% | $-26.97 | -1.05% |
| 2026-02-16 02:00:00 | BUY | E | $2563.73 | $67365.56 | 0.53% | — | — |
| 2026-02-16 04:00:00 | SELL | tp | $2536.86 | $67365.56 | 0.53% | $-26.88 | -1.05% |
| 2026-02-16 06:00:00 | BUY | E | $2555.67 | $67365.56 | 0.53% | — | — |
| 2026-02-16 10:00:00 | SELL | tp | $2528.88 | $67365.56 | 0.53% | $-26.79 | -1.05% |
| 2026-02-16 14:00:00 | BUY | E | $2547.63 | $67365.56 | 0.53% | — | — |
| 2026-02-16 16:00:00 | SELL | stop | $2520.93 | $67365.56 | 0.53% | $-26.70 | -1.05% |
| 2026-02-16 17:00:00 | BUY | E | $2539.62 | $67365.56 | 0.53% | — | — |
| 2026-02-16 18:00:00 | SELL | stop | $2513.01 | $67365.56 | 0.53% | $-26.61 | -1.05% |
| 2026-02-16 20:00:00 | BUY | E | $2531.64 | $67365.56 | 0.53% | — | — |
| 2026-02-17 01:00:00 | SELL | tp | $2505.11 | $67365.56 | 0.53% | $-26.52 | -1.05% |
| 2026-02-17 04:00:00 | BUY | E | $2523.68 | $67365.56 | 0.53% | — | — |
| 2026-02-17 05:00:00 | SELL | stop | $2497.24 | $67365.56 | 0.53% | $-26.44 | -1.05% |
| 2026-02-17 17:00:00 | BUY | E | $2515.75 | $67365.56 | 0.53% | — | — |
| 2026-02-17 18:00:00 | SELL | stop | $2489.40 | $67365.56 | 0.53% | $-26.35 | -1.05% |
| 2026-02-17 23:00:00 | BUY | E | $2507.85 | $67365.56 | 0.53% | — | — |
| 2026-02-18 01:00:00 | SELL | tp | $2481.58 | $67365.56 | 0.52% | $-26.26 | -1.05% |
| 2026-02-18 04:00:00 | BUY | E | $2499.97 | $67365.56 | 0.53% | — | — |
| 2026-02-18 05:00:00 | SELL | tp | $2473.79 | $67365.56 | 0.52% | $-26.18 | -1.05% |
| 2026-02-18 13:00:00 | BUY | E | $2492.11 | $67365.56 | 0.52% | — | — |
| 2026-02-18 14:00:00 | SELL | tp | $2466.02 | $67365.56 | 0.52% | $-26.09 | -1.05% |
| 2026-02-18 16:00:00 | BUY | E | $2484.29 | $67365.56 | 0.52% | — | — |
| 2026-02-18 17:00:00 | SELL | stop | $2458.28 | $67365.56 | 0.52% | $-26.01 | -1.05% |
| 2026-02-18 20:00:00 | BUY | E | $2476.48 | $67365.56 | 0.52% | — | — |
| 2026-02-18 22:00:00 | SELL | tp | $2450.56 | $67365.56 | 0.52% | $-25.92 | -1.05% |
| 2026-02-19 01:00:00 | BUY | E | $2468.71 | $67365.56 | 0.52% | — | — |
| 2026-02-19 07:00:00 | SELL | stop | $2442.87 | $67365.56 | 0.52% | $-25.83 | -1.05% |
| 2026-02-19 11:00:00 | BUY | E | $2460.96 | $67365.56 | 0.52% | — | — |
| 2026-02-19 12:00:00 | SELL | stop | $2435.21 | $67365.56 | 0.52% | $-25.75 | -1.05% |
| 2026-02-20 04:00:00 | BUY | E | $2453.23 | $67365.56 | 0.52% | — | — |
| 2026-02-20 05:00:00 | SELL | stop | $2427.57 | $67365.56 | 0.52% | $-25.67 | -1.05% |
| 2026-02-20 06:00:00 | BUY | E | $2445.53 | $67365.56 | 0.52% | — | — |
| 2026-02-20 07:00:00 | SELL | stop | $2419.95 | $67365.56 | 0.52% | $-25.58 | -1.05% |
| 2026-02-20 10:00:00 | BUY | E | $2437.86 | $67365.56 | 0.52% | — | — |
| 2026-02-20 11:00:00 | SELL | tp | $2412.36 | $67365.56 | 0.52% | $-25.50 | -1.05% |
| 2026-02-20 15:00:00 | BUY | E | $2430.21 | $67365.56 | 0.52% | — | — |
| 2026-02-20 16:00:00 | SELL | tp | $2404.80 | $67365.56 | 0.52% | $-25.41 | -1.05% |
| 2026-02-20 23:00:00 | BUY | E | $2422.58 | $67365.56 | 0.52% | — | — |
| 2026-02-21 00:00:00 | SELL | stop | $2397.25 | $67365.56 | 0.52% | $-25.33 | -1.05% |
| 2026-02-21 20:00:00 | BUY | E | $2414.99 | $67365.56 | 0.52% | — | — |
| 2026-02-21 21:00:00 | SELL | stop | $2389.74 | $67365.56 | 0.52% | $-25.25 | -1.05% |
| 2026-02-22 09:00:00 | BUY | E | $2407.41 | $67365.56 | 0.52% | — | — |
| 2026-02-22 10:00:00 | SELL | tp | $2382.25 | $67365.56 | 0.52% | $-25.16 | -1.05% |
| 2026-02-22 13:00:00 | BUY | E | $2399.86 | $67365.56 | 0.52% | — | — |
| 2026-02-22 15:00:00 | SELL | tp | $2374.78 | $67365.56 | 0.52% | $-25.08 | -1.05% |
| 2026-02-23 00:00:00 | BUY | E | $2392.34 | $67365.56 | 0.52% | — | — |
| 2026-02-23 01:00:00 | SELL | stop | $2367.34 | $67365.56 | 0.52% | $-25.00 | -1.04% |
| 2026-02-28 15:00:00 | BUY | E | $2384.84 | $67365.56 | 0.52% | — | — |
| 2026-02-28 16:00:00 | SELL | tp | $2359.92 | $67365.56 | 0.52% | $-24.92 | -1.04% |
Variant full-counter-trend — diff vs base shown for stages that override.
You are the **research** stage of the trading workflow.
You are running in **backtest replay mode**. The `trade_signals` tool was already invoked for you and its output is below. Your job: combine those signals with the vault state and emit a flat single-line JSON. **NO arithmetic** — copy values verbatim.
## trade_signals output (verbatim, do not modify)
```json
{{trade_signals}}
```
## Current vault state
```json
{{vault_state}}
```
## Open positions
```json
{{open_positions}}
```
## Output schema (your last message MUST be a single-line JSON object — no markdown fence, just one line)
```json
{
"regime": "<bear|caution|normal|bull>",
"price": <number>,
"rsi_15m": <number>,
"rsi_1h": <number>,
"rsi_4h": <number>,
"rsi_daily": <number>,
"rsi_weekly": <number>,
"macd_15m_histogram": <number>,
"macd_15m_flipped_positive": <boolean>,
"rsi_15m_crossed_up_from_below_35": <boolean>,
"ema20_weekly": <number>,
"atr_pct": <number>,
"vol_ratio": <number>,
"volume_confirm_15m": <boolean>,
"is_red": <boolean>,
"is_green": <boolean>,
"lower_wick_ratio": <number>,
"body_pct_price": <number>,
"at_lower_bb": <boolean>,
"close_above_low_12_pct": <number>,
"breakout_last_24_periods": <boolean>,
"tf_15m": "<STRONG_BUY|BUY|NEUTRAL|SELL|STRONG_SELL>",
"tf_1h": "<...>",
"tf_4h": "<...>",
"tf_daily": "<...>",
"tf_weekly": "<...>",
"tf_buy_count": <0..4>,
"tf_sell_count": <0..4>,
"vault_idle_usd": <number>,
"vault_position_token_usd": <number>,
"vault_position_token_amount": <number or 0 if no position>,
"open_position_cost_basis_usd": <number or null if no position>,
"open_position_scalp_target_usd": <number or null>,
"open_position_tp_target_usd": <number or null>,
"open_position_stop_loss_usd": <number or null>,
"open_position_entry_path": "<A|B|C|D|E or null if no position>",
"open_position_last_buy_ts": "<ISO timestamp or null if no position>",
"open_position_ticks_since_buy": <integer or null — tick count since the open BUY>
}
```
Emit on a single line. The next stage parses your last line as JSON; markdown fences break the parser and waste an iteration.
You are the **decide** stage of the trading workflow.… 16 unchanged lines …Test exits in priority order. First match wins.+ **Min-hold protection (counter-trend):** When `previous.open_position_entry_path ∈ {"B", "E"}` AND `previous.open_position_ticks_since_buy < 2`, the only exits allowed are `stop` (safety) and `tp` (full take-profit). Skip `scalp`, `trailing`, and `reversal` — counter-trend entries need at least 2 tick bars to let the rebound develop. If neither stop nor tp fires within this window → `hold`.+**Stop-loss:** `previous.price <= previous.open_position_stop_loss_usd` → `sell`, `path: "stop"`, full close.… 4 unchanged lines …**Trailing exit:** the orchestrator does not have a way to compute "NET PnL" without arithmetic, so this path requires `previous.tf_15m` flipping to `SELL` AND `previous.macd_15m_histogram < 0` AND `previous.price > previous.open_position_cost_basis_usd / previous.vault_position_token_amount`. (The position is up vs cost basis AND momentum is rolling over.) → `sell`, `path: "trailing"`.- **Trend reversal:** `previous.tf_4h ∈ {SELL, STRONG_SELL}` AND `previous.tf_daily ∈ {SELL, STRONG_SELL}` → `sell`, `path: "reversal"`.+ **Trend reversal:** `previous.tf_4h ∈ {SELL, STRONG_SELL}` AND `previous.tf_daily ∈ {SELL, STRONG_SELL}` AND `previous.open_position_entry_path ∉ {"B", "E"}` → `sell`, `path: "reversal"`. **Excluded for B/E entries**: those paths enter deliberately counter-trend, so a still-bearish HTF is the entry premise, not a reversal — let stop/tp/scalp/trailing handle the exit.If none fire → `hold`.… 42 unchanged lines …- `previous.tf_4h ∈ {BUY, STRONG_BUY, NEUTRAL}` (4h reversing up)- `previous.tf_1h ∈ {BUY, STRONG_BUY}` AND `previous.rsi_15m >= 50`+ - `previous.macd_15m_flipped_positive == true` (15m momentum confirms — required to avoid catching a falling knife)Size: 65% aggressive / 50% moderate / 30% conservative.… 29 unchanged lines …
You are the **decide** stage of the trading workflow.
Apply the strict v30 rules to research's output and pick exactly one action. **NO arithmetic.** Compare values directly with the listed thresholds. Do not derive flags, do not recompute MACD/RSI/EMA, do not interpolate.
## Previous stage output
```json
{{previous}}
```
## Decision rules
**Default = HOLD.** Only emit `buy` / `sell` when an explicit rule fires below.
Risk thresholds come from `strategy.config` in the system prompt: `entryRsiThreshold`, `fullAlignmentBars`, `spotEntryPct`, `maxExposurePct`, `scalpRsiThreshold`. Defaults below assume the aggressive tier; moderate / conservative override via the config knobs.
### Position-already-open path (`previous.vault_position_token_amount > 0`)
Test exits in priority order. First match wins.
**Min-hold protection (counter-trend):** When `previous.open_position_entry_path ∈ {"B", "E"}` AND `previous.open_position_ticks_since_buy < 2`, the only exits allowed are `stop` (safety) and `tp` (full take-profit). Skip `scalp`, `trailing`, and `reversal` — counter-trend entries need at least 2 tick bars to let the rebound develop. If neither stop nor tp fires within this window → `hold`.
**Stop-loss:** `previous.price <= previous.open_position_stop_loss_usd` → `sell`, `path: "stop"`, full close.
**Full take-profit:** `previous.price >= previous.open_position_tp_target_usd` → `sell`, `path: "tp"`, full close.
**Quick scalp (33%):** `previous.price >= previous.open_position_scalp_target_usd` AND (`previous.rsi_1h >= scalpRsiThreshold` OR `previous.rsi_15m >= scalpRsiThreshold + 5`) → `sell`, `path: "scalp"`, `scalp_pct: 33`.
**Trailing exit:** the orchestrator does not have a way to compute "NET PnL" without arithmetic, so this path requires `previous.tf_15m` flipping to `SELL` AND `previous.macd_15m_histogram < 0` AND `previous.price > previous.open_position_cost_basis_usd / previous.vault_position_token_amount`. (The position is up vs cost basis AND momentum is rolling over.) → `sell`, `path: "trailing"`.
**Trend reversal:** `previous.tf_4h ∈ {SELL, STRONG_SELL}` AND `previous.tf_daily ∈ {SELL, STRONG_SELL}` AND `previous.open_position_entry_path ∉ {"B", "E"}` → `sell`, `path: "reversal"`. **Excluded for B/E entries**: those paths enter deliberately counter-trend, so a still-bearish HTF is the entry premise, not a reversal — let stop/tp/scalp/trailing handle the exit.
If none fire → `hold`.
### No-position path (`previous.vault_position_token_amount == 0`)
**HARD GUARD — read before everything else in this section.** When `previous.vault_position_token_amount == 0` you hold zero of the trading token, so you have NOTHING to sell. Exits (`stop`, `tp`, `scalp`, `trailing`, `reversal`) are FORBIDDEN here regardless of how bearish the timeframes look — they exist ONLY in the Position-already-open path above. The only valid emissions when position is 0 are: `hold`, or `buy` with one of the entry paths A / B / C / D / E. Emitting `{"decision":"sell", ...}` with `vault_position_token_amount == 0` is a hard contract violation: there is no inventory to dispose of and the orchestrator will reject it.
Test in priority order. First match wins. Use `config.entryRsiThreshold` (default 45 aggressive / 42 moderate / 40 conservative) where shown.
#### Path A — Short-timeframe mean-reversion
LONG fires when ALL hold:
- `previous.rsi_1h < config.entryRsiThreshold`
- `previous.rsi_15m_crossed_up_from_below_35 == true` (15m oversold reversal confirmed)
- `previous.macd_15m_flipped_positive == true` (15m momentum flipped within the last 2 bars)
- `previous.tf_daily ∉ {SELL, STRONG_SELL}` (1d not bearish — daily-flat-or-better)
Size: `config.spotEntryPct.A` (default 50% aggressive / 35% moderate / 20% conservative).
#### Path E — Capitulation oversold (BYPASS HTF wall, SPOT-ONLY)
LONG fires when ALL hold:
- `previous.rsi_1h < 22` (aggressive), `< 27` (moderate), `< 18` (conservative). DO NOT relax — this is the extreme-tail entry.
- `previous.rsi_15m > 30` (some recovery from the bottom)
- `previous.macd_15m_flipped_positive == true` (early momentum flip confirmed)
- `previous.close_above_low_12_pct >= 0.3` (proof the local bottom is in)
No HTF filter. Size: 30% aggressive / 20% moderate / 12% conservative. 60-min anti-wash window after this entry's exit (no Path A re-entry inside that window).
#### Path C — Trend continuation pullback
LONG fires when ALL hold:
- `previous.tf_buy_count >= 3` (3-of-4 timeframes BUY or STRONG_BUY)
- `previous.rsi_1h < 60` (not yet overbought — leaves room)
- `previous.macd_15m_histogram > 0` (15m is going up)
- `previous.atr_pct >= 1.0` (enough volatility for a meaningful continuation)
- `previous.regime != "bear"`
Catches the **mid-trend pullback** that Path A (oversold) and Path D (4/4 + breakout) both miss. Size: 35% aggressive / 25% moderate / 15% conservative. 30-min anti-wash window.
#### Path B — Deep-value counter-trend
LONG fires when ALL hold:
- `previous.rsi_daily < 30` AND `previous.rsi_weekly < 35`
- `previous.tf_4h ∈ {BUY, STRONG_BUY, NEUTRAL}` (4h reversing up)
- `previous.tf_1h ∈ {BUY, STRONG_BUY}` AND `previous.rsi_15m >= 50`
- `previous.macd_15m_flipped_positive == true` (15m momentum confirms — required to avoid catching a falling knife)
Size: 65% aggressive / 50% moderate / 30% conservative.
#### Path D — Confirmed momentum
LONG fires when ALL hold:
- `previous.tf_buy_count >= config.fullAlignmentBars` (default 4 = strict, 3 = looser)
- `previous.breakout_last_24_periods == true` (15m close above the 24-bar high)
- `previous.volume_confirm_15m == true` (15m vol_ratio ≥ 1.3)
- `previous.atr_pct >= 1.5`
Size: 65% aggressive / 50% moderate / 30% conservative.
### Default
If no path fires → `hold`.
## Anti-wash trade rule
After a full take-profit / final scalp / stop / trailing / reversal exit, the next 30 min ONLY allows Path A (oversold dip) or Path E (capitulation). Path B / Path C / Path D are forbidden in that window regardless of signal. The runtime SELL GUARD + 2h BUY cooldown back this up at the code level — your job is to not even propose a forbidden re-entry.
## Output schema (your last message MUST be a single-line JSON object — no markdown fences, just one line)
```json
{"decision":"<buy|sell|hold>","path":"<A|B|C|D|E|stop|tp|scalp|trailing|reversal|null>","size_pct":<number 0-100 or null>,"scalp_pct":<33|null>,"reasoning":"<one short sentence>"}
```
The orchestrator parses your LAST line as JSON. Emit it on a single line, no code fence, no trailing prose. The skip_condition `previous.decision == "hold"` requires a parseable JSON; if you wrap the line in markdown the orchestrator falls back to a string and execute spawns wastefully.
If `previous.unavailable == true` → `{"decision":"hold","path":null,"size_pct":null,"scalp_pct":null,"reasoning":"indicators unavailable"}`.
You are the **execute** stage of the trading workflow.
You are running in **backtest replay mode**. Instead of calling on-chain tools, you emit a SINGLE JSON describing the trade you would execute given the decide stage's output, and the backtest harness applies it to a mock vault with realistic slippage + fees.
## Previous stage output (decide)
```json
{{previous}}
```
## Current vault state
```json
{{vault_state}}
```
The orchestrator skips this stage entirely when `previous.decision == "hold"`, so if you reach this stage you have a real action to perform.
## Workflow
### decision = "buy"
Compute the USDC notional to spend. Read `previous.size_pct` (% of equity) and the current vault state's `total_usd`. The notional must respect:
- `previous.size_pct` of `total_usd` (e.g. size_pct=50 + total=100 → spend 50 USDC)
- never exceed `vault.usdc_idle`
- the harness applies a hard exposure cap of 75% (max_exposure_pct config) — if the resulting WETH position would exceed that, abort with `{"executed": false, "reason": "exposure_cap_exceeded"}`.
### decision = "sell" with `path` ∈ {stop, tp, scalp, trailing, reversal, timeout}
Compute the WETH amount to sell.
- `path == "scalp"` → sell `previous.scalp_pct` % of CURRENT remaining WETH (default 33).
- everything else → sell 100% (full close).
If selling at a NET loss while `path` is anything other than `stop` / `reversal`, abort: `{"executed": false, "reason": "would_realize_loss"}`. (Stop / reversal are loss-acceptable by definition.)
## Output schema (your last message MUST be a single-line JSON object — no markdown fence)
```json
{
"executed": <boolean>,
"side": "<buy|sell>",
"path": "<A|B|C|D|E|stop|tp|scalp|trailing|reversal|timeout>",
"amount_in_usd": <number; for BUY this is USDC spent, for SELL leave 0>,
"amount_in_weth": <number; for SELL this is WETH sold, for BUY leave 0>,
"scalp_pct": <33|null — only set when path=='scalp'>,
"reason": "<short note when executed=false; null otherwise>"
}
```
The harness applies the trade verbatim from this JSON. Do not invent fields.
You are the **verify** stage of the trading workflow.
The execute stage's output is below. Your job is a one-shot read-only sanity check + a 1-line summary the operator will see in the UI.
## Previous stage output
```json
{{previous}}
```
## Workflow
If `previous.executed == false`, simply output a `{"verified": false, "summary": "<reason>"}` line — no on-chain reads.
If `previous.executed == true`:
1. Re-fetch the vault state via `factor_vault_analytics` to confirm the position now reflects the trade (a successful BUY means the trading token balance is non-zero; a successful SELL means it is dust).
2. Optionally read the receipt: `factor_get_transaction_status({ hash: previous.txHash })` — should be `status: success`.
## Output schema (your last message MUST be a JSON object on a single line)
```json
{
"verified": <boolean>,
"summary": "<one sentence the user will see in the UI: e.g. 'Bought $42 of WETH at $2256, vault now holds 0.0186 WETH'>"
}
```
generated 2026-05-11 08:10:55 UTC · raw data: meta.json · trades.ndjson · vault.ndjson · prompts/ · ticks/