Skip to main content

One post tagged with "production"

View All Tags

From Grid Search to Live Trading - Automate Strategy Deployment with Parameter Loop

· 4 min read
ApudFlow OS
Platform Updates

The gap between "this strategy looks good in backtest" and "this strategy is running live" is where most trading ideas die. You optimized the parameters, saved the results, and then what? Manually type the numbers into a live workflow? Run the full sweep on every trigger?

The Parameter Loop worker was designed to bridge that gap. Here's how to go from sweeping to shipping in one workflow.

The Three-Mode Philosophy

Every Parameter Loop node has a prodMode dropdown with three options — and choosing the right one for each stage of development is the key to a smooth deployment pipeline.

Development Mode: prodMode = disabled

What happens: During manual "Run Test", the full sweep executes. During scheduled/webhook runs, the node is skipped (returns immediately).

When to use: When you're still exploring. You want full control — run sweeps manually, inspect results, refine the parameter grid, iterate.

Best practice: Set disabled for the first 10-20 sweeps while you narrow down the optimal region.

Staging Mode: prodMode = use_best

What happens: During "Run Test", the full sweep executes as normal. During scheduled runs, the worker loads the best parameters from the most recent saved session and uses them directly — no sweep runs.

When to use: Once you've found a good parameter set and want to use it in production, but still want the ability to re-sweep manually on demand.

How it works under the hood:

  1. Your last successful sweep saved a session (because you set sessionLabel)
  2. The session contains bestParameters and bestValue
  3. On production triggers, use_best loads bestParameters and writes them into the worker's vars
  4. The strategy executes with optimized values — no computational waste

Power Mode: prodMode = always_run

What happens: The sweep runs every single time — whether manual test, schedule, or webhook.

When to use: Rarely. Only when market regimes change fast enough that yesterday's optimum is today's loser, and you have enough compute budget to run a full sweep every 15 minutes.

The Complete Pipeline

┌─────────────────────────────────────────────────────────────────┐
│ Development │
│ prodMode: disabled │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌───────────┐ │
│ │ Coarse │───▶│ Inspect │───▶│ Fine │───▶│ Inspect │ │
│ │ Sweep │ │ Results │ │ Sweep │ │ Results │ │
│ └──────────┘ └──────────┘ └──────────┘ └───────────┘ │
│ 3×3 grid 3×3 refined grid │
└─────────────────────────────────────────────────────────────────┘


┌─────────────────────────────────────────────────────────────────┐
│ Production │
│ prodMode: use_best │
│ ┌──────────┐ ┌──────────────┐ ┌────────────────────────┐ │
│ │ Schedule │───▶│ Parameter │───▶│ Strategy runs with │ │
│ │ Trigger │ │ Loop (loads │ │ best parameters from │ │
│ │ │ │ best params) │ │ saved session │ │
│ └──────────┘ └──────────────┘ └────────────────────────┘ │
│ No sweep overhead │
└─────────────────────────────────────────────────────────────────┘

Example: The Session Lifecycle

Step 1 — Run a Sweep (Dev)

Parameter Loop → Run Test
Session Label: "eurusd_swing_q2_2026"

25 iterations complete. Best result: stop_loss=2.5, take_profit=4.0, sharpe=1.87.

The session is saved to the Sessions tab. You can revisit it anytime.

Step 2 — Pinned Deployment

Switch to prodMode: use_best.

To be extra safe, optionally add pinnedBestParameters:

"pinnedBestParameters": {
"stop_loss": 2.5,
"take_profit": 4.0
}

Pinned parameters take priority over the saved session — useful if you've manually verified the values and don't want any risk of loading a wrong session.

Step 3 — Schedule It

Add a Schedule Trigger to the workflow:

{
"everySeconds": 3600,
"type": "interval"
}

Every hour, the workflow runs. The Parameter Loop loads the best parameters, the Backtest runs with those values, and your strategy stays optimized without consuming compute on unnecessary sweeps.

Handling Regime Changes

Markets change. The parameters that worked in a trending market may fail in a ranging one.

The fix: Every week (or month), run a manual sweep to verify the current parameters are still optimal. If the results shift significantly, save a new session — production automatically picks up the latest session on the next scheduled run.

What You Get

StageprodModeSweep behaviorProduction behavior
ExplorationdisabledFull gridSkip (no compute waste)
Validationuse_bestFull gridLoad saved best params
Emergencyalways_runFull gridFull grid (heavy!)

One Parameter Loop node. Three modes. A complete path from discovery to deployment.


The takeaway: Don't re-invent strategy deployment. The Parameter Loop's production modes handle it — so you can focus on building strategies, not plumbing.