Short answer: Yes, but the NinjaTrader API is three different things: NinjaScript, the C# framework that runs only inside the NinjaTrader 8 desktop on Windows; ATI, which takes order commands from other programs through files or a DLL and, by NinjaTrader's own note, is not a full brokerage or market data API; and the REST and WebSocket Trade API, whose hosts still carry the Tradovate name. As of 5 November 2026 no official Python SDK was seen for any of them, and TradingView alerts reach the desktop only through software you add.
NinjaTrader API documentation is split across three sites, all read on 5 November 2026. The file sample below ran on synthetic alerts; NinjaTrader 8 was not available here, so nothing ran in the platform or on a Sim account. Futures carry leverage and automated orders can lose money quickly. Rules depend on your country, account types and API access vary, and no broker is recommended, ranked or linked with a referral.
Section 3 of TradingView's Terms of Use (opens in a new tab), read on 5 November 2026, licenses charts, alerts and webhooks for display-only use, lists automated trading and automated order generation among prohibited uses, and bars third-party products built for that purpose. That matters for any TradingView route below; it is a contract question between you and TradingView, so read the terms and take legal advice.
Does NinjaTrader have an API? Three answers
Yes, three of them, and where your code must run decides which.
| Item | NinjaScript | ATI | Trade and Market Data APIs |
|---|---|---|---|
| Language | C# | Any program that writes text files, or loads the ATI DLL | Any language with HTTP and WebSocket; Swagger definitions |
| Runs where | In-process, NinjaTrader 8 desktop, Windows | Your program, alongside the running desktop | Your own server, calling NinjaTrader's hosts |
| Market data | Live and historical | Files: none. DLL: last, bid and ask for a subscribed instrument | Quotes, depth and charts over a separate WebSocket host |
| Docs | NinjaScript (opens in a new tab) | Help guide (opens in a new tab) | Trade API (opens in a new tab) |
The developer site also lists Web Trader, for JavaScript tools, and an MCP server (opens in a new tab) for AI agents, neither covered here. NinjaScript does not run on the web platform, and NinjaTrader's blog (opens in a new tab) of 26 October 2026 says the new NinjaTrader Web, with TradingView-powered charts, became the default browser version on 20 October 2026. Those charts are not an alert route.
NinjaScript: C# inside the desktop
NinjaScript is the route for logic that lives in the platform: it compiles to code running in-process with direct access to data, charts, accounts and order submission.
You can write indicators, strategies, AddOns, drawing tools, bars types, chart styles and optimizers. The docs say to compile custom indicators in the NinjaScript Editor, even if you write them elsewhere. AddOns can reach further than strategies: the Account class (opens in a new tab) documents CreateOrder(), Submit(), Cancel() and account events. The desktop must be running, on Windows, and a fault in your code is a fault in your trading platform.
ATI: what the Automated Trading Interface does and does not do
ATI carries order commands from an outside program into the running desktop, and the help guide says plainly that it is not a full brokerage or market data API.
| Command | Effect |
|---|---|
PLACE, CHANGE, CANCEL | Place, change or cancel one order; PLACE can start an ATM strategy |
CLOSEPOSITION, REVERSEPOSITION, CLOSESTRATEGY | Act on one position or ATM strategy |
CANCELALLORDERS | Cancels all active orders across all accounts and broker connections |
FLATTENEVERYTHING | Cancels all active orders and flattens all positions across all accounts and connections |
Never let an incoming alert choose the last two. Turn the interface on under Tools, Options, Automated trading interface, where you also set the default account; a missing account in a command falls back to it. The file interface has its own failure points:
- Location and names. Files go in
My Documents\<NinjaTrader Folder>\incomingasoif*.txt. Reusing a name in rapid succession risks a lock and an unprocessed file, and the option Ignore duplicate OIF files drops repeats of a name within a session. - Move, do not copy. The guide warns that copying into
incomingcan cause locking. - Feedback is thin. State files appear in
outgoingonly for orders given an order ID, in the form state, filled amount, average price, and that folder is emptied when the platform restarts. The pages read describe no error file for a malformed line, and the DLL page points to the Log tab for errors, so treat a missing state file after a timeout as an unknown result and check the platform before you resend. - Instrument names. The NinjaScript docs give the full name form as ES 09-16; the ATI pages show ES 0914 Globex in a file name and say CLOSEPOSITION takes the name with the exchange. Confirm the form on Sim.
Hypothetical example. PLACE;Sim101;MES 12-26;BUY;1;MARKET;;;DAY;;alert-0001;; reads, in the documented order: command, account, instrument, action, quantity, order type, limit price, stop price, time in force, OCO ID, order ID, strategy, strategy ID. If it works, outgoing\alert-0001.txt would hold a line such as Filled;1;5000.25; the state definitions page (opens in a new tab) spells states that way, and the file's exact spelling was not confirmed.
The DLL functions (opens in a new tab) give richer feedback, including OrderStatus(), MarketPosition() and MarketData(). One trap from the initialization page (opens in a new tab): the interface binds to the first account name used, so if you start with the default account by passing an empty string, later calls naming that account return invalid information.
NinjaTrader API Python: what exists
No official Python SDK was seen on 5 November 2026: the Trade API points to JavaScript and C# examples, NinjaScript is C#, and Python reaches the desktop as a program writing ATI files or loading the DLL, or through custom C# you add.
For the REST route, the API product page (opens in a new tab) says the Swagger definitions can generate code in nearly any language; that was not run here. The DLL route was not run either. Its page names both NTDirect.dll and NinjaTrader.Client.DLL, and a NinjaTrader support reply of July 2023, read only in search results because the old forum no longer opens, says only NinjaTrader.Client.dll is usable from 8.0.28.0, so confirm with support. The file route needs only the standard library, tested on 5 November 2026 with Python 3.11 in a temporary folder:
import os, re
from pathlib import Path
ACCOUNT = "Sim101" # stay on the simulation account while testing
LIMITS = {"MES 12-26": 2} # your instruments and maximum quantities (hypothetical)
def place_line(alert):
"""Build one PLACE line. Only PLACE is ever built."""
instrument, qty = alert["instrument"], int(alert["qty"])
action = alert["action"].upper()
if action not in ("BUY", "SELL"):
raise ValueError(f"bad action {action}")
if not 1 <= qty <= LIMITS.get(instrument, 0):
raise ValueError(f"{instrument} qty {qty} is outside your limits")
order_id = alert["id"]
if not re.fullmatch(r"[A-Za-z0-9_-]{1,40}", order_id):
raise ValueError("bad order id")
fields = ["PLACE", ACCOUNT, instrument, action, str(qty), "MARKET",
"", "", "DAY", "", order_id, "", ""]
return ";".join(fields)
def submit(line, seq, root):
"""Move the finished file into incoming/; never copy."""
root = Path(root)
tmp = root / f"oif{seq}.tmp"
tmp.write_text(line + "\n", encoding="ascii")
os.replace(tmp, root / "incoming" / f"oif{seq}.txt")
def order_state(order_id, root):
"""Read outgoing/<orderId>.txt: state;filled;average price. None until it exists."""
path = Path(root) / "outgoing" / f"{order_id}.txt"
if not path.exists():
return None
state, filled, avg = path.read_text(encoding="ascii").strip().split(";")
return state, int(filled), float(avg)Output with synthetic alerts and a state file:
PLACE;Sim101;MES 12-26;BUY;1;MARKET;;;DAY;;alert-0001;;
state before fill: None
state after a synthetic outgoing file: ('Filled', 1, 5000.25)
refused: bad action FLATTENEVERYTHING
refused: MES 12-26 qty 9 is outside your limits
refused: bad order idThis proves the text format against the documented field order, not the platform's behavior. Run it on Sim first and keep account and instrument limits outside the alert. The docs require a unique order ID but do not say what a repeat does, so keep your own duplicate check; the wider test plan is in how to test trading bots.
TradingView to NinjaTrader: routes that can be built
The desktop documents no inbound webhook, so a TradingView webhook has to land on software you add, and the choice is about where the public endpoint sits.
| Route | How it works | Main risk |
|---|---|---|
| Receiver on the same Windows machine | Accepts the webhook and writes OIF commands | A public port on the machine that holds your trading platform |
| Public relay plus local agent | A small server queues alerts; a local agent collects them outbound and writes OIF commands | Delay and a queue to keep healthy |
| NinjaScript AddOn | C# inside the platform collects alerts and calls Submit() | Your network code shares the platform's process |
| Vendor app | The Ecosystem directory lists webhook automation products | A third party in your order path; not assessed here |
TradingView sends only to ports 80 and 443, requires two-factor authentication and cancels a request after 3 seconds, so reply first and write the file afterward; the pattern is in TradingView webhook bot.
Clicking orders on the chart is separate: NinjaTrader's prop guide (opens in a new tab) of 12 August 2026 shows NinjaTrader in TradingView's broker list, and no page read describes alerts placing orders through that link.
The REST route: Trade API in short
The Trade API suits server-side software with no Windows desktop and is separate from NinjaScript and ATI.
docs.ninjatrader.com/api holds the newer pages. Requests go to hosts such as demo.tradovateapi.com, and market data uses its own token and WebSocket host. Access requirements, reported fees, rate limits and the license are covered in TradingView to Tradovate, and general order handling in broker API integration.
NinjaScript developer: what to specify before hiring
Hire against a written rule document and a list of deliverables, with the source code as the first item. Fincode sells custom trading software, so this guide is not neutral on that point.
| Item | What to require | Why |
|---|---|---|
| Source or assembly | Source files in the contract, not only a DLL | The export page (opens in a new tab) describes source files others can edit and assemblies that hide the code, so a DLL alone leaves you unable to fix or move it |
| Protection and licensing | Who holds any Agile.NET protection or vendor license, and what happens if the seller disappears | User-based licensing (opens in a new tab) ties a product to your NinjaTrader login under the vendor's control |
| Acceptance tests on Sim | Restart with an open position, partial fill, lost connection, contract roll, kill switch | They test behavior, which a developer can answer for |
Red flags: profit screenshots or backtest returns offered as proof; a promised win rate; compiled files only, with no way to get the source; a request for your login or for control of your account. The Ecosystem (opens in a new tab) site carries the NFA Rule 2-29(c) warning that hypothetical results have inherent limitations and may be prepared with hindsight, so judge the software, not the equity curve.
The Ecosystem's programming services category (opens in a new tab) showed 67 listings on 5 November 2026; no statement of how they are vetted was seen, and listing is not an endorsement here.
Fincode quotes only through its algorithmic trading page, from rules you wrote, and supplies no strategies. That page is written around crypto trading bots and no prior NinjaScript project is claimed, so ask whether your case fits.
Which rules apply to automated NinjaTrader orders?
Your country, your broker's terms and any prop firm's rules apply whichever route you choose, and none of the code above changes them.
- One account, one person. These routes suit your own account and your own rules. Sending one alert to other people's accounts can amount to copy trading or account management, which can be licensed activity, and the API license (opens in a new tab) of September 2026 bars an integration from controlling customer accounts.
- Prop firms. Their rules bind you, so ask before automating.
- Readers in Turkey. Leveraged FX with foreign firms falls under separate rules: the Capital Markets Board (SPK) said on 23 February 2023 (opens in a new tab) that residents may carry out such trades only through firms it has authorized, and offering them without authorization is a crime under Article 109(2) of Law No. 6362 (opens in a new tab). Article 99(4) lets SPK block such sites, and Communiqué III-37.1 (opens in a new tab) Articles 9 and 27 define activity aimed at residents and cap leverage at authorized firms. Article 9 reaches any investment service from a firm abroad, but no text read settles exchange-traded futures through a foreign broker, so take advice.
Frequently asked questions
Does NinjaTrader have a Python API?
No official Python SDK was seen on 5 November 2026. Python can write ATI order files or call the REST Trade API with generated or hand-written code; the ATI DLL route was not tested here.
Does NinjaScript run on Mac or in NinjaTrader Web?
The NinjaScript overview read on 5 November 2026 says it runs only in the NinjaTrader 8 desktop application on Windows and is not used for the web trader.
Can TradingView alerts trigger NinjaTrader orders?
Only through software you add, such as a receiver that writes ATI files or an AddOn, because no inbound webhook is documented for the desktop. TradingView's terms restrict this use, so read them first.
What should a NinjaScript developer deliver?
Source files, a build you can compile yourself, a Sim test report covering failures, and written notes on any licensing or protection. Results of trading are not a deliverable anyone can promise.
Sources
- NinjaTrader Developer Docs: NinjaScript overview (opens in a new tab)
- NinjaTrader 8 Help Guide: Automated Trading Interface (ATI) (opens in a new tab)
- NinjaTrader 8 Help Guide: Order Instruction Files (OIF) (opens in a new tab)
- NinjaTrader 8 Help Guide: Commands and Valid Parameters (opens in a new tab)
- NinjaTrader 8 Help Guide: Information Update Files (opens in a new tab)
- NinjaTrader 8 Help Guide: Automated trading interface settings (opens in a new tab)
- NinjaTrader 8 Help Guide: DLL Interface (opens in a new tab)
- NinjaTrader Developer Docs: Instrument FullName (opens in a new tab)
- NinjaTrader Developer Docs: Developing Outside of the NinjaScript Editor (opens in a new tab)
- NinjaTrader Developer Docs: Protection DLL Security (opens in a new tab)
- NinjaTrader Developer Docs: Market Data API, Authentication and Access (opens in a new tab)
- NinjaTrader Developer Community: API product page (Swagger, code generation) (opens in a new tab)
- TradingView: How to configure webhook alerts (opens in a new tab)
- TradingView: Terms of Use, section 3 (read 5 November 2026) (opens in a new tab)
- SPK (Capital Markets Board): Press notice on unauthorized leveraged transactions, 23 February 2023 (Turkish) (opens in a new tab)
This guide is general information about software and markets, not investment, legal or tax advice. Automated trading can lose money, past or backtested performance does not guarantee future results, and the rules that apply depend on your jurisdiction and your exchange's terms. Sources, checks and corrections: see the editorial policy.