Bentrix Docs
HomePricingDashboard

Rust: drawings

Every method of client.drawing() in the Rust SDK.

object_change#

Change a drawing · tool object_change

scope: labplan: plussince 1.0.0

Changes a drawing's colour, width, style, fill, text, levels, scalar, lock or the intervals it is drawn on, as its properties window does, or puts its look back with reset. Its points stay (object_move moves them). Answers the drawing.

Declaration

client.drawing()
pub fn object_change(&self, args: DrawingObjectChangeArgs) -> Result<Value

Parameters

NameTypeWhat it is
objectimpl Into<String>required
patchimpl Into<Value>optionalFields of the drawing's saved form laid over it: color [r,g,b,a], width (1 to 5), style, fill, text, levels [..], param, locked, visibility.
resetbooloptionalWidth, style, fill, text, levels and the scalar back to the kind's own, and the colour to the ink, as the properties window's Reset.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the drawing.

Example

client.drawing().object_change(mcp::DrawingObjectChangeArgs::new(object.clone()))?

object_delete#

Delete a drawing · tool object_delete

scope: labplan: plussince 1.0.0

Deletes a drawing through the chart's own Delete, so object_undo brings it back. Answers the chart.

Declaration

client.drawing()
pub fn object_delete(&self, args: DrawingObjectDeleteArgs) -> Result<Value

Parameters

NameTypeWhat it is
objectimpl Into<String>requiredThe drawing's uri, as the chart's answer gives it.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the chart.

Example

client.drawing().object_delete(mcp::DrawingObjectDeleteArgs::new(object.clone()))?

object_delete_by_author#

Remove an author's drawings · tool object_delete_by_author

scope: labplan: plussince 1.1.0

Removes every drawing one agent drew on a chart, as the chart's Remove <name>'s drawings does; the person's own drawings are never among them. Answers the chart and how many went.

Declaration

client.drawing()
pub fn object_delete_by_author(&self, args: DrawingObjectDeleteByAuthorArgs) -> Result<Value

Parameters

NameTypeWhat it is
chartimpl Into<String>requiredThe chart's uri.
authorimpl Into<String>optionalAgent:<pairing>, as a drawing's author reads; absent: this agent's own.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the chart and how many went.

Example

client.drawing().object_delete_by_author(mcp::DrawingObjectDeleteByAuthorArgs::new(chart.clone()))?

object_find#

Find drawings · tool object_find

scope: readplan: freesince 1.0.0

Lists a chart's drawings, of one kind, with a point in a span of time, by an author (agent:<pairing>, or person) or in a study's pane, with their uris and saved forms (author and pane among them).

Declaration

client.drawing()
pub fn object_find(&self, args: DrawingObjectFindArgs) -> Result<Value

Parameters

NameTypeWhat it is
chartimpl Into<String>required
authorimpl Into<String>optionalOnly drawings by this author: agent:<pairing> for an agent's, or "person" for the person's own.
from_msi64optionalOnly drawings with a point at or after this moment.
kindimpl Into<String>optionalOnly drawings of this kind.
panei64optionalOnly drawings in this study's pane (its id); absent: every pane.
to_msi64optionalOnly drawings with a point at or before this moment.

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):

{
  "chart": "bentrix://lab/lab-1/bench/bench-2/chart/chart-5",
  "objects": [
    {
      "drawing": {
        "anchors": [
          {
            "price": 0.96743,
            "t_ms": 1791885600000
          },
          {
            "price": 0.96839,
            "t_ms": 1791892800000
          }
        ],
        "author": "agent:1",
        "color": [
          226,
          229,
          234,
          255
        ],
        "fill": false,
        "kind": "trend_line",
        "levels": [],
        "param": 0.0,
        "style": "solid",
        "text": "",
        "width": 1.0
      },
      "id": 1,
      "uri": "bentrix://lab/lab-1/bench/bench-2/chart/chart-5/object/1"
    }
  ]
}

Example

client.drawing().object_find(mcp::DrawingObjectFindArgs::new(chart.clone()))?

object_lock#

Lock or unlock a drawing · tool object_lock

scope: labplan: plussince 1.0.0

Locks a drawing, so no drag moves it, or unlocks it, as the floating bar's lock does. Answers the drawing.

Declaration

client.drawing()
pub fn object_lock(&self, args: DrawingObjectLockArgs) -> Result<Value

Parameters

NameTypeWhat it is
objectimpl Into<String>required
lockedboolrequired

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the drawing.

Example

client.drawing().object_lock(mcp::DrawingObjectLockArgs::new(object.clone(), true))?

object_move#

Move a drawing's points · tool object_move

scope: labplan: plussince 1.0.0

Moves some of a drawing's points in time, in price or both, as a drag of its handles does. A locked drawing is not moved. Answers the drawing.

Declaration

client.drawing()
pub fn object_move(&self, args: DrawingObjectMoveArgs) -> Result<Value

Parameters

NameTypeWhat it is
objectimpl Into<String>required
anchorsimpl Into<Value>required

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the drawing.

Example

client.drawing().object_move(mcp::DrawingObjectMoveArgs::new(object.clone(), "…"))?

object_place#

Draw on a chart · tool object_place

scope: labplan: plussince 1.0.0

Places a drawing of one kind at the given points, as a person's press and drag places it; every chart type takes one. With pane, in that study's own pane, its prices the study's values (every kind; the two regression channels fit the study's line there). The drawing carries this agent as its author, which the person sees and can remove it by. Answers the chart and the drawing with its uri.

Declaration

client.drawing()
pub fn object_place(&self, args: DrawingObjectPlaceArgs) -> Result<Value

Parameters

NameTypeWhat it is
chartimpl Into<String>requiredThe chart's uri.
kindimpl Into<String>requiredThe drawing's kind, as a chart's setup names it (setup.objects[].kind): trend_line, horizontal_line, rectangle, fib_retracement, text_label,...
anchorsimpl Into<Value>requiredIts points, as many as the kind has, in placement order.
colourVec<i64>optional[r, g, b] or [r, g, b, a]; the colour a new drawing starts in when absent.
levelsimpl Into<String>optionalThe kind's level list, as the properties window takes it: "0, 23.6, 38.2, 50, 61.8, 100".
panei64optionalA study of this chart that draws its own pane (an oscillator, by its id in the chart's answer): the drawing stands there and its prices are that study's values. Absent: the price pane.
textimpl Into<String>optionalA text drawing's label, or a shape's name.

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",
  "detached": false,
  "market": "SYN-DOCS",
  "object": {
    "drawing": {
      "anchors": [
        {
          "price": 0.96743,
          "t_ms": 1791885600000
        },
        {
          "price": 0.96839,
          "t_ms": 1791892800000
        }
      ],
      "author": "agent:1",
      "color": [
        226,
        229,
        234,
        255
      ],
      "fill": false,
      "kind": "trend_line",
      "levels": [],
      "param": 0.0,
      "style": "solid",
      "text": "",
      "width": 1.0
    },
    "id": 1,
    "uri": "bentrix://lab/lab-1/bench/bench-2/chart/chart-5/object/1"
  },
  "setup": {
    "applied": "close",
    "candles": {
      "falling_body": [
        239,
        83,
        80
      ],
      "falling_border": [
        239,
        83,
        80
      ],
      "rising_body": [
        38,
        166,
        154
      ],
      "rising_border": [
        38,
        166,
        154
      ]
    },
    "colour_defaults": 2,
    "forecast": {
      "arrival_marks": false,
      "band_opacity": 0.18000000715255737,
      "coarser": "spanned",
      "diff": null,
      "element_on_time": "auto",
      "equivolume_width": "by_volume",
      "finer": "folded",
      "hidden": [],
      "keep_after_realized": {
        "horizons": 1
      },
      "on_profile": "forecast_session",
      "opacity": 0.6000000238418579,
      "other_rule": "derived",
      "past_newest": "clock_time",
      "readout": true,
      "room": "forecast",
      "samples_drawn": 32,
      "show": true,
      "time_on_elements": "derived",
      "trail": 0,
      "uncertainty": "fan"
    },
    "frame_colour": [
      163,
      169,
      180
    ],
    "grid": {
      "choice": "automatic",
      "colour": [
        69,
        75,
        87
      ],
      "step": 1.0
    },
    "layering": "candles-in-front",
    "magnet": {
      "on": true,
      "px": 10.0
    },
    "news": {
      "currencies": "market",
      "shown": "off"
    },
    "objects": [
      {
        "anchors": [
          {
            "price": 0.96743,
            "t_ms": 1791885600000
          },
          {
            "price": 0.96839,
            "t_ms": 1791892800000
          }
        ],
        "author": "agent:1",
        "color": [
          226,
          229,
          234,
          255
        ],
        "fill": false,
        "id": 1,
        "kind": "trend_line",
        "levels": [],
        "param": 0.0,
        "style": "solid",
        "text": "",
        "uri": "bentrix://lab/lab-1/bench/bench-2/chart/chart-5/object/1",
        "width": 1.0
      }
    ],
    "objects_bar": false,
    "outputs": {
      "hidden": [],
      "zones": false
    },
    "period_colour": [
      69,
      75,
      87
    ],
    "periods": true,
    "price": {
      "ask": true,
      "bid": true,
      "countdown": true,
      "last": "without_pair",
      "prev_close": false,
      "session_hl": false,
      "spread_band": false,
      "trade_chips": true
    },
    "shift_mark": true,
    "shift_parked": 0.0,
    "studies": [
      {
        "applied": "close",
        "author": "agent:1",
        "convention": "mt5",
        "id": 1,
        "kind": "rsi",
        "settings": {
          "period": 21,
          "shape": "period"
        }
      }
    ],
    "style": {
      "activity": {
        "volume_per_bar": 1000
      },
      "bars": {
        "falling": [
          239,
          83,
          80
        ],
        "hlc": false,
        "rising": [
          38,
          166,
          154
        ],
        "thickness": "px1"
      },
      "candles": {
        "bodies": "filled",
        "equivolume": false,
        "ha_smoothing": 1,
        "hollow": "both",
        "volume_width": [
          0.15000000596046448,
          0.8999999761581421
        ],
        "wick": "border"
      },
      "elements": {
        "bodies": "filled",
        "down": [
          239,
          83,

Example

client.drawing().object_place(mcp::DrawingObjectPlaceArgs::new(chart.clone(), "trend_line", "…"))?

object_set_levels#

Set a drawing's levels · tool object_set_levels

scope: labplan: plussince 1.0.0

Sets the level list of a drawing that has one (a Fibonacci, a Gann fan), read as the properties window reads it; a list it could not read is refused in its words and changes nothing. Answers the drawing.

Declaration

client.drawing()
pub fn object_set_levels(&self, args: DrawingObjectSetLevelsArgs) -> Result<Value

Parameters

NameTypeWhat it is
objectimpl Into<String>required
levelsimpl Into<String>requiredThe level list as the properties window takes it: "0, 23.6, 38.2, 50, 61.8, 100".

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the drawing.

Example

client.drawing().object_set_levels(mcp::DrawingObjectSetLevelsArgs::new(object.clone(), "…"))?

object_undo#

Take back the last drawing step · tool object_undo

scope: labplan: plussince 1.0.0

Takes back the chart's last drawing step — a deletion, or the properties' changes — as Ctrl+Z on the chart does. Answers the chart and which drawing came back, if one did.

Declaration

client.drawing()
pub fn object_undo(&self, args: DrawingObjectUndoArgs) -> Result<Value

Parameters

NameTypeWhat it is
chartimpl Into<String>requiredThe chart's uri.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the chart and which drawing came back, if one did.

Example

client.drawing().object_undo(mcp::DrawingObjectUndoArgs::new(chart.clone()))?

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