Write your own program that works in Bentrix — read candles and ticks, compute an indicator, place orders, run a strategy or a backtest — in Python, JavaScript, C#, Go, Java, C++, Julia, R or Rust.
The SDK is a library for your own program. With it, a program you write does what you do in Bentrix with the mouse: it opens a chart, reads the candles, attaches an indicator or draws its own, steps the replay, buys and sells on a laboratory or paper workbench, runs a strategy and reads its report. It is the same set of tools an AI assistant uses (Agents), given to you as ordinary functions in your own language.
You do not need to be a professional programmer. If you can write a loop and an if in one of the nine languages, the guides below take you the rest of the way, one step at a time, and every step is shown in all nine languages.
01What a program can do
- Read the market — the candles of any interval a chart draws, the ticks behind them, the quotes, a market's contract, several markets at once.
- Move the clock — step a laboratory's replay by ticks or candles, jump to a moment, play and pause. A program, like you, only ever sees what has happened at the clock: never a candle from the future.
- Indicators — attach any of Bentrix's indicators and read their values; compute your own and draw it on the chart; install an Assay script.
- Orders — preview, market and pending orders, stops and targets, trailing stops, closing; the book and the deals.
- Strategies — your own decision loop in your own language, or a strategy document Bentrix runs for you, with its tester report, batches over settings, and walk-forward tests.
- Forecasts — put your model's forecast on the chart, evaluate a model over history, run an ONNX model file: Forecasts on the chart.
- Drawings and alerts, and a reinforcement-learning environment (observations, actions, rewards).
02How it works, in one paragraph
Bentrix runs a small server on this computer only, whenever it is open. Your program finds it by itself, pairs with it under the name you give (it then appears in ☰ › Settings › Agents), and calls its tools. A first program has the scopes read, lab and paper: it can read everything and act in the laboratory and on paper, and it cannot touch a real account until you allow it. Nothing is typed by hand: no address, no password, no key.
03What you need
Bentrix open on the same computer, and one of the nine languages installed. Each language's page says how to install the SDK, how to connect, and shows a first program to run. Then follow the guides in order: the second one makes a laboratory of generated markets for the rest to use, so nothing you do there touches a broker or real money.
Start in your language
- Pythonimport bentrix, connect, and every tool is a method — with types, jobs, streams and the in-process engine beside it.
- JavaScriptNode.js: connect, and every tool is an async method taking one object of arguments.
- C#.NET: BentrixClient.ConnectAsync, and every tool is an async method with typed parameters.
- GoGo: mcp.Connect, and every tool is a method taking a context and an arguments struct.
- JavaJava: Bentrix.connect, and every tool is a method taking its own arguments object.
- C++C++: a header-only client — Bentrix::connect, and every tool is a method taking its own arguments struct.
- JuliaJulia: BentrixMCP.connect, and every tool is a function with positional and keyword arguments.
- RR: connect, and every tool is a function under b$domain$.
- RustRust: bentrix::connect, and every tool is a method taking an arguments builder.
Step-by-step guides
- 1. Connect and look aroundYour first program — connect to Bentrix, list your laboratories and workbenches, and find the workbench you have selected.
- 2. A laboratory to practise inMake a laboratory of generated markets, a workbench in it with two markets, and a chart — everything the other guides use, with no broker and no money.
- 3. Read a chart's candlesRead the candles of any market and interval, page back through history, and take a column such as the closes — always up to the workbench's clock, never past it.
- 4. Ticks and quotesRead the ticks behind the candles and every market's current bid and ask — through the workbench's own addresses.
- 5. Several markets at onceGo through every market of a workbench — its contract, its candles, its own chart — on one clock that moves them all together.
- 6. Move the replay clockStep a laboratory's clock by candles or ticks, forward and back, jump to a moment, and play and pause — what each move does to what a program sees.
- 7. Follow each candle as it closesWait for the next closed candle instead of asking again and again — the same way on a laboratory replay, a paper workbench and a real account's feed.
- 8. Bentrix's indicatorsAttach any of Bentrix's indicators to a chart, change its settings, and read its values — computed by Bentrix exactly as the chart draws them.
- 9. Your own indicatorThree ways to make an indicator of your own — compute it in your program and draw it on the chart, write it in Assay, or (in Python) declare it as a study Bentrix runs.
- 10. Orders and the bookPreview an order's margin, buy and sell at market with a stop and a target, place pending orders, move a stop, trail it, close — and read the book and the deals.
- 11. A strategy of your own, in your own languageA trading loop written in your program — step the clock a candle at a time, read an indicator, decide, send the order — on a laboratory replay, at the speed your program runs.
- 12. Let Bentrix run your strategyWrite a strategy as a document of rules, validate and save it, run it at machine speed with MetaTrader's tester report, then test it over a grid of settings and walk it forward.
- 13. Drawings and alertsDraw a trend line through two candles and set an alert on a price — both carry your program's name, and you can remove them by it.
- 14. A reinforcement-learning environmentTurn a workbench into an environment — observations of the candles and the account, actions, rewards, episodes — for a learning agent of your own.
- 15. When a call is refusedA refusal is an answer, in Bentrix's own words — what each language throws, how to read the sentence, and the refusals a program meets most.
- 16. Generated markets from a recipeRead the presets, preview a recipe, write your own (with regimes), make markets that move together, measure their correlation, make days ahead of time, and give every reinforcement-learning episode a market of its own.
- 17. Import your own filesMake a laboratory of your own data files, read a file before importing it, import candles with a new market's facts, correct a stretch with a second file that has no header, and read the ledger of every import.
- 18. Test a strategy honestlyRun a grid and read it against chance, count every trial, walk it forward, test one run's robustness, compare with another engine, judge a MetaTrader optimisation, test a family of candidates, and let Bentrix's own engine prove itself on your data.