Integration

The four trading modes and what each enables, the props every host screen passes, the algorithmic cockpit contract, and how the addon is resolved at build time.

5 min readUpdated 3 August 2026modes, props, algo, build

The same chart component renders on four different screens, and it presents differently on each because of one prop: the trading mode. Everything else — which overlays exist, how tall the toolbar is, whether a click can place an order — follows from that.

Trading modes

Feature binary spot futures algo
Order countdown Yes
Expiry lines Yes
Profit and loss zones Yes Yes Yes
Pulse animation Yes Yes
Order markers Yes Yes Yes Yes
Take-profit / stop-loss lines Yes Yes Yes
Fill indicators Yes Yes Yes
Replay, signals, multi-timeframe Yes Yes Yes Yes
Strategy levels and bot cockpit Yes
Limit-order alerts Yes Yes Yes Yes
One-click trading Yes
Compact layout Yes Yes

Order types offered per mode:

  • binaryRISE_FALL, HIGHER_LOWER, TOUCH_NO_TOUCH, CALL_PUT, TURBO
  • spot and futuresMARKET, LIMIT, STOP, STOP_LIMIT
  • algoMARKET, LIMIT, STOP_LIMIT

Layout follows the same split. Binary and the bot terminal own the whole viewport, so they get a 36px toolbar, a 40px drawing rail and indicator panels between 80 and 150px. Spot and futures share the screen with an order book and an order form, so they run compact: 32px toolbar, 36px rail, panels between 60 and 120px.

The feature table is an exhaustive record keyed by mode, so a new mode does not compile until it has a block of its own. That is deliberate — a mode with no feature block would silently inherit binary's, and draw expiry countdowns and win/loss markers over a strategy that has neither.

Props the host passes

The chart is mounted through a switcher component that also owns the TradingView fallback, so most screens never touch these directly. They are listed because they are the whole contract.

Prop Meaning
symbol BASE/QUOTE, or anything normalisable to it
timeFrame One of the nine supported timeframes
tradingMode binary, spot, futures or algo. Defaults to binary
marketType spot, eco, futures or forex — selects the data source
theme dark or light, passed from the host so a theme change re-renders
decimals Price precision, taken from the market's own metadata
currency Unit for money figures in overlays
orders Binary orders to draw
spotOrders Spot or futures orders to draw
algoState One bot's complete chart state
isMarketSwitching Suppresses the empty state while the host swaps markets
isMobile Enables pinch-to-zoom and touch panning
callbacks onReady, onPriceUpdate, onTimeFrameChange and the rest

Callbacks for placing orders (onPlaceOrder, onPlaceSpotOrder) and for driving a bot (onBotControl, onBotRefresh) all delegate to the host. The chart never calls a trading endpoint itself.

<ChartSwitcher
  symbol={bot.symbol}
  timeFrame={timeFrame}
  marketType="eco"
  isAlgoContext
  algoState={state}
  showAlgoLayers
  onBotControl={control}
  onBotRefresh={refresh}
/>

Overlay panels used to take a darkMode boolean and branch on it. They now read theme classes instead. The prop is still accepted so existing integrations keep working untouched — it simply does nothing. Remove it when convenient; do not rely on it.

The algorithmic cockpit

Algorithmic mode turns the chart from a place you trade from into a window onto a strategy that is already trading. It is supplied by GET /api/trading-bot/bot/{id}/chart-state, which returns the bot summary, its levels, its orders, its trades, its open position, the indicators it evaluates, and the current price.

Levels

Ten kinds of horizontal line, each named for what it means rather than which strategy produced it — two strategies that both place a stop draw the same thing:

GRID_BUY · GRID_SELL · BAND_UPPER · BAND_LOWER · AVG_ENTRY · TAKE_PROFIT · STOP_LOSS · TRAILING_STOP · PEAK · ENTRY_TRIGGER

Each carries one of four states, and each reads differently on the chart:

State Means
ARMED The bot is waiting at this price right now
FILLED The bot holds inventory from this level
TRIGGERED Price has crossed it and the bot has acted, or is about to
INACTIVE Drawn for context but not currently live

A rung backed by a live resting order carries a stem, so an intention is distinguishable from an instruction.

Keeping a dense ladder readable

A forty-rung grid would stack forty overlapping chips. Past 14 levels the chart stops labelling everything and labels only the band edges, the rungs actually holding inventory, and the six nearest the current price. Levels are capped at 240 and trade legs at 120, so a bot that has been running for a month cannot slow the chart down.

The operating band is captioned GRID RANGE, and becomes OUT OF RANGE — BOT IDLE when price leaves it. A bot that is running but has nothing to do says so.

The cockpit panel

A floating HUD, opened automatically the first time you enter the mode and reopenable from the Bot button in the toolbar. It reports status, paper or live, profit and loss, open position, win rate, trade count, traded volume, allocated, in-use and available capital, current drawdown, and the last engine error with how many times it has happened.

The number that justifies the panel is the heartbeat:

  • "3s ago" while ticks arrive.
  • "No ticks yet" before the first one.
  • "Stalled · 4m ago" once a bot that claims to be running has gone 30 seconds without a tick.

A silently dead bot is the failure this exists to surface.

Controls

start · pause · resume · stop · close

close flattens every open position at market. It is not a lifecycle verb, and it is offered whenever a position exists — including on a stopped bot, because a stopped bot can still be holding inventory and flattening it by hand is the most common thing to want next.

Stop and Close ask twice. Both relabel to Confirm? on the first click and disarm themselves after 4 seconds, so a stray click cannot kill a bot or market-sell a position. No control can fire twice while the first call is still in flight.

One-click trading is disabled and price alerts cannot place orders. A hand-placed order here would be attributed to the bot's profit and loss and corrupt the very numbers the view exists to report.

Socket and poll

The bot terminal subscribes to the bot's own WebSocket channel and polls chart-state every 15 seconds. That is not redundancy for its own sake: the broadcast registry is per backend thread, so on a worker-thread deployment an engine event raised on one thread does not reach a socket held by another. The poll is what keeps the terminal correct there. Build any integration the same way — treat the socket as an accelerator, not the source of truth.

How the addon is resolved

Chart Engine is optional, and the resolution happens entirely at build time.

  1. The build checks the filesystem. If frontend/components/(ext)/chart-engine contains either the component source or a built dist/index.js, the addon counts as present.

  2. That boolean becomes a public environment variable, NEXT_PUBLIC_HAS_CHART_ENGINE, baked into the client bundle. The switcher reads the constant, never the filesystem.

  3. A module alias redirects the stub import to the real package when it is present. Every screen imports from a stub path that always exists, so an install without the addon builds cleanly and gets a component that renders null.

  4. The package's entry point is dist/index.js, so source edits are invisible until the addon is rebuilt with pnpm build:chart-engine. The build also emits the type definitions, which is what makes a misspelled prop a compile error instead of silence.

The consequence for operators is in Install: the frontend must be rebuilt after the files land, or nothing changes.

Which screen passes what

Screen Trading mode Market type
Binary trade page binary spot
Classic trade page spot or futures spot, eco or futures
Trading Pro workspace spot or futures spot, eco or futures
Bot terminal algo eco, always

Algorithmic context is checked first when the mode is resolved. A bot terminal is also viewing an Ecosystem spot market, so testing for spot first would capture it and lose the cockpit.

Next

  • Data sources — what each market type actually calls.
  • Performance — the cost of the overlays this page enables.