Bentrix Docs
HomePricingDashboard

From your own program

Build a forecast in any of the SDK's nine languages, or have an AI assistant put one over MCP — the forecast document, its two forms, and how it lands.

01The idea

Your program reads the market from a workbench, runs your model, and puts a forecast back with forecast_put. Bentrix checks it, stamps its arrival, draws it, and records it. Your program never names the arrival — Bentrix does, on the workbench's own clock, so a forecast cannot claim to have existed before it did.

To read the market at one instant, use bars_window (several markets and intervals cut at the same moment); to be handed a window at each close, use the data_closed_window stream. Both are in the SDK guides. If your model was trained on days that start at another zone's midnight (New York's, say), give bars_window that zone, and its daily and four-hour candles are cut there — see reading the candles in another time zone.

02A forecast of candles

from bentrix import forecast as fc

w = fc.window(door, bench, ["H1"], symbol="EURUSD", limit=200)
last_open = int(w.times("EURUSD", "H1")[-1])          # the last CLOSED bar

f = fc.Forecast("my-model", "EURUSD", "H1", last_open)
f.step(1.0851, open=1.0846, high=1.0858, low=1.0840, bands=[(1.0830, 1.0870, 0.8)])
f.step(1.0856, bands=[(1.0825, 1.0885, 0.8)])
f.put(door, bench)

The anchor is the open of the last closed bar the forecast is made at; step 1 is the bar after it. A step needs a close; open, high, low, volume, bands (lo, hi, and the probability p), quantiles and sampled paths are optional.

03A forecast of a chart built by price

A Renko, Kagi, Line break, Point and figure or Range bars forecast names no interval — its elements close on price, never on the clock — and carries its rule where it is not the chart's own:

f = fc.Forecast.of_elements("bricks", "EURUSD", "renko", anchor_ms, elements={"renko_box": 0.0005, "renko_reversal": 2})
f.step(1.0855, expected_ms=t1).step(1.0860, expected_ms=t2)
f.put(door, bench)

expected_ms, given on every step or on none, says when each element is expected; it is what lets the forecast stand at its times on a chart by time.

04The same in every language

LanguageThe builderAn element formPut
Pythonbentrix.forecast.ForecastForecast.of_elementsf.put(door, bench)
JavaScriptrequire('bentrix/mcp').forecast.ForecastForecast.ofElementsf.put(client, bench)
Gomcp.NewForecastmcp.NewElementForecastf.Put(ctx, client, bench)
Javabentrix.mcp.Forecast.ofTimeForecast.ofElementsf.put(client::call, bench)
C#Bentrix.Mcp.Forecast.OfTimeForecast.OfElementsf.Put((n, a) => client.Call(n, a), bench)
C++bentrix::mcp::forecast::Forecast::of_time (bentrix_forecast.hpp)Forecast::of_elementsf.put(client, bench)
Rustbentrix::forecast::Forecast::newForecast::of_elementsf.put(&client, bench)
JuliaBentrixMCP.ForecastBentrixMCP.of_elementsforecast_put(client, f, bench)
Rbx_forecastbx_forecast_of_elementsf$put(client, bench)

Every builder writes the same document, forecast_spec; put_many puts several markets and models at one instant.

05What is refused

A forecast is checked before it lands, and a refusal says what to change: a high below its body, a step out of order, an anchor that is no bar's open or that lies past the newest closed bar, an element form that names an interval, a document that names its own arrival. Nothing else is judged — Bentrix does not decide whether your model is right.

06Running a model of your folder from a program

model_run_once runs a model of your models folder once — at the workbench's last close of its interval, or at an earlier moment — and puts what it answers as its forecast, authored model:<name>. model_start keeps it running at every close.

A policy for the Gym. model_infer runs an ONNX model on one input and answers its output; the Python Gym's Model(policy="name", engine="bentrix", door=…) uses it, so a trained policy runs on Bentrix's own engine — no ONNX Runtime in your program — and under your tick like any model of the folder.

07From an AI assistant

An assistant connected over MCP has the same tools: bars_window to read, forecast_put to put, forecast_get to read back what a reader saw at a moment, forecast_clear to remove. See Agents.

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed