top of page

AmiBroker to Broker Execution in India (Symphony XTS, SEBI 2026)

3 days ago
10 min read


AmiBroker to Broker Execution in India (Symphony XTS, SEBI 2026)

Introduction


Many Indian trading desks still generate signals in AmiBroker and route them to the broker through a desktop bridge someone set up years ago. That worked when automation sat in a grey area. It does not hold up in 2026.

SEBI's retail algo framework now makes the broker accountable for every automated order. Orders must carry an Algo-ID, arrive from a whitelisted static IP and pass RMS checks. At the same time, desks want something a bridge rarely gives them: proof that every signal was sent once, tracked to a final state, and never resent blindly after a timeout.


This guide is for the people who have to build that path: broker CTOs, IT heads and dealing-desk leads. It covers how to get signals out of AmiBroker, how to route them through Symphony XTS (the trading API many Indian brokers run), how to meet the static IP and Algo-ID rules, and how to make the system safe to leave running. It draws on the architecture we use for trading automation in production.


1. Why brokers are rebuilding the signal-to-order path in 2026



Every automated order has an identity. Each order now carries an Algo-ID, and the broker carries accountability for the algos it onboards. For direct API users within 10 orders per second, a Generic Algo ID prescribed by the exchanges can be used instead of individual strategy approval.



Sessions are short-lived. Brokers point to static IP requirements, daily logouts and 2FA as the main operational changes for API users.



For an IT team this becomes a concrete list: tag orders with the right Algo-ID, send them from a fixed and documented egress IP, renew sessions every day without manual steps, apply limits before the broker's RMS ever sees the order, and keep an audit trail that shows who sent what and when. A desktop bridge on a trader's PC struggles with almost all of these.


Rules change. Check the current SEBI circular and your exchange's implementation standards before relying on any detail in this section.


2. The architecture at a glance


The safest design puts one small service between AmiBroker and the broker API, and makes that service responsible for every decision about an order.


(Diagram: AmiBroker → Signal intake → Validation and limits → Order manager with reconciliation → Symphony XTS → Exchange. Below the middleware: Audit store and Admin console with alerts.)


Component

Job

Signal intake

Accepts signals from AmiBroker; checks the sender's token and IP; rejects malformed messages

Validation and limits

Blocks duplicates and stale signals; applies quantity, value, count and exposure limits; honours kill switches

Order manager

Sends orders, tracks every status update, reconciles anything uncertain before a retry

Broker connector

Handles XTS login, session renewal, order placement and the order-update stream

Audit store

Append-only record of every signal, decision, request, response and admin action

Admin console and alerts

Pause, resume and kill switches; limits; log search; alerts to email or chat


The middleware complements the broker's own RMS; it does not replace it. Its limits stop bad orders before they leave your network, which is cheaper and easier to explain than a rejection from the exchange.


3. Getting signals out of AmiBroker


AmiBroker does not place orders by itself. Historically an intermediate bridge or API, mostly provided by the stock broker, converts AmiBroker's buy and sell logic into orders. You have four options for getting a signal from AFL into your middleware.


Method

How it works

Strengths

Watch out for

HTTP POST from AFL

AFL calls an endpoint on your middleware

Simple; delivery is acknowledged; low latency on a LAN

Needs a recent AmiBroker version; secure the endpoint

File drop

AFL writes a JSON or CSV file; the middleware watches the folder

Survives a middleware restart; easy to replay in UAT

Polling delay; folder permissions

Plugin (DLL)

A C++ plugin built with AmiBroker's development kit

Lowest latency, tightest control

Highest build and maintenance cost

Broker or vendor bridge

Off-the-shelf bridge software

Fast to start

Limited validation, audit and control; one more vendor in the path


For most desks we recommend HTTP POST as the main channel and file drop as a tested fallback. Order placement over HTTP from AFL requires AmiBroker 6.39 or higher; older installs need a plugin or bridge.


Fire once per bar, then dedupe anyway


AFL re-runs on every chart refresh, so a naive script sends the same signal many times. Give every signal a deterministic ID (symbol, action, bar time), remember what has been sent using static variables, and let the middleware reject any repeat it still receives. A minimal sketch:


// Sketch only. Test against your AmiBroker version.// Assumes the signal is evaluated on the last completed bar.url = "http://10.0.0.5:8080/signals";token = "REPLACE_WITH_TOKEN";

if( LastValue( Buy ) ){barTime = DateTimeToStr( LastValue( DateTime() ) );sigId = Name() + "_BUY_" + barTime;

if( StaticVarGetText( "sent_" + sigId ) == "" ){body = "signal_id=" + sigId + "&symbol=" + Name() + "&action=BUY&bar_time=" + barTime;InternetSetHeaders( "Content-Type: application/x-www-form-urlencoded\r\nX-Auth-Token: " + token + "\r\n" );ih = InternetPostRequest( url, body );if( ih ){StaticVarSetText( "sent_" + sigId, "1", True );InternetClose( ih );}}}



What a signal message should contain


Field

Why it matters

signal_id

Deterministic, so a repeat is recognised

strategy_id

Ties the signal to strategy-level limits and kill switches

generated_at

Lets the middleware reject stale signals

exchange, segment, symbol

Mapped to the broker's instrument ID by the middleware

action, order type, price, quantity or lots

Validated against tick size and lot size

product

Intraday or carry-forward

schema_version

Lets the format evolve without breaking old AFL scripts


The middleware never needs your strategy logic, only these fields. That keeps the proprietary part of the strategy inside AmiBroker.


4. Symphony XTS in practice


Symphony Fintech's XTS is the trading API behind many Indian brokers. Motilal Oswal offers a Symphony XTS REST API, 5paisa promotes XTS for algo execution, and AlgoTest describes XTS as an independent API offered by many stock brokers in India. If your firm or your broker runs XTS, the patterns below apply.


Two APIs, one integration


XTS is a REST-based trading API with a Socket.IO streaming component, split into an interactive (trading) API for orders, positions and the order book, and a market data API for quotes and instruments. API keys are issued through Symphony Fintech's developer support team or your broker.


The order path, step by step


  1. Log in with the app key and secret; store the session token in memory, never in logs.

  2. Download the instrument master at the start of each day and map symbols to exchange instrument IDs.

  3. Place the order over REST, with your own order tag that links it back to the signal ID.

  4. Listen to the order stream over Socket.IO for acknowledgements, fills, rejections and cancellations.

  5. On any disconnect, reconnect, then pull the order book and trade book over REST to fill the gap.

  6. Renew the session before it expires, and log in again every trading day.


Questions to settle with your XTS provider early


  • Dealer vs investor login. Will the middleware place orders for one account, or for many client codes under a dealer login? This decides how client-wise allocation works.

  • Who stamps the Algo-ID: XTS, your OMS, or a field the middleware must send.

  • Rate limits, session lifetime and concurrent sessions.

  • Status and rejection codes, and what each one means.

  • UAT access: endpoints, credentials and a named technical contact.


Symphony also runs Presto, its OMS for automated trading; it announced APIs to access Presto-OMS and live data feeds. If your desk runs Presto rather than plain XTS, confirm which interface applies before you design anything.


5. Static IP and Algo-ID: patterns that survive failover


The static IP rule sounds simple until a server fails at 10:15 on an expiry day. Design for it from the start.


  • Send all broker traffic through one fixed egress IP, plus a registered backup. On-premise this is your firewall's public IP; in the cloud, a NAT gateway or reserved IP.

  • Create the session from the same IP that sends orders. Kotak Neo's guidance, for example, states that the session must be created from the same IP that is sending order requests.

  • Plan IP changes. With changes limited to once a week, a failover to an unregistered IP means no orders until it is registered.

  • Make the Algo-ID configuration, not code. Store it per strategy, show it in the audit log for every order, and check it before sending.

  • Test failover in UAT: kill the primary path mid-session and confirm orders resume from the backup IP with no duplicates.


6. Making it safe to run


Most trading-automation incidents are not strategy bugs. They are plumbing: the same order sent twice, a retry after a timeout that had actually filled, or a restart that forgot what was open. These five rules prevent most of them.


Rule 1: Validate in a fixed order


  1. Authenticate the sender (token and source IP).

  2. Check the schema: required fields and permitted values.

  3. Reject duplicates. Keep signal_id under a unique database constraint so a repeat is caught even across restarts.

  4. Reject stale signals: older than a configurable window, or timestamped in the future.

  5. Check the instrument, lot size and tick size.

  6. Check the session: segment open, inside permitted hours.

  7. Apply limits: per-order quantity and value, per-strategy daily count, per-instrument exposure, signals per minute.

  8. Check the kill switches.

  9. Forward the order, or reject it with a recorded reason.


Rule 2: A timeout is not a failure


When an order request times out, you do not know whether the broker received it. Retrying immediately is how duplicate orders happen. Mark the order UNKNOWN, query the broker's order book for your order tag, and only then decide:


  • Found: adopt its real state.

  • Not found after a settle period: mark it FAILED, then retry once under policy or alert a human.


Rule 3: Status only moves forward


Order updates can arrive late, twice, or out of order. Model the lifecycle as states (RECEIVED, REJECTED, QUEUED, SENT, UNKNOWN, ACKNOWLEDGED, PARTIALLY_FILLED, FILLED, BROKER_REJECTED, CANCELLED, FAILED) and allow only forward moves. A late "open" message must never reopen a filled order.


Rule 4: Kill switches at three levels

Switch

What it does

Who uses it

Global

Stops all new orders immediately; signals are still logged

Head of desk, risk

Per strategy

Pauses one strategy, leaves others running

Dealer, strategy owner

Automatic trip

Fires on repeated rejections, abnormal signal volume, or loss of the broker stream

The system, with an alert

Keep "pause intake" separate from "pause forwarding", so you can keep recording signals while blocking orders.


Rule 5: Restart into a safe state


On start-up, reload every order that is not in a final state, reconcile each against the broker, and stay paused until an operator resumes. Run one instance only. Two copies of the same service sending orders is a classic, expensive mistake.


7. Audit trail and UAT checklist


Log, with timestamps and in append-only form: every incoming signal; each validation decision and rejection reason; every outgoing request and broker reference; every status change, fill and rejection; authentication failures, disconnects and recoveries; every admin action, with before and after values.


Never log: API secrets, session tokens or passwords. Mask them at the logging layer, not in each call.


Test these in UAT before any live order:


  • The same signal sent 10 times creates one order

  • A stale signal is rejected with a clear reason

  • An expired session renews without a manual step

  • The broker stream drops mid-order and the gap is filled from the order book

  • A forced timeout after sending, then a restart: the order is reconciled, not resent

  • Each limit, when breached, blocks the order

  • Global and per-strategy kill switches stop orders within seconds

  • Failover to the backup static IP works

  • Every case above can be traced end to end in the audit log

  • No credentials appear anywhere in the logs


8. Buy a bridge or build middleware?


An off-the-shelf bridge is the right answer for a single trader with one account. A broker or desk running several strategies, many client codes, or orders it must explain to an auditor usually outgrows one.


Question

A bridge is usually enough

Build middleware

How many accounts or client codes?

One

Many, or client-wise allocation

Who answers to SEBI and the exchange for these orders?

The individual trader

The broker or desk

Do you need your own limits and kill switches?

Broker RMS is enough

Yes, per strategy and global

Do you need a full audit trail?

Basic logs are fine

Yes, searchable and append-only

What happens after a timeout?

Manual check

Automatic reconciliation

Where must it run?

Trader's PC or VPS

Your own servers, behind your firewall

Who owns the code?

The vendor

You


What drives the cost of a custom build: the number of broker APIs, whether client-wise allocation is needed, how much of the RMS logic sits in the middleware, the depth of audit and reporting, and how much documentation and knowledge transfer your IT team wants. A phased plan that starts with a paid feasibility check, confirming the exact broker interface before any build, keeps the risk low for both sides.


Conclusion


SEBI's 2026 framework turned "connect AmiBroker to the broker" from a plug-in task into an engineering one. The parts that matter most are not the API calls. They are the controls around them: one signal, one order; no blind retries; a kill switch that works; and an audit trail that answers any question about an order.

If you are planning this for your desk or your clients, we can help you confirm feasibility against your broker's XTS setup before you commit to a build.




FAQs


Can AmiBroker send orders directly to a broker? 


Not on its own. AmiBroker generates signals; a bridge, plugin or middleware service turns them into broker orders. Recent versions can send HTTP requests from AFL, which makes a custom middleware connection straightforward.


What is Symphony XTS? 


XTS is Symphony Fintech's trading platform and API, used by many Indian brokers. It has an interactive API for orders and positions, and a market data API, with real-time streaming over Socket.IO.


Who assigns the Algo-ID under SEBI's framework? 


The broker is responsible for algos running through its platform, and orders carry an exchange-assigned Algo-ID. How the ID is stamped on an order depends on your broker's setup; confirm it with your broker and your XTS provider.


Do I need a static IP to trade through a broker API? 


Yes. API orders are accepted only from a static IP registered with the broker and mapped to your API keys. Plan a backup IP and test failover.


How do you prevent duplicate orders after a timeout? 


Treat a timeout as unknown, not failed. Check the broker's order book for your order tag before deciding whether to retry. Combine this with a unique signal ID so repeats from AmiBroker are rejected.


How long does a custom AmiBroker-to-XTS middleware take to build? 


It depends on scope: number of strategies, client-wise allocation, limits and documentation. A typical path is a short feasibility phase, then milestone-based development and UAT before any live order.


imgi_48_Arpan Desai Profile Photo (1).png

About Author 

Arpan Desai

CEO & FinTech Expert

Arpan brings 14+ years of experience in technology consulting and fintech product strategy.
An ex-PwC technology consultant, he works closely with founders, product leaders, and API partners to shape scalable fintech solutions.

 

He is connected with 300+ fintech companies and API providers and is frequently involved in early-stage architectural decision-making.

Rectangle 6067.png

Contact Us

Are you looking to build a robust, scalable & secure Fintech solution?
bottom of page