Custom indicators in Python¶
A LumiBot custom indicator is a small Python class that turns price bars,
and any outside data, into numbers you can chart, backtest and trade with.
The same class updates live one bar at a time, runs inside a backtest, runs
inside a live strategy on your own broker, and can use numpy, pandas, a
trained machine-learning model or any web API. LumiBot is free and open
source (GPL-3.0) and runs on your own computer with pip install lumibot.
This page answers the main questions in plain words. Each section links to a page with the full detail and tested code.
What a custom indicator can do¶
Capability |
In plain words |
|---|---|
Live updates |
Updates one bar at a time. A still-forming bar gets a value, then that work is thrown away so it never leaks into history. More: Stream an indicator live from a crypto exchange. |
Backtests |
The same class runs in a LumiBot backtest and only sees bars that existed at each moment. More: Using an indicator in a backtest. |
Live strategies |
The same class runs in a live or paper strategy on any broker LumiBot supports. More: Using an indicator in a live strategy. |
Streaming without a paid feed |
For crypto, a plain Python script can stream public exchange candles through CCXT with no API key. More: Stream an indicator live from a crypto exchange. |
Outside data |
An indicator can call any web API (for example a funding rate), using only data that existed at each bar’s time. More: Using outside data in an indicator. |
Machine learning |
Plain Python, so numpy, scikit-learn or a model file you trained all work. More: Indicator examples. |
Settings and outputs |
Declares settings people can change, the lines it draws, colors and guide lines. More: Indicator settings and outputs. |
Chart placement |
Draws on the price chart or in its own pane. More: On the price chart or in its own pane. |
TradingView numbers |
Built-in |
How an indicator works in one picture¶
bars (history, then live) your indicator you
------------------------- ---> update(bar, closed) ---> values per bar
open high low close volume keeps a small state {"rsi": 61.2}
closed=Truemeans the bar is finished. The indicator commits it.closed=Falsemeans the bar is still forming (a live tick). The indicator gives a value for it but throws its work away afterwards, so the forming bar never leaks into history. TradingView calls this “rolling back”.
Because each new bar costs one update, a live chart does not recompute all of history on every tick. To write one, start with Build your first custom indicator (about five minutes).
How LumiBot compares, in one table¶
A summary of what an indicator author can do in each tool. The full tables, plain-words notes and every source are on LumiBot indicators compared (checked October 25, 2026).
Product |
Language |
Outside web data |
Same code places live broker orders |
|---|---|---|---|
LumiBot |
Python |
Yes, inside the indicator |
Yes, inside a strategy on your broker |
TradingView |
Pine Script |
No |
Through alerts and webhooks to other services |
QuantConnect LEAN |
Python or C# |
Yes, in the algorithm (limits apply in their cloud) |
Yes, LEAN algorithms |
NinjaTrader 8 |
C# (NinjaScript) |
Possible with .NET classes, not supported by NinjaTrader |
Yes, NinjaScript strategies |
MetaTrader 5 |
MQL5 |
No; web requests are blocked in indicators |
Yes, Expert Advisors |
LuxAlgo Vela + PineTS |
Pine run in TypeScript |
No; the chart feeds the data |
No (paper trading) |
OpenMarket (wrun) |
TypeScript to WebAssembly |
Built-in feeds only |
No |
Frequently asked questions¶
What is a custom indicator in LumiBot?¶
A Python class that reads price bars one at a time and returns values, such as an RSI line or a channel. It declares its settings and outputs, so a chart knows how to draw it, and it works in backtests and live strategies without changes.
Is LumiBot free?¶
Yes. LumiBot is free and open source under GPL-3.0. Install it with
pip install lumibot. Nothing on these pages needs an account or a hosted
service.
Can an indicator use machine learning?¶
Yes. It is plain Python, so numpy, scikit-learn, LightGBM or a model file you trained all work. Indicator examples includes a small numpy classifier.
Can an indicator use data from outside the chart?¶
Yes. It can call any web API. Using outside data in an indicator shows a funding rate from a public exchange, done without look-ahead in backtests.
Can I get live indicator values without a paid data service?¶
For crypto, yes. Stream an indicator live from a crypto exchange streams public candles from an exchange through CCXT with no API key. Stocks need a data source or broker that provides them.
Will my indicator repaint?¶
Closed-bar values never change. A forming bar’s value can change until the
bar closes, which is why LumiBot labels it closed=False and never saves
it into history.
Does an indicator make money?¶
No tool can promise that. Indicators describe the past. Test any idea in a backtest and on a paper account first.
All indicator pages¶
Build your first custom indicator: write your first indicator.
Indicator settings and outputs: settings people can change, and what it draws.
On the price chart or in its own pane: on the price chart or its own pane.
Using an indicator in a backtest: use an indicator in a backtest.
Using an indicator in a live strategy: use it in a live strategy on your broker.
Stream an indicator live from a crypto exchange: live values from an exchange in plain Python.
Using outside data in an indicator: call a web API from an indicator.
Matching TradingView’s numbers: match TradingView’s numbers and convert Pine.
Indicator examples: five complete, tested examples.
LumiBot indicators compared: full comparison with TradingView, Vela, OpenMarket, NinjaTrader, MetaTrader and QuantConnect.
Reference: Building indicators (the full contract) and Indicators (the
self.indicatorsaccessor).