Runa Labs logo

RUNA LABS

Home

Lab & Webhooks

Mastering the automated execution pipeline.

The core of Runa Labs is our low-latency signal routing engine. This section explains exactly how to set up your strategies in the Lab, link your accounts, and format your TradingView alerts to ensure perfect execution.

1. Registering a Strategy

Before TradingView can send trades, the Bridge needs to know your strategy exists. Navigate to the Lab tab, type a name (e.g., 'BTC Momentum'), and click Register. It is now ready to receive webhooks.

2. Linking Accounts & Unlinking

Once registered, you must tell the engine which of your exchange accounts should actually trade when the signal fires.

  • To Link: Click the green 'Link Account' button next to your strategy and select your desired exchange account from the dropdown.
  • To Unlink: Look at the 'My Accounts' column. You will see an interactive gray badge for every linked account. Click the icon inside the badge to instantly sever that specific connection.

3. The Magic of Position Sizing

Runa Labs allows for two entirely different methods of position sizing:

  • Pass-Through Sizing (Quantity = 0.0): When you Link an account as a Creator, the system defaults your trade size to 0.0. The bridge will completely ignore your database settings and read the dynamic position size directly from the TradingView JSON payload. This allows your PineScript to dynamically scale positions up or down.
  • Fixed Sizing (Quantity > 0.0): If you manually set a quantity (e.g., 0.5) via the Subscription manager, the bridge will override the webhook. No matter what TradingView sends, the engine will ALWAYS execute exactly 0.5 contracts. This is crucial for risk management when following other people's strategies.

4. The TradingView JSON Payload

When you create an alert in TradingView, you must paste the following JSON into the message box:

1
2
3
4
5
6
7
8
9
10
{
  "user_token": "YOUR_RUNA_TOKEN",
  "account_name": "MATCH_STRATEGY",
  "strategy": "Your Strategy Name",
  "ticker": "{{ticker}}",
  "action": "{{strategy.order.action}}",
  "market_position": "{{strategy.market_position}}",
  "price": "{{close}}",
  "qty": "{{strategy.order.contracts}}"
}

The Golden Rule: Notice the 'account_name': 'MATCH_STRATEGY' field. This tells the Bridge to act like a radio tower. When the signal hits, the Bridge broadcasts the trade to ALL accounts linked to that strategy name. If you change this to a specific account name, it will bypass the marketplace entirely.

5. Action Icons Reference

Each strategy row has a set of icon buttons in the Action column. Hover over any icon to see its tooltip. Here is what each one does:

  • Link (green): Opens the account-linking dialog so you can connect an exchange account to this strategy.

  • Braces (gray): Copies the pre-filled TradingView webhook JSON payload for this strategy to your clipboard.

  • Flask — ghost (violet): Deletes the backtest data for this strategy (stats and chart). The strategy itself is kept.

  • Chart (orange): Clears the internal trade log stats. Does not touch any positions or orders on the exchange.

  • Trash (red): Permanently deletes the strategy. Linked accounts are unsubscribed automatically.

6. Uploading a Backtest

You can attach a verified backtest to any strategy, giving subscribers — and yourself — transparent performance data before going live.

  1. In TradingView, open your strategy's Performance Summary and click 'Export Trades to CSV'.
  2. In Runa Labs, click the violet BACKTEST button next to your strategy.
  3. Upload the exported CSV file. The engine parses it and populates the strategy card with a cumulative PnL chart and key stats (win rate, profit factor, max drawdown, trade count).
  4. To remove the backtest, click the ghost flask icon (same color, ghost variant).

7. Publishing to the Marketplace

If you have built a profitable algorithm, you can click 'Publish' to send it to the Runa Labs Marketplace. Other users can then 'Subscribe' to your strategy, applying their own custom Fixed Sizing rules to follow your trades.

8. Synchronization & Auto-Sync

A critical concept in automated execution is state synchronization. If you link your account to a strategy while it is already in the middle of an active trade, your account will be out of sync. To solve this, Runa Labs includes an Auto-Sync feature.

How Auto-Sync Works: When you link an account, you will be prompted with an Auto-Sync warning. If the strategy is currently holding a position, accepting this warning tells the Bridge to instantly fire a Market Order to synchronize your account with the strategy's current state.

Understanding the risks:

  • Slippage Risk: Because you are entering the trade late, your entry price will be different from the strategy's original entry. You must explicitly accept this risk via the checkbox before the link is confirmed.
  • Seamless Handoff: Once the Auto-Sync trade executes, your account is perfectly synchronized. When the strategy eventually sends its CLOSE signal, your position will be closed alongside it automatically.
  • Flat State: If the strategy is currently 'flat' (not holding any positions), the Auto-Sync command will simply be ignored, and you will wait for the next normal entry signal.

Disclaimer: The content provided by Runa Labs is for informational and educational purposes only and does not constitute financial, investment, or trading advice. Runa Labs is not a registered financial advisor and does not hold any financial licenses. All trading and investment activities involve significant risk of loss. You are solely responsible for your own financial decisions.