Algo Lab
Common questions about writing, testing, and running strategies on Algo Lab. See the full documentation for the complete API reference and examples.
Getting Started
Algo Lab is Trado's built-in strategy development environment. You write a Python class in your browser, run it on historical WazirX Futures data to see how it would have performed, paper-trade it on live prices with no real money, and then run it live when you're satisfied. No local setup, no external tools required.
TradingView webhooks let you send signals from Pine Script alerts to Trado, which then places orders on your linked accounts. You write the strategy logic in TradingView and Trado executes the orders.
Algo Lab is different — you write the full strategy logic in Python here on Trado. The strategy can use indicators, manage positions, check your account balance, and make trading decisions entirely within our platform. Signal mode in Algo Lab works similarly to TradingView webhooks (your strategy sends signals to a webhook which fans out to multiple accounts), while Direct mode gives your strategy API access to a single WazirX account for more granular control.
Basic Python is enough. You write a class with a few methods — on_init() to set up your strategy, on_ohlc() to react to each completed candle or on_tick() for real-time trade data. Indicator calculations, order sizing, and position tracking are all handled through simple method calls. Check the Quick Start section for a working example in under 30 lines.
Algo Lab currently supports WazirX Futures (perpetual contracts). Symbol format is BTCINR, ETHINR, etc. You pick the symbol in the Run panel — it is then available in your strategy as self.symbol. Support for additional exchanges is planned for future releases.
Running Strategies
Backtest replays historical market data through your strategy. No real orders are placed. Use it to measure how your strategy would have performed in the past before risking any money.
Paper trading uses live WazirX prices and simulates your orders in real time — but never places real orders. It is the closest you can get to live trading without real money.
Live mode places real orders on WazirX Futures. Always backtest and paper trade first. Set guardrails before going live.
OHLC mode calls your on_ohlc() method each time a candle completes. You pick the candle size (1 minute, 5 minutes, 1 hour, etc.) in the Run panel. This is the right choice for most indicator-based strategies.
Tick mode calls your on_tick() method on every individual market trade — potentially thousands of times per second. Use it for scalping, market microstructure strategies, or any logic that needs real-time price awareness at sub-second resolution.
The Run panel automatically pre-selects the right mode based on whether your code defines on_ohlc or on_tick.
Yes, up to 3 concurrent runs per account. This includes backtests, paper runs, and live runs combined. Cancel an active run from the strategy page to free a slot.
OHLC backtests time out after 40 minutes — even a full year of 1-minute candles typically completes in seconds, so this limit is rarely hit. Tick backtests (which replay individual market trades) have a 4-hour limit because of the larger data volume. If your tick backtest times out, try a shorter date range.
Click Stop engine in the Active Run panel. This gives your strategy a chance to run on_stop() — where you should close any open positions. A confirmation prompt appears first to remind you that open positions are not automatically closed by the platform; you may need to manage them manually on the exchange if your strategy does not close them in on_stop().
If your strategy code throws an unhandled exception, the run stops and the status is set to failed. You will see the error in the run logs. Open positions are not automatically closed — you need to manage them manually on the exchange or ensure your on_stop() method closes them before the exception propagates.
Use guardrails (max drawdown, max orders/min) as a safety net. They close positions and stop the run cleanly when a limit is hit, which is more reliable than exception handling for capital protection.
Writing Strategies
Indicators need a minimum number of data points before they produce a reliable value. A 20-period EMA, for example, needs at least 20 candles before its .is_ready property returns True.
Always guard your trading logic:
def on_ohlc(self, candle):
self.ema.update(candle["close"])
if not self.ema.is_ready:
return # skip until the indicator is ready
# safe to use self.ema.value hereIn paper and live mode, your indicators are pre-warmed with recent historical data before the live feed starts, so this warm-up gap does not affect live runs.
Option 1 — Run panel: Set Stop loss % in the Risk section of the Run panel. The engine closes your position automatically when the price moves against you by that percentage. In OHLC backtest and paper mode, the stop is checked against the bar's intra-bar range (high/low), not just the close — giving realistic fill prices. In tick mode, every individual trade is checked.
Option 2 — In code (recommended for more control):
def on_init(self):
self.atr = self.indicators.atr(period=14)
self._stop = None
self._side = None
def on_ohlc(self, candle):
h, l, c = candle["high"], candle["low"], candle["close"]
self.atr.update_bar(h, l, c)
if not self.atr.is_ready:
return
# Exit on ATR-based stop (checked against intra-bar low)
if self._side == "long" and self._stop and l < self._stop:
self.broker.close_symbol(self.symbol)
self._side = None
return
if self._side is None:
qty = round(self.broker.available_cash() * 0.998 / c, 6)
self.broker.buy(self.symbol, qty)
self._stop = c - self.atr.value * 2.0
self._side = "long"Yes. Write a plain Python class with an update() method and whatever state you need. Your class lives in the same file as your strategy or in a separate file you upload alongside it.
class RollingVWAP:
def __init__(self, window: int):
from collections import deque
self.window = window
self._pv = deque(maxlen=window)
self._vol = deque(maxlen=window)
self.value = None
def update(self, price: float, vol: float):
self._pv.append(price * vol)
self._vol.append(vol)
total = sum(self._vol)
self.value = sum(self._pv) / total if total else price
@property
def is_ready(self):
return len(self._pv) >= self.window
class MyStrategy(Strategy):
def on_init(self):
self.vwap = RollingVWAP(window=200)
self.warmup_bars = 300 # tell the engine to warm up 300 barsIf you use custom indicators, set self.warmup_bars = N in on_init() so the platform knows how many historical bars to replay before starting the live feed. Indicators created via self.indicators.* are warmed up automatically.
Include a requirements.txt alongside your strategy.py. Only packages from the approved list are accepted:
numpy, pandas, scipy, statsmodels, ta, ta-lib, pandas-ta, tulipy, finta, scikit-learn, joblib, python-dateutil, pytz, tqdm, requests
Packages not on the list are rejected at upload with a clear error message. Contact support to request additions.
Use self.broker.available_cash() — it returns the capital that is currently free (not locked in open positions). Divide by the current price to get the quantity. Leave a small buffer for trading fees:
cash = self.broker.available_cash() qty = round((cash * 0.998) / candle["close"], 6) self.broker.buy(self.symbol, qty)
In Signal mode, available_cash() returns only the capital you configured in the Run panel — it is not a live balance. In Direct mode, it reflects your real account balance.
Yes, via self.broker.get_position(self.symbol) and self.broker.get_equity(). What these return depends on the mode:
Backtest / Paper: simulated values — always accurate within the simulation.
Direct mode: real values from your WazirX account.
Signal mode: get_position() and get_equity() return None because the strategy is not linked to any single account — it sends signals to a webhook. Use Direct mode if your strategy logic needs real account state.
Live Trading
Signal mode — your strategy sends buy/sell signals to a webhook you select in the Run panel. Trado then places orders on all WazirX accounts linked to that webhook simultaneously. This is the same mechanism as TradingView webhooks. Your strategy does not have API access to any individual account.
Direct mode — you enter your WazirX API key in the Run panel. Orders go directly to your account. Your strategy can also read your real position size, balance, and open orders. Use Direct mode when your logic depends on real account state.
Your WazirX API keys are encrypted using AES-256 when you save your broker account on Trado. They are never stored in plain text. When you start a Direct mode live run, the keys are fetched securely at the moment trading begins and used only for the duration of that run. They do not appear in run logs, result files, or any persistent storage.
At minimum, set these before any live run:
Max session drawdown % — stops the run if your account drops this percentage from where it started. 5–10% is a reasonable starting point.
Max orders/min — prevents runaway order loops. Set it slightly above your expected order frequency.
Duration (days) — auto-stops the run after a set time, useful for strategies that are meant to run for a fixed window.
When any guardrail fires, positions are closed and a halt_reason is saved in the result. You can review exactly which guardrail triggered.
Results and Data
Backtests simulate orders using real historical price data with configurable slippage. In OHLC mode, stop-loss and take-profit levels are checked against the bar's intra-bar high and low — not just the closing price — which gives more realistic fill prices than a simple close-price check.
That said, backtests cannot account for real order book depth, exchange latency, or partial fills. Treat backtest results as a directional guide, not a guarantee of live performance. Always paper trade before going live.
When a run finishes, a Results panel opens automatically with three tabs: Performance (metrics and equity chart), Trades (every completed round-trip), and Logs (everything your strategy printed via self.log()). You can reopen any past result from the run history panel on the right side of the strategy editor at any time.
The equity curve is a chart showing how your portfolio value changed over time during the run. For OHLC backtests it records a snapshot after each candle. For tick backtests it samples every minute to keep the data size manageable. In paper and live mode it is sampled continuously while the run is active.
Versions and Drafts
A draft is saved automatically a few seconds after you stop typing. It is private to you and preserved between page reloads. Think of it as your current working copy.
A version is a permanent snapshot of your code that is created each time you actually run a strategy. If you run the same code twice, only one version is created (duplicate code does not create a new snapshot). Versions appear in the right panel and can be restored at any time.
Yes. In the right panel, find the version you want and click the restore icon. Your editor loads that version's code. A banner confirms the restore. Running the restored code creates a new version — nothing is overwritten.
Each strategy can hold up to 50 versions. Running the same code twice does not create a duplicate, so in practice this limit is rarely reached. If you hit it, create a new strategy or delete old versions from the version history panel.
Risk and Safety
1. Backtest over a meaningful historical period (at least 6–12 months). Check drawdown, win rate, and profit factor — not just total return.
2. Paper trade for at least a week on current live prices to see how the strategy behaves in real-time conditions.
3. Start small — use a fraction of your intended capital for the first few live days.
4. Set guardrails — at minimum, set a max drawdown % and a duration limit before your first live run.
No. Orders are placed only when your strategy code explicitly calls self.broker.buy(), self.broker.sell(), or a close method. The platform does not modify, override, or add orders to what your code specifies. The only exception is guardrails — when a guardrail fires, open positions are closed as you configured.
Marketplace
The Marketplace is where strategy authors can publish their strategies for other users to discover, fork, and run. When you fork a marketplace strategy, you get your own editable copy — the original author's code is not shared publicly unless they choose to make it visible.
Open the strategy editor, click Publish in the top bar, and fill in a name, description, and tags. All published strategies are reviewed before they appear in the Marketplace. You can unpublish at any time.
Automated crypto trade execution on WazirX Futures. TradingView alerts become live orders - automatically.
© 2026 Windigotrade Pvt Ltd. All rights reserved.
Relay by Trado is a technology platform. Trade at your own risk.