Skip to main content

2 posts tagged with "parameter optimization"

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.

Multi-Symbol Parameter Optimization - Test Your Strategy Across All Markets at Once

· 3 min read
ApudFlow OS
Platform Updates

Your strategy's stop loss works great on Gold — but how does it hold up on Bitcoin? Will the same take-profit target that nails EURUSD also work for GBPJPY? Until now, you had to guess, or run separate workflows for every symbol and stitch the results together manually.

One Sweep, Multiple Symbols

The Parameter Loop worker doesn't care what symbols your strategy trades. Connect a multi-symbol data fetcher and your strategy runs exactly the same way for every asset — but the Parameter Loop adds a second dimension: it also sweeps the parameters.

The result is a 3D optimization grid:

Symbol × Stop Loss × Take Profit = Total Iterations
3 × 5 × 5 = 75

Every combination runs automatically. The best parameter set for XAUUSD might be different from the best set for BTCUSD — and the results table shows you both.

Workflow: Multi-Symbol Risk Optimization

[Trigger] → [Fetch Prices (XAUUSD, BTCUSD, EURUSD)] → [Swing Finder] → [Backtest] → [Parameter Loop]

Step 1: Fetch Multi-Symbol Data

Your Fetch Prices worker pulls OHLC data for all three symbols:

{
"symbols": ["XAUUSD", "BTCUSD", "EURUSD"],
"timeframe": "1h",
"limit": 2000
}

The Swing Finder detects swing points across all three independently. The Backtest evaluates each symbol's signals separately and returns combined statistics.

Step 2: Configure the Sweep

In the Parameter Loop's two-column dialog, set up the grid:

Sweep parameters:

[
{"name": "stop_loss", "values": [1.0, 2.0, 3.0, 4.0, 5.0]},
{"name": "take_profit", "values": [2.0, 3.0, 4.0, 5.0, 6.0]}
]

Ranking: Collect result.sharpe_ratio, rank by max.

Step 3: Read the Results

The results table shows every combination for every symbol. You can instantly see:

Iterationp.stop_lossp.take_profitr.sharpe_ratior.total_returnr.max_drawdown
123.04.01.92+28.4%-5.8%
372.03.01.45+18.2%-8.3%
554.05.01.21+15.1%-11.2%

The best combination works across all three symbols — not just one. This is portfolio-level optimization in a single click.

When to Use Multi-Symbol Sweeps

ScenarioWhy It Works
Portfolio strategyFind parameters that balance risk across all assets
Cross-market validationIf parameters only work on one symbol, they're overfitted
Volatility regime testingSee which symbol needs tighter SL vs wider TP
Strategy generalizationBuild strategies that adapt to any market, not just one

Live Production: Auto-Deploy Per-Symbol Parameters

Save the sweep results as a session, then set the Backtest's Production Mode to use_best. On every scheduled run, the optimized parameters load automatically — no re-sweep needed.


The takeaway: One workflow, one sweep, unlimited symbols. Stop guessing which parameters work where — let the Parameter Loop find out.