📈 pine_ta
TradingView's Pine Script indicators, in pure pandas and numpy
No TA-Lib. No C compiler. Just pip install and go.
💡 Why pine_ta?
I've spent years turning clients' TradingView indicators into Python. The same problems kept coming up: TA-Lib needs C libraries that break installs, and most Python libraries give numbers that don't match the chart. pine_ta fixes both.
- Pine Script formulas. Uses the same RMA, EMA, and warm-up rules as TradingView, so early bars are empty instead of fake numbers.
- Pure Python. Only pandas and numpy. Installs anywhere.
- Works with your data.
Close,close,close_price,c, or yfinance's two-level columns all just work. - Never touches your DataFrame. Every call returns a new result.
- Clear errors. Missing or text columns tell you exactly what's wrong and how to fix it.
📦 Installation
pip install pine_ta
Requires Python 3.10+.
🚀 Quick Start
import yfinance as yf
import pine_ta
df = yf.download("AAPL", period="1y", auto_adjust=False, multi_level_index=False)
df["rsi"] = df.pine.rsi(14)
df["macd"], df["signal"], df["hist"] = df.pine.macd()
df["atr"] = df.pine.atr(14)
Importing pine_ta adds .pine to every DataFrame. That's it.
🧩 Column Names
pine_ta finds your columns no matter how they're named:
| Field | Works with |
|---|---|
| close | close, Close, CLOSE, close_price, Close Price, c, last, price |
| open, high, low | Open, open_price, o, h, l, and more |
| volume | volume, Volume, vol, v, total_volume |
Use a different column with an override:
df.pine.rsi(14, close="Adj Close")
⚠️
Adj Closeis never picked by default. TradingView uses the normal close, so pine_ta does too.
🛑 Helpful Errors
>>> df.drop(columns=["Close"]).pine.rsi()
ColumnNotFoundError: rsi needs: close. Your DataFrame has: Adj Close, High, Low,
Open, Volume. Rename the column or pass it directly, e.g. df.pine.rsi(close='YourColumnName').
>>> df.pine.rsi() # when Close was loaded as text
ColumnTypeError: rsi needs numbers, but 'Close' is str.
Convert it first, e.g. df['Close'] = pd.to_numeric(df['Close']).
Catch every library error with one line:
try:
df.pine.rsi()
except pine_ta.PineTAError as e:
print(e)
📊 Indicators
| Indicator | Method | Pine Script | Needs | Returns |
|---|---|---|---|---|
| RSI | rsi() |
ta.rsi |
close | Series |
| MACD | macd() |
ta.macd |
close | macd, signal, hist |
| ADX | adx() |
ta.dmi |
high, low, close | Series |
| ATR | atr() |
ta.atr |
high, low, close | Series |
| True Range | true_range() |
ta.tr |
high, low, close | Series |
| Bollinger Bands | bollinger_bands() |
ta.bb |
close | basis, upper, lower |
| Keltner Channels | keltner_channels() |
ta.kc |
high, low, close | middle, upper, lower |
| CCI | cci() |
ta.cci |
high, low, close | Series |
| Stochastic | stochastic() |
ta.stoch |
high, low, close | %K, %D |
| Williams %R | williams_percent_range() |
ta.wpr |
high, low, close | Series |
| Rate of Change | roc() |
ta.roc |
close | Series |
| Momentum | momentum() |
ta.mom |
close | Series |
| On-Balance Volume | obv() |
ta.obv |
close, volume | Series |
| Money Flow Index | mfi() |
ta.mfi |
high, low, close, volume | Series |
| Relative Volatility Index | rvi() |
built-in RVI | close | Series |
| Stochastic Momentum Index | smi() |
built-in SMI | high, low, close | smi, signal |
| Awesome Oscillator | awesome_oscillator() |
built-in AO | high, low | Series |
| MA Envelope Slope | ma_envelope_slope() |
custom | close | float |
| Performance Index | performance_index(benchmark_df) |
custom | date, close, symbol | Series |
| Comparative Relative Strength | crs(benchmark_df) |
custom | date, close, symbol | Series |
See them all in code:
pine_ta.list_indicators()
help(df.pine.rsi)
🔧 Plain Functions
Moving averages work on any Series, including other indicators:
from pine_ta import ema, rma, wma, vwma, stdev
fast = ema(df["Close"], 12)
smooth_rsi = rma(df.pine.rsi(14), 5)
➕ Add Your Own Indicator
Write one function and register it. It gets column lookup, errors, and df.pine for free:
import pine_ta
@pine_ta.register(("high", "low"))
def hl2(df):
return (df["high"] + df["low"]) / 2
df.pine.hl2() # works with "High", "LOW", "h", ...
🧪 Development
git clone https://github.com/huzaifazahoor/pine_ta.git
cd pine_ta
python -m venv .venv
.venv\Scripts\Activate.ps1 # Windows
source .venv/bin/activate # macOS / Linux
pip install -e ".[dev]"
pytest
Found a value that doesn't match TradingView? Open an issue with the symbol, timeframe, date, and both values.
🗺️ Roadmap
- Test values against exported TradingView chart data
- More indicators: Supertrend, Ichimoku, VWAP, Parabolic SAR
- Multi-ticker support
👤 Author
Huzaifa Zahoor · Senior Software & Data Engineer building stock market tools
MIT License · If pine_ta saves you time, give it a ⭐
Metadata
Release files for pine-ta 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pine_ta-0.2.0.tar.gz | 21.1 kB | With provenance | Details for pine_ta-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pine_ta-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pine_ta-0.2.0-py3-none-any.whl |
Total release size: 41.6 kB
Release files / pine_ta-0.2.0.tar.gz
| Download URL | pine_ta-0.2.0.tar.gz |
|---|---|
| Size | 21.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9671438a91c24f1dbcdf868944d64c240585ea60233d3c690c6aea8ac000a1d3
|
|
BLAKE2b-256 checksum How to use checksums |
46c0df6e47c622fb7a99ac995e4ac82f9e2e7abf3a7a1104635bd83d3685613d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logRelease files / pine_ta-0.2.0-py3-none-any.whl
| Download URL | pine_ta-0.2.0-py3-none-any.whl |
|---|---|
| Size | 20.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a95b559aff09e624e7510c8fe31974551b9a51c12c0c7d296cf4c25f7615bd5
|
|
BLAKE2b-256 checksum How to use checksums |
ca802239d11a93b4cdc1c6dfeff24e27dcbbcbbc9dfc220c86919068643065e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logSecurity for pine-ta 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pine_ta-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.