Trading
Trading overview
Max edition: a trading panel, one-click BUY / SELL on the chart, draggable SL / TP lines and a position history.
Out of the box everything runs on a paper account (balance 10,000) that fills orders at the live price of your datafeed: market, limit and stop orders, stop loss / take profit, partial history with open and close prices. It's saved per persistKey.
To trade for real, keep the same UI and connect it to your broker with two callbacks:
| Prop | What it does |
|---|---|
onPlaceOrder(order) | Approve, reject or forward every order before it's filled — Broker integration. |
onTradeEvent(event) | Every fill, close, cancel and modification — Trade events. |
From code you can also place and close orders with the chart API (api.placeOrder, api.closePosition, api.getPositions…).