Command reference for the cTrader CLI. Documents every command, flag, option and homonym-routing rule for non-interactive use.
Each command has a heading, a fenced bash block, an Auth: marker, a Required flags: line and a per-flag Markdown table. The two auth modes (batch with --pwd-file, interactive with --password and -q) are documented per command; the five homonym commands are flagged inline and explained in Mode routing.
Five commands share a name between batch and interactive modes: accounts, symbols, metadata, run, backtest. The flags you supply pick which one runs — pass --pwd-file or --broker (or no auth flags at all) for the batch route, and --password, -q, or any command-specific flag for the interactive route. Mixing them produces an error such as Missing --ctid in non-interactive mode or Missing --pwd-file. See Authentication and Notes → Homonym routing for the full ruleset.
These options apply across commands. Run ctrader-cli.exe --help for the canonical list.
| Option | Description |
|---|---|
--help or -h |
List the available commands and their options. |
--commands |
Print the full interactive command reference and exit (no auth). |
--version or -v |
Show the installed cTrader CLI version. |
--ctid or -c |
cTrader ID username or email. |
--password |
cTrader ID password supplied directly (interactive commands, used with -q). |
--pwd-file |
Path to a file that holds the cTID password (batch commands). |
--account or -a |
Trading account login number. |
--broker |
Broker name, used when accounts on different brokers share a number. |
--environment-variables or -e |
Read option values from environment variables instead of the command line. |
--full-access |
Run a cBot without access-right restrictions. |
--exit-on-stop |
Exit the cTrader CLI process when the cBot stops. |
-q, --quick or --quit |
Run a single command, then exit. |
--yes or -y |
Skip confirmation prompts. |
--all |
Target every applicable entity, with stop, order cancel, position close and alert delete. |
cTrader CLI uses two conventions for credentials. The two are not interchangeable: batch commands reject --password; interactive commands reject --pwd-file. Reset compromised credentials from your cTrader ID account settings.
Five commands (accounts, symbols, metadata, run, backtest) share a name between batch and interactive modes. See Mode routing above and Notes → Homonym routing for the full ruleset.
--period (most commands) and --timeframe (only optimize) accept period tokens such as m1, h1, D1, Month1. Token parsing is case-insensitive. Run ctrader-cli periods for the canonical current list.
| Family | Tokens |
|---|---|
| Minute bars | m1 to m45 |
| Hour bars | h1, h2, h3, h4, h6, h8, h12 |
| Day bars | d1, d2, d3 |
| Week / month | w1, month1 |
| Tick / Renko / Range / Heiken Ashi | t1–t1000, re1–re2000, ra1–ra10000, hm1–hmonth1 |
List the accounts linked to a cTrader ID and read account state.
List every account linked to the cTrader ID, optionally filtered by broker.
Auth: batch
Required flags: --ctid, --pwd-file
ctrader-cli accounts --ctid=<cTID> --pwd-file=<path-to-pwd-file>
ctrader-cli accounts --ctid=<cTID> --pwd-file=<path-to-pwd-file> --broker=<broker-name>
ctrader-cli accounts --ctid=<cTID> --pwd-file=<path-to-pwd-file> --account=<account-id>Lists every account when no --account is supplied; pass --account to limit the result to one entry.
Show one account's details such as broker, currency and leverage.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli account --ctid=<cTID> --password=<password> --account=<account-id> -qSwitch the active account inside the interactive shell.
Auth: interactive
Required flags: --ctid, --password, -q
ctrader-cli account switch <account-id>Show balance, equity, margin and related statistics.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli account-stats --ctid=<cTID> --password=<password> --account=<account-id> -qList tradable symbols on an account and inspect symbol details and trading sessions.
List every symbol available on the trading account, optionally filtered by broker.
Auth: batch
Required flags: --ctid, --pwd-file, --account
ctrader-cli symbols --ctid=<cTID> --pwd-file=<path-to-pwd-file> --account=<account-id>
ctrader-cli symbols --ctid=<cTID> --pwd-file=<path-to-pwd-file> --account=<account-id> --broker=<broker-name>Show details for one symbol such as digits, lot size and swap rules.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbol
ctrader-cli symbol --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol>Show trading sessions for a symbol including open and close times.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbol
ctrader-cli sessions --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol>Read current prices and historical candles from the trading server.
Show the current bid and ask for one symbol.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbol
ctrader-cli price --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol>Show the current bid and ask for several symbols.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbols
ctrader-cli prices --ctid=<cTID> --password=<password> --account=<account-id> -q --symbols=<symbol-1>,<symbol-2>Return historical candles for a symbol. Choose exactly one of --count, or the --from and --to pair.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbol, --period
ctrader-cli candles --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol> --period=<period> --count=<count>
ctrader-cli candles --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol> --period=<period> --from=<date> --to=<date>List pending orders, inspect an order and place, modify or cancel pending orders.
List active pending orders.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli orders --ctid=<cTID> --password=<password> --account=<account-id> -qShow details for one pending order.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --order
ctrader-cli order --ctid=<cTID> --password=<password> --account=<account-id> -q --order=<order-id>Fill at the next available price.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbol, --side, --volume
ctrader-cli order place-market --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol> --side=<side> --volume=<volume> --sl=<sl> --tp=<tp>See Notes → Volume semantics for the --volume-type flag.
Place a limit order at a chosen price.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbol, --side, --volume, --price
ctrader-cli order place-limit --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol> --side=<side> --volume=<volume> --price=<price> --sl=<sl> --tp=<tp>See Notes → Volume semantics for the --volume-type flag.
Place a stop order that triggers at a chosen price.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbol, --side, --volume, --stop-price
ctrader-cli order place-stop --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol> --side=<side> --volume=<volume> --stop-price=<stop-price> --sl=<sl> --tp=<tp>See Notes → Volume semantics for the --volume-type flag.
Place a stop-limit order with a slippage allowance once the stop fires.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbol, --side, --volume, --stop-price, --limit-range
ctrader-cli order place-stop-limit --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol> --side=<side> --volume=<volume> --stop-price=<stop-price> --limit-range=<limit-range> --sl=<sl> --tp=<tp>See Notes → Volume semantics for the --volume-type flag.
Change a pending order.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --order
ctrader-cli order modify --ctid=<cTID> --password=<password> --account=<account-id> -q --order=<order-id> --price=<price> --sl=<sl> --tp=<tp>| Flag | Description |
|---|---|
--stop-price |
New stop price. |
--volume |
New order volume (default units; use --volume-type to switch). |
--volume-type |
units (default) or lots. Interprets --volume. |
Cancel a pending order. Pass --order=<order-id> to cancel one, or --all to cancel every pending order. Pass --yes to skip confirmation. Inside the interactive shell, append all and yes as the last positionals: > order cancel all yes.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli order cancel --ctid=<cTID> --password=<password> --account=<account-id> -q --order=<order-id> --yes
ctrader-cli order cancel --ctid=<cTID> --password=<password> --account=<account-id> --all --yes -qList open positions, inspect a position, change stop loss or take profit, and close in full or in part.
List open positions.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli positions --ctid=<cTID> --password=<password> --account=<account-id> -qShow details for one open position.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --position
ctrader-cli position --ctid=<cTID> --password=<password> --account=<account-id> -q --position=<position-id>Change the stop loss or take profit of an open position.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --position
ctrader-cli position modify --ctid=<cTID> --password=<password> --account=<account-id> -q --position=<position-id> --sl=<sl> --tp=<tp>Close an open position in full. Pass --position=<position-id> to close one, or --all to close every open position. Pass --yes to skip confirmation. Inside the interactive shell: > position close all yes.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli position close --ctid=<cTID> --password=<password> --account=<account-id> -q --position=<position-id> --yes
ctrader-cli position close --ctid=<cTID> --password=<password> --account=<account-id> --all --yes -qClose part of an open position.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --position, --volume
ctrader-cli position close-partial --ctid=<cTID> --password=<password> --account=<account-id> -q --position=<position-id> --volume=<volume> --yesRead past trading activity and current exposure.
List every deal in a date range, or the most recent N deals. Choose one of --from and --to, or --count. Optionally scope to a single --symbol.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli deals --ctid=<cTID> --password=<password> --account=<account-id> -q --from=<date> --to=<date>
ctrader-cli deals --ctid=<cTID> --password=<password> --account=<account-id> -q --count=<count>
ctrader-cli deals --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol> --from=<date> --to=<date>List every completed order in a date range, or the most recent N completed orders. Choose one of --from and --to, or --count. Completed orders have a status of filled, expired, cancelled or error. Pending orders are not included.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli orders-history --ctid=<cTID> --password=<password> --account=<account-id> -q --from=<date> --to=<date>
ctrader-cli orders-history --ctid=<cTID> --password=<password> --account=<account-id> -q --count=<count>Show current exposure by symbol for one account.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli exposure --ctid=<cTID> --password=<password> --account=<account-id> -qList the indicators available on the trading server, show an indicator's parameters and return current or historical values.
List the indicators available on the trading server.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli indicators --ctid=<cTID> --password=<password> --account=<account-id> -qShow the parameters an indicator accepts, with default values.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --indicator
ctrader-cli indicator parameters --ctid=<cTID> --password=<password> --account=<account-id> -q --indicator=<indicator-name>Calculate the current value of an indicator for a symbol and period.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --indicator, --symbol, --period
ctrader-cli indicator calculate --ctid=<cTID> --password=<password> --account=<account-id> -q --indicator=<indicator-name> --symbol=<symbol> --period=<period>
ctrader-cli indicator calculate --ctid=<cTID> --password=<password> --account=<account-id> -q --indicator=<indicator-name> --symbol=<symbol> --period=<period> --ind-params=<ind-params>Return historical values for an indicator.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --indicator, --symbol, --period, --count
ctrader-cli indicator history --ctid=<cTID> --password=<password> --account=<account-id> -q --indicator=<indicator-name> --symbol=<symbol> --period=<period> --count=<count>
ctrader-cli indicator history --ctid=<cTID> --password=<password> --account=<account-id> -q --indicator=<indicator-name> --symbol=<symbol> --period=<period> --count=<count> --ind-params=<ind-params>List, create and delete price alerts.
List price alerts on an account.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli alerts --ctid=<cTID> --password=<password> --account=<account-id> -qCreate a price alert.
Auth: interactive
Required flags: --ctid, --password, --account, -q, --symbol, --price, --condition
ctrader-cli alert create --ctid=<cTID> --password=<password> --account=<account-id> -q --symbol=<symbol> --price=<price> --condition=<condition> --message=<message> --yesDelete a price alert. Pass --alert=<alert-id> to delete one, or --all to delete every alert. Pass --yes to skip confirmation. Inside the interactive shell: > alert delete all yes.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli alert delete --ctid=<cTID> --password=<password> --account=<account-id> -q --alert=<alert-id> --yes
ctrader-cli alert delete --ctid=<cTID> --password=<password> --account=<account-id> --all --yes -qList cBot instances, show an .algo file's metadata, run a cBot on an account, stop it, backtest it against historical data and sweep its parameters.
List the cBot instances currently running on the account.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli cbots --ctid=<cTID> --password=<password> --account=<account-id> -qShow metadata for an .algo file, including parameters and properties.
Auth: batch (no auth required)
Required flags: none
ctrader-cli metadata <path-to-algo-file>Launch a cBot and stream its output to stdout. Blocks until the cBot exits.
Auth: routes by flag (batch with --pwd-file/--broker; interactive with --password/-q/command flags)
Required flags: <path-to-algo-file>, --symbol, --period
Conditional: batch needs --ctid, --pwd-file, --account; interactive uses -q and credentials are supplied interactively
ctrader-cli run --ctid=<cTID> --pwd-file=<path-to-pwd-file> --account=<account-id> <path-to-algo-file> [<path-to-cbotset-file>] --symbol=<symbol> --period=<period> --exit-on-stopSee Notes → cBot parameter overrides for passing custom cBot parameters.
Stop a running cBot instance by its identifier. Pass --instance=<instance-id> to stop one, or --all to stop every running cBot. Pass --yes to skip confirmation. Inside the interactive shell: > stop all yes.
Auth: interactive
Required flags: --ctid, --password, --account, -q
ctrader-cli stop --ctid=<cTID> --password=<password> --account=<account-id> -q --instance=<instance-id> --yes
ctrader-cli stop --ctid=<cTID> --password=<password> --account=<account-id> --all --yes -qRun a cBot against historical data.
Auth: routes by flag (batch with --pwd-file/--broker; interactive with --password/-q/command flags)
Required flags: <path-to-algo-file>, --symbol, --period, --start, --end, --data-mode
Conditional: batch needs --ctid, --pwd-file, --account
ctrader-cli backtest --ctid=<cTID> --pwd-file=<path-to-pwd-file> --account=<account-id> <path-to-algo-file> [<path-to-cbotset-file>] --symbol=<symbol> --period=<period> --start=<start> --end=<end> --data-mode=<data-mode>| Flag | Description |
|---|---|
--data-file |
Path to a CSV file that provides the historical data. |
--balance |
Starting capital. |
--commission |
Commission amount. Interpretation depends on --commission-type. |
--commission-type |
UsdPerMillionUsdVolume (default), UsdPerOneLot, PercentageOfTradingVolume, QuoteCurrencyPerOneLot. |
--commission-auto |
Use the symbol's real commission and ignore --commission and --commission-type. |
--spread |
Spread override in pips. |
--report |
Path to save an HTML report. |
--report-json |
Path to save a JSON report. |
--precise-conversion |
Download real historical exchange rates for accurate profit/margin conversion. |
--CustomParameter=<value> |
Set any cBot parameter by name (repeat per parameter). |
Sweep cBot parameter values. Uses --timeframe instead of --period. Local edition only.
Auth: batch
Required flags: --ctid, --pwd-file, --account, <path-to-algo-file>, --params, --symbol
ctrader-cli optimize --ctid=<cTID> --pwd-file=<path-to-pwd-file> --account=<account-id> <path-to-algo-file> --params=<path-to-params-file> --symbol=<symbol> --timeframe=<timeframe>| Flag | Description |
|---|---|
--timeframe or -t |
One or more comma-separated timeframes. One pins the main timeframe; several sweep it. Takes precedence over the optset file's timeframe. |
--start |
Backtest start, in dd/MM/yyyy [hh:mm] format (UTC). |
--end |
Backtest end, in dd/MM/yyyy [hh:mm] format (UTC). |
--data-mode |
ticks, m1, m1-csv, tick-csv or open. |
--data-file |
Path to a CSV file that provides the historical data. |
--balance |
Starting capital. |
--commission |
Commission amount. Interpretation depends on --commission-type. |
--commission-type |
UsdPerMillionUsdVolume (default), UsdPerOneLot, PercentageOfTradingVolume, QuoteCurrencyPerOneLot. |
--commission-auto |
Use the symbol's real commission and ignore --commission and --commission-type. |
--spread |
Spread override in pips. |
--method |
genetic (default) or grid. |
--cores |
Number of CPU cores to use. |
--criteria |
Comma-separated optimization criteria (e.g. NetProfit:max,MaxEquityDrawdownPercentages:min). |
--fitness |
Use the cBot custom GetFitness function instead of criteria. |
--auto-select-best |
Auto-select the best pass on completion. |
--optres |
Path to save the .optres result file (JSON). |
--passes-dir |
Directory to save per-pass report files. |
--report |
Path to save an HTML report. |
--report-json |
Path to save a JSON report. |
--precise-conversion |
Download real historical exchange rates for accurate profit/margin conversion. |
Scaffold a new cBot, indicator or plugin project and compile it into an .algo file. No authentication is required.
Scaffold a new cBot, indicator or plugin project. The first positional picks the project kind (cbot, indicator, plugin), the second picks the project name and the optional third picks the language (csharp (default) or python).
Auth: none
Required flags: none
ctrader-cli create cbot MyFirstBot python
ctrader-cli create --kind=cbot --name=MyFirstBot --language=python| Flag | Description |
|---|---|
--kind |
cbot, indicator or plugin |
--name |
Algorithm identifier (becomes the class name and folder name; must be a valid identifier in the target language) |
--language |
csharp (default) or python |
Build an algo project into an .algo file. Pass a path to a .csproj/.sln file or a project folder (the inner .csproj is found automatically).
Auth: none
Required flags: none
ctrader-cli build <path-to-project>
ctrader-cli build --project-path=<path-to-project>List every period token accepted by --period and --timeframe. No account or credentials are required.
Print every supported period token.
Auth: none
Required flags: none
ctrader-cli periodsShow the full command reference inside the interactive shell prompt.
Print the interactive shell's full command reference. Equivalent to launching the shell without arguments and typing help at the > prompt.
Auth: none
Required flags: none
ctrader-cli help| Pattern | Required options | Used by |
|---|---|---|
| Batch | --ctid and --pwd-file |
periods, accounts, symbols, metadata, run, backtest, optimize |
| Interactive | --ctid, --password and -q |
every other command |
Commands accounts, symbols, metadata, run, backtest exist in both modes. The flags you supply pick which one runs.
- Batch route: args contain
--pwd-file=<path>or--broker=<name>, or no auth flags at all. - Interactive route: args contain any of
--password=<value>,-q/--quick/--quit,--commands,--yes/-y,--all,--order,--position,--alert,--instance,--side,--volume,--volume-type,--sl,--tp,--stop-price,--limit-range,--indicator,--ind-params,--symbols,--condition,--message,--from,--to,--count.
--fromand--to(used bycandles,deals,orders-history):yyyy-MM-ddordd/MM/yyyy.- Backtest
--startand--end(used bybacktest,optimize):dd/MM/yyyy [hh:mm]in UTC.
--volume defaults to units of the base currency. Pass --volume-type=lots to interpret it as lots.
--yes/-y skips confirmation prompts. --all targets every applicable entity (stop, order cancel, position close, alert delete). Both also work as the last positional argument inside the interactive shell (> position close all yes).
In batch mode, pass --<ParameterName>=<value> directly. From inside the interactive shell, pass --robot-params=<key=value,key=value> to the same run/backtest commands.
--indicator and --name are aliases. --params and --ind-params are aliases.