Every method of client.strategy() in the Rust SDK.
batch_get#
Read a batch · tool batch_get
Reads a batch: how many of its cells settled, each cell's figures and where it stands (queued, arming, running, ended with its run, refused or not started with why), and the path of its record once every cell settled; then too its statistics against chance - for the cell with the highest net, the probabilistic and deflated Sharpe ratio, the minimum backtest length and the Harvey-Liu haircut over every trial the ledger counts for the strategy, the probability of backtest overfitting over the cells, the interquartile mean of the cells' nets with a bootstrap interval, the first market's price change as the baseline, and the conventions labelled as such.
Declaration
client.strategy()
pub fn batch_get(&self, args: StrategyBatchGetArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
batch | impl Into<String> | required | The batch's uri (bentrix://batch/<id>). |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
What the tool's description says.
Example
client.strategy().batch_get(mcp::StrategyBatchGetArgs::new("…"))?batch_stop#
Stop a batch · tool batch_stop
Stops a batch: its running cells end as a run's Stop ends them, the cells not yet started are not started, and what settled stays. Answers the batch.
Declaration
client.strategy()
pub fn batch_stop(&self, args: StrategyBatchStopArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
batch | impl Into<String> | required | The batch's uri (bentrix://batch/<id>). |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the batch.
Example
client.strategy().batch_stop(mcp::StrategyBatchStopArgs::new("…"))?battery_get#
Read the verification battery · tool battery_get
Answers this session's verification battery: how many of its workbenches settled, and once all did, each of the sixteen checks — its verdict (pass, fail, measured, not run), what it found in a sentence, and its figures.
Declaration
client.strategy()
pub fn battery_get(&self) -> Result<ValueIt takes no arguments.
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers this session's verification battery: how many of its workbenches settled, and once all did, each of the sixteen checks — its verdict (pass, fail, measured, not run), what it found in a sentence, and its figures.
Example
client.strategy().battery_get()?battery_run#
Run the verification battery · tool battery_run
Runs the sixteen checks of Bentrix's own engine on a laboratory workbench's recording: a reference strategy (EMA 8 crossing EMA 21, hourly) at machine speed on workbenches made alike it — as it is, again, on twice the spread, on one-minute OHLC ticks, over the first half of its days — and scripted orders on three more (a buy and a sell held to the middle of the days, a stop and a limit). Answers as battery_get does; battery_get again until every check is answered: pass, fail, measured or not run, each with its reason and figures.
Declaration
client.strategy()
pub fn battery_run(&self, args: StrategyBatteryRunArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
bench | impl Into<String> | required | The laboratory workbench whose recording the battery runs on: bentrix://lab/<lab>/bench/<bench>. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers as battery_get does; battery_get again until every check is answered: pass, fail, measured or not run, each with its reason and figures.
Example
client.strategy().battery_run(mcp::StrategyBatteryRunArgs::new(bench.clone()))?bench_set_automation#
Arm a workbench's automation · tool bench_set_automation
Arms or disarms a laboratory workbench's automation — whether a run's intents on it become orders — as the workbench's own switch does. A disarmed run still decides and journals what it would have sent. Answers the switch.
Declaration
client.strategy()
pub fn bench_set_automation(&self, args: StrategyBenchSetAutomationArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
bench | impl Into<String> | required | The workbench's uri. |
armed | bool | required | Whether a run's intents on it become orders. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"armed": true,
"bench": "bentrix://lab/lab-1/bench/bench-2"
}Example
client.strategy().bench_set_automation(mcp::StrategyBenchSetAutomationArgs::new(bench.clone(), true))?env_act#
Act on the market's clock · tool env_act
Takes one action in a live environment's episode, at the close it stands at: the position brought to the action's side - a flip closes first, and opens only once the close was sent; on a real account under Confirm the close is proposed in the trade panel for the person's Send. Moves no clock. Answers the refusal in its words and the outcome (sent, awaiting_person, refused); env_observe at the next close gives the reward.
Declaration
client.strategy()
pub fn env_act(&self, args: StrategyEnvActArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
env | impl Into<String> | required | |
action | impl Into<Value> | required | The action: 0, 1 or 2 for a discrete environment, a number in [-1, 1] for a continuous one, {side, size, stop, target} for an order one. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the refusal in its words and the outcome (sent, awaiting_person, refused); env_observe at the next close gives the reward.
Example
client.strategy().env_act(mcp::StrategyEnvActArgs::new(env.clone(), "…"))?env_close#
Close an environment · tool env_close
Lets an environment go. Its workbench and its deals stay as they are.
Declaration
client.strategy()
pub fn env_close(&self, args: StrategyEnvCloseArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
env | impl Into<String> | required |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"closed": "env-1"
}Example
client.strategy().env_close(mcp::StrategyEnvCloseArgs::new("env-1"))?env_make#
Make a trading environment · tool env_make
Makes a reinforcement-learning environment over a workbench - observations of the closed candles and the account, discrete, continuous or order actions, eight named rewards, tape, window or session episodes (a growing curriculum optional), a modelled participation cap - and answers its id with its observation and action spaces. On a laboratory workbench env_reset starts an episode, env_step takes an action, run_episode runs a list; the workbench is rewound at each reset, its deals undone, so give it one of its own. On a paper or REAL workbench the clock is the market's: env_reset at a close, env_act, then env_observe at the next close. Env_close lets it go.
Declaration
client.strategy()
pub fn env_make(&self, args: StrategyEnvMakeArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
bench | impl Into<String> | required | The workbench's uri. A laboratory workbench is rewound at each reset, its deals undone — give it one of its own; a paper or REAL one runs on the market's clock (env_act, env_observe). |
action | impl Into<String> | optional | Discrete (0 flat, 1 long, 2 short; the default), continuous (a target in [-1, 1]) or order (side, size, stop and target in points). |
deadband | f64 | optional | A continuous action's flat zone, by default 0.1. |
episode | impl Into<String> | optional | Tape (the whole days), window (episode_bars candles from the seed's draw; the default) or session (one day). |
episode_bars | i64 | optional | A window episode's candles, by default 200. |
follow | bool | optional | Follow a clock someone else moves rather than drive it — a paper or REAL workbench always does; a laboratory one may (a replay the person plays, acted on at each close): no rewind, env_act and env_observe. |
growing | impl Into<Value> | optional | A curriculum: window episodes lengthening from first to last candles over over episodes. |
impact | f64 | optional | With participation: the reward charged impact x units / the candle's volume - never the account. |
interval | impl Into<String> | optional | The interval a step lasts (M1 to W1), by default H1. |
lots | f64 | optional | The lots a whole position holds, by default 0.01. |
max_points | f64 | optional | An order action's largest stop or target, in points, by default 10000. |
max_steps | i64 | optional | On a live workbench: the steps after which an episode is truncated. |
participation | f64 | optional | A modelled participation cap: an order's units at most this share of the last closed candle's volume, in (0, 1]. |
reward | impl Into<String> | optional | The reward plugin, by default dsr_dd_penalty@1. |
ruin | f64 | optional | The share of the opening equity at or below which an episode ends in ruin, by default 0.5. |
symbol | impl Into<String> | optional | The market, by default the workbench's first. |
window | i64 | optional | The closed candles an observation holds, by default 32. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"action_space": {
"kind": "discrete",
"meaning": [
"flat",
"long",
"short"
],
"n": 3
},
"env": "env-1",
"first_ms": 1790812800000,
"interval": "H1",
"last_ms": 1793491200000,
"length_ms": 3600000,
"live": false,
"observation_space": {
"account": {
"dtype": "float32",
"meaning": "side, log equity ratio to the episode's start, open profit over the opening equity",
"shape": [
3
]
},
"market": {
"dtype": "float32",
"meaning": "open, high, low, close as log ratios to the last close",
"shape": [
8,
4
]
}
},
"reward": "dsr_dd_penalty@1",
"symbol": "SYN-DOCS"
}Example
client.strategy().env_make(mcp::StrategyEnvMakeArgs::new(bench.clone()))?env_observe#
Observe at a close · tool env_observe
Answers where an environment's episode stands at the close at_ms: the observation, the reward of the move since the last env_act, terminated (ruin), truncated (no candle closed, or the episode's steps) and info. On a live workbench it follows env_act at each close; on a laboratory workbench standing at at_ms it reads the observation a laboratory step would.
Declaration
client.strategy()
pub fn env_observe(&self, args: StrategyEnvObserveArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
env | impl Into<String> | required | |
at_ms | i64 | required | The close the workbench stands at. |
moved | bool | optional | False when no candle closed since the last observation (the market said nothing): the episode is truncated. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers where an environment's episode stands at the close at_ms: the observation, the reward of the move since the last env_act, terminated (ruin), truncated (no candle closed, or the episode's steps) and info.
Example
client.strategy().env_observe(mcp::StrategyEnvObserveArgs::new(env.clone(), 1))?env_reset#
Start an episode · tool env_reset
Starts an environment's next episode. In the laboratory the workbench is rewound to its start with its deals undone, then advanced as Play would to the episode's start (the tape's first hour after the warm-up, a window the seed draws or start_ms gives, or a session's day); on a live workbench nothing moves and the episode starts at at_ms. Answers the observation and info (the reward's name, the ledger hash, the start, the end, the opening equity).
Declaration
client.strategy()
pub fn env_reset(&self, args: StrategyEnvResetArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
env | impl Into<String> | required | The environment, as env_make answered it. |
at_ms | i64 | optional | On a live workbench: the close the market last reached, where the episode starts. |
bars | i64 | optional | With start_ms: the episode's candles. |
seed | i64 | optional | The seed: given, the episode draws start over from it; absent, the next episode of the last seed. |
start_ms | i64 | optional | A window episode's start, chosen by a person's own sampler instead of the seed's draw. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"info": {
"end_ms": 1792828800000,
"episode_index": 0,
"ledger_hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"opening": 10000.0,
"reward": "dsr_dd_penalty@1",
"start_ms": 1792785600000
},
"obs": {
"account": [
0.0,
0.0,
-0.0
],
"market": [
[
0.001366929616779089,
0.003762140404433012,
0.0010633289348334074,
0.002853242214769125
],
[
0.002873448887839914,
0.004236459266394377,
0.0013568111462518573,
0.0013568111462518573
],
[
0.001366929616779089,
0.0019536297768354416,
0.0011341773206368089,
0.0017311288975179195
],
"… 5 more"
]
}
}Example
client.strategy().env_reset(mcp::StrategyEnvResetArgs::new("env-1"))?env_step#
Take an action · tool env_step
Takes one action in a laboratory environment's episode: the position brought to the action's side through the workbench's venue (refused in its words, never clipped into another), then the workbench advanced to the interval's next close. Answers the observation, the reward, terminated (ruin), truncated (the episode's or the tape's end) and info (the ledger hash, the refusal, the equity, the cursor, the participation it was cut to).
Declaration
client.strategy()
pub fn env_step(&self, args: StrategyEnvStepArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
env | impl Into<String> | required | |
action | impl Into<Value> | required | The action: 0, 1 or 2 for a discrete environment, a number in [-1, 1] for a continuous one, {side, size, stop, target} for an order one. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"info": {
"cursor_ms": 1791154800000,
"equity": 9998.23,
"ledger_hash": "db865d84c5c5875ec1bf7ef2d5ba0b26ec224518c9cb1e88270286b61fed3962",
"refused": null,
"reward": "dsr_dd_penalty@1"
},
"obs": {
"account": [
1.0,
-0.0001770156668499112,
-0.00017499999376013875
],
"market": [
[
0.004607579670846462,
0.005970589816570282,
0.003090942045673728,
0.003090942045673728
],
[
0.003101060399785638,
0.0036877605598419905,
0.0028683082200586796,
0.0034652596805244684
],
[
0.0034753745421767235,
0.0034753745421767235,
0.0021494701504707336,
0.0021595980506390333
],
"… 5 more"
]
},
"reward": 0.0,
"terminated": false,
"truncated": false
}Example
client.strategy().env_step(mcp::StrategyEnvStepArgs::new("env-1", 1))?ledger_query#
Read the trial ledger · tool ledger_query
Reads the trial ledger: every run, batch cell and re-run written before its result was shown, and each result after it, in order - sequence number, wall clock, kind (trial or result), body (strategy, version, digest, tick model, span start, the batch and its figures; or of, trades and net; or an external family's name, count and description) and the hash chain. With strategy, that strategy's trials and their results only, and trials counts them (the N a multiple-testing correction needs). Always answers union, every trial the ledger holds (a run one, an external line its count), and families, each family's and strategy's count. Says where the chain stops following, if it does. The ledger has no door that removes a line.
Declaration
client.strategy()
pub fn ledger_query(&self, args: StrategyLedgerQueryArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
from_seq | i64 | optional | The first line to answer (its sequence number); omitted, from the first. |
limit | i64 | optional | How many lines at most; omitted, 500. |
strategy | impl Into<String> | optional | A strategy, by its name as every other tool takes it (rsi pullback) or its stem (its file name, rsi_pullback), to read that strategy's trials and their results only. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
What the tool's description says.
Example
client.strategy().ledger_query(mcp::StrategyLedgerQueryArgs::new())?ledger_record#
Record trials tried outside a run · tool ledger_record
Appends to the trial ledger a family of candidates tried in the person's own code - an event study's cells, a grid searched outside Bentrix - as one line with its count, before any of its result exists (kind trial: family, count, description, digest); or what came of such a trial (kind result: of, result). The family's count joins the ledger's union, the N a correction across everything tried takes, and never leaves it: the ledger has no door that removes a line. A run's own trials are Bentrix's to write and are refused here. Answers the line's sequence number, the family's count and the union.
Declaration
client.strategy()
pub fn ledger_record(&self, args: StrategyLedgerRecordArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
kind | impl Into<String> | required | trial: a family of candidates tried outside a run, written before any of its result exists. result: what came of an earlier external trial. |
count | i64 | optional | Trial: how many candidates this line adds to the family, 1 to 10,000,000. |
description | impl Into<String> | optional | Trial: what was tried, in words, at most 4,000 characters. |
digest | impl Into<String> | optional | Trial: a digest of the pre-registration, at most 128 characters. |
family | impl Into<String> | optional | Trial: the family's name, letters, digits, _, - and ., at most 64. |
of | i64 | optional | Result: the sequence number of the external trial it answers. |
result | impl Into<Value> | optional | Result: what came of it, an object of at most 64 KiB. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the line's sequence number, the family's count and the union.
Example
client.strategy().ledger_record(mcp::StrategyLedgerRecordArgs::new("…"))?optimisation_import#
Import a MetaTrader optimisation · tool optimisation_import
Reads a MetaTrader optimisation's results table (Pass, Result or Profit, Sharpe Ratio, Trades, and the expert's inputs), writes every pass to the trial ledger as a trial of name with its result, and judges the best pass (the highest Sharpe ratio) over the ledger's N for that name: its probabilistic and deflated Sharpe ratio and the Harvey-Liu haircut. The table carries no return series, so the sample is the pass's trades with a normal's skew and kurtosis, said, and PBO is not computed, said. The Strategies panel's Import optimisation results draws the same.
Declaration
client.strategy()
pub fn optimisation_import(&self, args: StrategyOptimisationImportArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
name | impl Into<String> | required | The expert's name: what its passes are counted under in the trial ledger. |
table | impl Into<String> | required | The optimiser's exported table: its Export to XML file's text, or the table as CSV or tab-separated text with its header row. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
What the tool's description says.
Example
client.strategy().optimisation_import(mcp::StrategyOptimisationImportArgs::new("…", "…"))?run_episode#
Run an episode · tool run_episode
Resets a laboratory environment (with the seed when given) and takes the actions in turn until the episode ends or they run out. Answers each step's reward, refusal and equity, the steps taken, whether it terminated or was truncated, and the ledger hash.
Declaration
client.strategy()
pub fn run_episode(&self, args: StrategyRunEpisodeArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
env | impl Into<String> | required | |
actions | impl Into<Value> | required | The actions, taken in turn until the episode ends or they run out. |
seed | i64 | optional |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers each step's reward, refusal and equity, the steps taken, whether it terminated or was truncated, and the ledger hash.
Example
client.strategy().run_episode(mcp::StrategyRunEpisodeArgs::new(env.clone(), "…"))?run_get#
Read a run · tool run_get
A run's state, its counts, and once it has ended its manifest: the tester report MetaTrader's tester shows, the trades and the equity samples.
Declaration
client.strategy()
pub fn run_get(&self, args: StrategyRunGetArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
run | impl Into<String> | required | The run's uri. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"bench": "bentrix://lab/lab-1/bench/bench-2",
"counts": {
"candles": 473,
"emitted": 2,
"held_back": 0,
"not_armed": 0,
"refused": 0,
"sent": 2
},
"manifest": {
"armed": true,
"bench": "Laboratory(LaboratoryId(1)) / bench-2",
"conditions": {
"build": "0.1.382+d7ec1b8",
"cost_edition": "BENTRIX standard costs 2026.1",
"costs": {},
"currency": "USD",
"data": [
{
"m1_months": 1,
"m1_sha256": "d1d4fdd94b1c927d202e9ef4a32f96454be073d7e192179c7a0ce25d15403f44",
"market": "SYN-DOCS",
"tick_bytes": 2498934,
"tick_days": 26,
"tick_list_sha256": "635122d183d4dba8218133ef30067c18c2cf2e0e7976f9ec9e2fbf3781102d3d"
},
{
"m1_months": 1,
"m1_sha256": "59de407e183966b0d79280d26f5083ad0b4c4d2d339a23f112ecc1a57fe3d811",
"market": "SYN-DOCS2",
"tick_bytes": 4181811,
"tick_days": 26,
"tick_list_sha256": "076c16d51e91b0c38bd4281efb403ea14a16dc10ad7e97f74f82d3aa0d929c4a"
}
],
"document": {
"entry": {
"cancel_on_opposite": false,
"expires_candles": null,
"from": null,
"kind": "market",
"limit_offset": null,
"offset": null
},
"exits": {
"breakeven": null,
"first_target": null,
"stop": {
"atr": {
"study": "atr",
"times": 1.5
}
},
"target": {
"r": 2.0
},
"trail": null
},
"interval": "H1",
"limits": {
"max_bars": null,
"max_open": null,
"one_position_per_market": true,
"per_day": null
},
"made_by": "agent",
"made_ms": 0,
"markets": [
"SYN-DOCS"
],
"name": "docs rsi",
"notes": "",
"rules": {
"buy": {
"all": [
{
"cond": "rsi:level.cross_up:30"
},
{
"compare": {
"above": [
"price.close",
"ema200"
]
}
}
]
},
"close_buys": {
"any": [
{
"compare": {
"cross_down": [
"rsi",
50.0
]
}
},
{
"bars_in_trade": 48
}
]
},
"close_sells": {
"any": [
{
"compare": {
"cross_up": [
"rsi",
50.0
]
}
},
{
"bars_in_trade": 48
}
]
},
"sell": {
"all": [
{
"cond": "rsi:level.cross_down:70"
},
{
"compare": {
"below": [
"price.close",
"ema200"
]
}
}
]
}
},
"schema": 1,
"sessions": {
"desks": [],
"flat_at": null,
"window": null
},
"sizing": {
"mode": "lots",
"value": 0.1
},
"studies": {
"atr": {
"applied": "close",
"convention": "mt5",
"kind": "atr",
"settings": {
"period": 14,
"shape": "period"
}
},
"ema200": {
"applied": "close",
"convention": "talib",
"kind": "ema",
"settings": {
"period": 200,
"shape": "period"
}Example
client.strategy().run_get(mcp::StrategyRunGetArgs::new(run.clone()))?run_parity#
Compare a run with another engine's trades · tool run_parity
Compares an ended run's closed trades with a trade list another engine produced - MetaTrader's tester, another backtester, an earlier run - each put in one canonical form (one line a closed trade: close time in ms, L or S, net at two decimals, in closing order) and hashed with sha256. Answers both hashes and counts, whether they are one list, and the first trade where they part with each side's line. Times are compared as each list writes them. The Run window's Validation tab draws the same.
Declaration
client.strategy()
pub fn run_parity(&self, args: StrategyRunParityArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
run | impl Into<String> | required | The run's uri. |
list | impl Into<String> | required | The other engine's trade list, as its file's text: a JSON list of trades (time_ms or time, long or side, net or profit with commission and swap), a Bentrix run.json, or a CSV with a header naming those columns (a deals report's Direction column keeps its out rows). |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers both hashes and counts, whether they are one list, and the first trade where they part with each side's line.
Example
client.strategy().run_parity(mcp::StrategyRunParityArgs::new(run.clone(), "…"))?run_pause#
Pause a run · tool run_pause
Hands a running run's clock back to the person at the end of its candle, as Pause does. Answers the run.
Declaration
client.strategy()
pub fn run_pause(&self, args: StrategyRunPauseArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
run | impl Into<String> | required | The run's uri. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the run.
Example
client.strategy().run_pause(mcp::StrategyRunPauseArgs::new(run.clone()))?run_resume#
Resume a run · tool run_resume
Continues a paused run from wherever its workbench's clock now stands, as Resume does. Answers the run.
Declaration
client.strategy()
pub fn run_resume(&self, args: StrategyRunResumeArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
run | impl Into<String> | required | The run's uri. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the run.
Example
client.strategy().run_resume(mcp::StrategyRunResumeArgs::new(run.clone()))?run_robustness#
Test a run's robustness · tool run_robustness
Tests how robust an ended run of this session is, over its trades read with their entries, every draw from one fixed seed: the maximum drawdown over the trades drawn again in another order, the net with a tenth of the trades left out, the net with each trade's fill degraded by up to a tenth of the median absolute trade net (each as 5th, 50th and 95th percentiles of 1,000 draws); the random-entry percentile (the share of random draws - as many trades, each held as long as one of the run's, at a random minute in a random direction on its first market - whose sum of price moves is below the run's); and its trades, net and wins under the quiet, middle and busy days; and its metrics - Van Tharp's SQN, expectancy and its parts, the longest drawdown duration and the market's own trading days a year. Each with its definition; kept as robustness.json beside the run's run.json. The Run window's Validation tab draws the same.
Declaration
client.strategy()
pub fn run_robustness(&self, args: StrategyRunRobustnessArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
run | impl Into<String> | required | The run's uri. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
What the tool's description says.
Example
client.strategy().run_robustness(mcp::StrategyRunRobustnessArgs::new(run.clone()))?run_set_pace#
Change a run's pace · tool run_set_pace
Switches a run between machine speed and the replay's pace at the cursor, as the Run window's pace does. Answers the run.
Declaration
client.strategy()
pub fn run_set_pace(&self, args: StrategyRunSetPaceArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
run | impl Into<String> | required | |
pace | impl Into<String> | required |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the run.
Example
client.strategy().run_set_pace(mcp::StrategyRunSetPaceArgs::new(run.clone(), "…"))?run_stop#
Stop a run · tool run_stop
Ends a run at the end of its candle, as the Run window's Stop does; Stop is never refused while a run runs or waits paused. Answers the run.
Declaration
client.strategy()
pub fn run_stop(&self, args: StrategyRunStopArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
run | impl Into<String> | required | The run's uri. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the run.
Example
client.strategy().run_stop(mcp::StrategyRunStopArgs::new(run.clone()))?stats_family_test#
Test a family of candidates against chance · tool stats_family_test
Tests a family of candidates against a benchmark at once, from each candidate's performance less the benchmark's period by period: Hansen's test for superior predictive ability (the consistent p-value, with the liberal one and the conservative one, which is White's reality check) and each candidate's Romano-Wolf stepdown adjusted p-value, over one stationary bootstrap drawn the same for every candidate. The same series and seed give the same answer. Pure arithmetic: reads and writes nothing; a family larger than candidates x periods x resamples = 200,000,000 is refused with its size.
Declaration
client.strategy()
pub fn stats_family_test(&self, args: StrategyStatsFamilyTestArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
series | impl Into<Value> | required | Each candidate's performance less the benchmark's, period by period (larger is better), every row the same length: one row a candidate. |
mean_block | f64 | optional | The stationary bootstrap's mean block length in periods; omitted, 10. |
resamples | i64 | optional | Bootstrap resamples; omitted, 1,000; at most 20,000. |
seed | i64 | optional | The bootstrap's seed (the same seed, the same answer); omitted, 1. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
What the tool's description says.
Example
client.strategy().stats_family_test(mcp::StrategyStatsFamilyTestArgs::new("…"))?batch#
Run a strategy over a grid of its figures · tool strategy_batch
Runs a saved strategy once per combination of the grid's values, each cell on a workbench of its own made over every condition of the given laboratory workbench (stretch, markets, zone, account, costs) and run from its first moment at machine speed, at most workers at once. A cell the validator refuses is said by field and never run; a batch past Largest batch is refused with the number. Two figures vary the cells' benches rather than the document: tick_model (real, every-tick, ohlc-m1, open-only) and spread_multiplier (numbers above zero, 1 as recorded); a settled batch's record compares the results under each, with a sign-flip flag. With dry, answers the cells and the estimate and makes nothing. Answers the batch's uri; batch_get reads its cells and their runs.
Declaration
client.strategy()
pub fn batch(&self, args: StrategyBatchArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
strategy | impl Into<String> | required | The saved strategy's name. |
bench | impl Into<String> | required | The laboratory workbench whose conditions every cell's own bench copies. |
grid | impl Into<Value> | required | Each figure the batch varies, by its path in the document (studies.fast.settings.period, sizing.value, a script's script.inputs.<title>), and the values it takes. |
dry | bool | optional | Plan only: the cells and the estimate, nothing made. |
version | i64 | optional | A version; the latest when absent. |
workers | i64 | optional | How many cells run at once; the computer's cores less two when absent. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the batch's uri; batch_get reads its cells and their runs.
Example
client.strategy().batch(mcp::StrategyBatchArgs::new(strategy.clone(), bench.clone(), "…"))?get#
Read strategies · tool strategy_get
Lists the person's strategies with their versions, or reads one version of one — the latest when none is named — as the file holds it.
Declaration
client.strategy()
pub fn get(&self, args: StrategyGetArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
name | impl Into<String> | optional | The strategy's name; absent lists every strategy with its versions. |
version | i64 | optional | A version; the latest when absent. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"strategies": [
{
"name": "docs rsi",
"unreadable": 0,
"versions": [
1
]
}
]
}Example
client.strategy().get(mcp::StrategyGetArgs::new())?run#
Run a strategy · tool strategy_run
Runs a saved strategy version on a laboratory workbench from its cursor, as the Run sheet does — one run per workbench; on a paper workbench at the market's own pace only (pace: replay); on a real account's workbench (with real) the person allows it on a card first, and every order follows the account's Automations mode - answered as a job. Its intents become orders only while the workbench's automation is armed (bench_set_automation). Answers the run's uri; run_get reads it, and its tester report once it ends.
Declaration
client.strategy()
pub fn run(&self, args: StrategyRunArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
strategy | impl Into<String> | required | The saved strategy's name. |
bench | impl Into<String> | required | The laboratory workbench it runs on, from its cursor. |
pace | impl Into<String> | optional | |
version | i64 | optional | A version; the latest when absent. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"bench": "bentrix://lab/lab-1/bench/bench-2",
"counts": {
"candles": 0,
"emitted": 0,
"held_back": 0,
"not_armed": 0,
"refused": 0,
"sent": 0
},
"manifest": null,
"pace": "machine",
"state": "running",
"uri": "bentrix://run/2990368"
}Example
client.strategy().run(mcp::StrategyRunArgs::new("docs rsi", bench.clone()))?save#
Save a strategy · tool strategy_save
Saves a strategy document as its next version — version 1 for a new name — validated first, never over a file; a document the latest version already says is not written again. Answers the version, its digest and the validation.
Declaration
client.strategy()
pub fn save(&self, args: StrategySaveArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
document | impl Into<Value> | required | The strategy document, as bentrix://strategy/schema describes it. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"digest": "bd74f65d1a4641b3eca93ccd8df3e303de223a63522baa90def8adb99ffdf49a",
"name": "docs rsi",
"validation": {
"refusals": [],
"runnable": true,
"warnings": []
},
"version": 1,
"written": true
}Example
client.strategy().save(mcp::StrategySaveArgs::new("…"))?validate#
Validate a strategy · tool strategy_validate
Validates a strategy document as the editor does, field by field: whether it can run, what refuses it and what is only warned. Saves nothing.
Declaration
client.strategy()
pub fn validate(&self, args: StrategyValidateArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
document | impl Into<Value> | required | The strategy document, as bentrix://strategy/schema describes it. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):
{
"refusals": [],
"runnable": true,
"warnings": []
}Example
client.strategy().validate(mcp::StrategyValidateArgs::new("…"))?walkforward#
Walk a strategy forward · tool strategy_walkforward
Cuts the workbench's days into windows of in_sample_days and the out_of_sample_days after them (anchored: every in-sample stretch starts at the first day; rolling: the in-sample days before), and for each window in turn runs the grid as a batch over its in-sample days, chooses the cell with the highest in-sample net, and runs it as chosen over the out-of-sample days on a bench whose days begin at the in-sample start. Every cell and every out-of-sample run is a trial in the ledger, naming the walk and the window. Answers the walk's uri; walk_get reads its windows and, once ended, its record.
Declaration
client.strategy()
pub fn walkforward(&self, args: StrategyWalkforwardArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
strategy | impl Into<String> | required | The saved strategy's name. |
bench | impl Into<String> | required | The laboratory workbench whose days are walked and whose conditions every bench copies. |
grid | impl Into<Value> | required | Each figure the in-sample batches vary, by its path, and its values (strategy_batch's grid; never tick_model). |
in_sample_days | i64 | required | Days of each in-sample stretch. |
out_of_sample_days | i64 | required | Days of each out-of-sample stretch. |
mode | impl Into<String> | required | Anchored (every in-sample stretch starts at the first day) or rolling (the days before). |
version | i64 | optional | A version; the latest when absent. |
workers | i64 | optional | How many in-sample cells run at once; the computer's cores less two when absent. |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the walk's uri; walk_get reads its windows and, once ended, its record.
Example
client.strategy().walkforward(mcp::StrategyWalkforwardArgs::new(strategy.clone(), bench.clone(), "…", 1, 1, "…"))?walk_get#
Read a walk-forward run · tool walk_get
Answers a walk-forward run as it stands: each window's in-sample and out-of-sample stretches, its batch, the figures chosen and their in-sample net, the out-of-sample trades and net, and the efficiency (out-of-sample net a day over in-sample net a day, where the in-sample net is above zero); the out-of-sample total; and once every window settled, where its record was written.
Declaration
client.strategy()
pub fn walk_get(&self, args: StrategyWalkGetArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
walk | impl Into<String> | required | The walk's uri (bentrix://walk/<id>). |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers a walk-forward run as it stands: each window's in-sample and out-of-sample stretches, its batch, the figures chosen and their in-sample net, the out-of-sample trades and net, and the efficiency (out-of-sample net a day over in-sample net a day, where the in-sample net is above zero); the out-of-sample total; and once every window settled, where its record was written.
Example
client.strategy().walk_get(mcp::StrategyWalkGetArgs::new("…"))?walk_stop#
Stop a walk-forward run · tool walk_stop
Stops a walk-forward run as its Stop does: the window's in-sample batch or out-of-sample run stopped, the windows not reached failed as stopped; what settled stays. Answers the walk as walk_get does.
Declaration
client.strategy()
pub fn walk_stop(&self, args: StrategyWalkStopArgs) -> Result<ValueParameters
| Name | Type | What it is | |
|---|---|---|---|
walk | impl Into<String> | required | The walk's uri (bentrix://walk/<id>). |
Returns
Result<Value, Error> — the tool’s answer as a serde_json::Value.
What it answers
Answers the walk as walk_get does.
Example
client.strategy().walk_stop(mcp::StrategyWalkStopArgs::new("…"))?