# TradingView Indicators
[](https://app.codacy.com/gh/m-marqx/TradingView-Indicators/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[](https://www.python.org/downloads/)
[](https://pypi.org/project/tradingview-indicators/)
> A production-ready Python library for accurate financial technical analysis indicators, engineered to match TradingView platform standards.
[π§π· VersΓ£o em PortuguΓͺs](https://github.com/m-marqx/TradingView-Indicators/blob/main/readme%20-%20pt-br.md)
## π― Overview
**TradingView Indicators** is an open-source Python library that provides highly accurate implementations of technical analysis indicators used in financial markets. Built with data engineering best practices, this library addresses critical accuracy issues found in existing solutions like TA-Lib and pandas-ta.
### Key Features
- β
**Accurate Calculations** - Values precisely match TradingView platform standards
- β‘ **Optimized Performance** - Vectorized operations using NumPy and Pandas for processing 1M+ data points
- π§© **Modular Architecture** - Clean, maintainable code following SOLID principles
- π§ͺ **Comprehensive Testing** - 12+ test suites ensuring reliability and accuracy
- π§ **Type-Safe** - Full type hints support for better IDE integration
## π¦ Installation
Install via pip:
```bash
pip install tradingview-indicators
```
### Requirements
- Python 3.11+
- fastdtw >= 0.3.4
- numpy >= 2.3.4
- pandas[performance] >= 2.3.3
- pytest >= 8.4.2
## π Quick Start
```python
import pandas as pd
import tradingview_indicators as ta
# Load your market data
df = pd.read_csv("BTCUSDT_1d_spot.csv")
source = df["close"]
# Calculate indicators
df["EMA_14"] = ta.ema(source, 14)
df["RSI_14"] = ta.RSI(source, 14)
# MACD with histogram
macd = ta.MACD(source, 12, 26, 9)
df["MACD_Histogram"] = macd.get_histogram
# Directional Movement Index
dmi = ta.DMI(df, "close")
df["ADX"] = dmi.adx()[0]
df["DI_Plus"] = dmi.adx()[1]
df["DI_Minus"] = dmi.adx()[2]
# Bollinger Bands
bb = ta.bollinger_bands(source, 20, 2)
df["BB_Upper"] = bb[0]
df["BB_Middle"] = bb[1]
df["BB_Lower"] = bb[2]
```
## π Available Indicators
| Indicator | Function | Description |
|-----------|----------|-------------|
| **Moving Averages** | `sma()`, `ema()`, `rma()`, `sema()` | Simple, Exponential, Relative, Smoothed Moving Averages (DEMA, TEMA, and others) |
| **RSI** | `RSI()` | Relative Strength Index |
| **MACD** | `MACD()` | Moving Average Convergence Divergence |
| **Bollinger Bands** | `bollinger_bands()`, `bollinger_trends()` | Volatility bands and trend analysis |
| **Stochastic** | `stoch()`, `slow_stoch()` | Stochastic Oscillators |
| **DMI/ADX** | `DMI()` | Directional Movement Index |
| **CCI** | `CCI()` | Commodity Channel Index |
| **Ichimoku** | `Ichimoku()` | Ichimoku Cloud |
| **TRIX** | `TRIX()` | Triple Exponential Average |
| **TSI** | `tsi()` | True Strength Index |
| **SMIO** | `SMIO()` | SMI Ergodic Oscillator |
| **Didi Index** | `didi_index()` | Didi Index also known as Agulhada de Didi |
## π Repository Structure
```
TradingView-Indicators/
βββ src/
β βββ tradingview_indicators/ # Main package source code
β βββ __init__.py # Package initialization and exports
β βββ moving_average.py # MA implementations (SMA, EMA, RMA, SEMA)
β βββ RSI.py # Relative Strength Index
β βββ MACD.py # MACD indicator
β βββ bollinger.py # Bollinger Bands
β βββ stoch.py # Stochastic oscillator
β βββ slow_stoch.py # Slow Stochastic
β βββ DMI.py # Directional Movement Index
β βββ CCI.py # Commodity Channel Index
β βββ ichimoku.py # Ichimoku Cloud
β βββ TRIX.py # Triple Exponential Average
β βββ tsi.py # True Strength Index
β βββ SMIO.py # SMI Ergodic Oscillator
β βββ didi_index.py # Didi Index
β βββ utils.py # Utility functions
β βββ errors_exceptions.py # Custom exceptions
β
βββ tests/ # Comprehensive test suite
β βββ test_moving_average.py
β βββ test_RSI.py
β βββ test_macd.py
β βββ test_bollinger_bands.py
β βββ ... # Additional test files
β
βββ example/ # Usage examples
β βββ example.ipynb # Jupyter notebook with examples
β βββ BTCUSDT_1d_spot.csv # Sample market data
β
βββ pyproject.toml # Project metadata and dependencies
βββ setup.py # Package setup configuration
βββ requirements.txt # Development dependencies
βββ README.md # This file
```
### Core Components
#### π§ Source Code (`src/tradingview_indicators/`)
The main package contains modular indicator implementations:
- Each indicator is in its own file for maintainability
- Type hints for better code quality and IDE support
- Custom error handling for data validation
#### π§ͺ Tests (`tests/`)
Comprehensive testing framework ensuring accuracy:
- Unit tests for each indicator
- Validation against TradingView outputs
- Edge case handling
#### π Examples (`example/`)
Practical usage demonstrations:
- Jupyter notebook with real-world examples
- Sample cryptocurrency market data
- Step-by-step calculation guides
## π οΈ Technical Architecture
### Design Principles
1. **Modularity** - Each indicator is self-contained and reusable
2. **Accuracy** - All calculations validated using TradingView values as reference
3. **Performance** - Vectorized operations for efficient large-scale processing
4. **Maintainability** - Clean code following PEP 8 and SOLID principles
5. **Type Safety** - Comprehensive type hints for better developer experience
### Data Processing Pipeline
```
Raw Market Data (DataFrame/Series)
β
Data Validation
β
Vectorized Calculations (NumPy/Pandas)
β
Result Transformation
β
Type-Safe Output (Series/DataFrame)
```
## π Use Cases
- **Algorithmic Trading** - Build reliable trading strategies with accurate indicators
- **Financial Analysis** - Perform technical analysis on stocks, crypto, and forex
- **Data Science** - Integrate with data pipelines for market research
- **Backtesting** - Test trading strategies with precise historical calculations
- **Education** - Learn technical analysis with production-grade implementations
- **Machine Learning** - Calculate features for predictive models in finance
## π§ͺ Testing
Run the test suite:
```bash
python -m pytest ./tests
```
The library includes 12+ comprehensive test suites covering:
- Indicator accuracy validation
- Edge case handling
- Data type validation
## π€ Contributing
Contributions are welcome! This project follows professional development standards:
1. Fork the repository
3. Write tests for your changes
4. Ensure all tests pass (`python -m pytest ./tests`)
5. Follow PEP 8 style guidelines
6. Submit a pull request
## π Links
- **PyPI Package**: [tradingview-indicators](https://pypi.org/project/tradingview-indicators/)
- **GitHub Repository**: [m-marqx/TradingView-Indicators](https://github.com/m-marqx/TradingView-Indicators)
- **Issue Tracker**: [GitHub Issues](https://github.com/m-marqx/TradingView-Indicators/issues)
## π§ Contact
For questions, suggestions, or collaboration opportunities, please send me a message via GitHub or any of my social media channels listed on my profile.
## πΌ Use Case
I use this library for my financial needs of accurate and reliable technical analysis indicators to compute my variables in my machine learning models, such as in my project [ML-Miner](https://github.com/m-marqx/ML-Miner).
Raw data
{
"_id": null,
"home_page": null,
"name": "tradingview-indicators",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "python, tradingview, technical analysis, indicators",
"author": "Archie Marques",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/cd/71/2cb94709a5df87c100e38cc86b49847a9a3a0fc69bb1600e7dbe7324faa1/tradingview-indicators-0.1.3.0.tar.gz",
"platform": null,
"description": "# TradingView Indicators\n\n[](https://app.codacy.com/gh/m-marqx/TradingView-Indicators/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)\n[](https://www.python.org/downloads/)\n[](https://pypi.org/project/tradingview-indicators/)\n\n> A production-ready Python library for accurate financial technical analysis indicators, engineered to match TradingView platform standards.\n\n[\ud83c\udde7\ud83c\uddf7 Vers\u00e3o em Portugu\u00eas](https://github.com/m-marqx/TradingView-Indicators/blob/main/readme%20-%20pt-br.md)\n\n## \ud83c\udfaf Overview\n\n**TradingView Indicators** is an open-source Python library that provides highly accurate implementations of technical analysis indicators used in financial markets. Built with data engineering best practices, this library addresses critical accuracy issues found in existing solutions like TA-Lib and pandas-ta.\n\n### Key Features\n\n- \u2705 **Accurate Calculations** - Values precisely match TradingView platform standards\n- \u26a1 **Optimized Performance** - Vectorized operations using NumPy and Pandas for processing 1M+ data points\n- \ud83e\udde9 **Modular Architecture** - Clean, maintainable code following SOLID principles\n- \ud83e\uddea **Comprehensive Testing** - 12+ test suites ensuring reliability and accuracy\n- \ud83d\udd27 **Type-Safe** - Full type hints support for better IDE integration\n\n## \ud83d\udce6 Installation\n\nInstall via pip:\n\n```bash\npip install tradingview-indicators\n```\n\n### Requirements\n\n- Python 3.11+\n- fastdtw >= 0.3.4\n- numpy >= 2.3.4\n- pandas[performance] >= 2.3.3\n- pytest >= 8.4.2\n\n## \ud83d\ude80 Quick Start\n\n```python\nimport pandas as pd\nimport tradingview_indicators as ta\n\n# Load your market data\ndf = pd.read_csv(\"BTCUSDT_1d_spot.csv\")\nsource = df[\"close\"]\n\n# Calculate indicators\ndf[\"EMA_14\"] = ta.ema(source, 14)\ndf[\"RSI_14\"] = ta.RSI(source, 14)\n\n# MACD with histogram\nmacd = ta.MACD(source, 12, 26, 9)\ndf[\"MACD_Histogram\"] = macd.get_histogram\n\n# Directional Movement Index\ndmi = ta.DMI(df, \"close\")\ndf[\"ADX\"] = dmi.adx()[0]\ndf[\"DI_Plus\"] = dmi.adx()[1]\ndf[\"DI_Minus\"] = dmi.adx()[2]\n\n# Bollinger Bands\nbb = ta.bollinger_bands(source, 20, 2)\ndf[\"BB_Upper\"] = bb[0]\ndf[\"BB_Middle\"] = bb[1]\ndf[\"BB_Lower\"] = bb[2]\n```\n\n## \ud83d\udcca Available Indicators\n\n| Indicator | Function | Description |\n|-----------|----------|-------------|\n| **Moving Averages** | `sma()`, `ema()`, `rma()`, `sema()` | Simple, Exponential, Relative, Smoothed Moving Averages (DEMA, TEMA, and others) |\n| **RSI** | `RSI()` | Relative Strength Index |\n| **MACD** | `MACD()` | Moving Average Convergence Divergence |\n| **Bollinger Bands** | `bollinger_bands()`, `bollinger_trends()` | Volatility bands and trend analysis |\n| **Stochastic** | `stoch()`, `slow_stoch()` | Stochastic Oscillators |\n| **DMI/ADX** | `DMI()` | Directional Movement Index |\n| **CCI** | `CCI()` | Commodity Channel Index |\n| **Ichimoku** | `Ichimoku()` | Ichimoku Cloud |\n| **TRIX** | `TRIX()` | Triple Exponential Average |\n| **TSI** | `tsi()` | True Strength Index |\n| **SMIO** | `SMIO()` | SMI Ergodic Oscillator |\n| **Didi Index** | `didi_index()` | Didi Index also known as Agulhada de Didi |\n\n## \ud83d\udcc1 Repository Structure\n\n```\nTradingView-Indicators/\n\u251c\u2500\u2500 src/\n\u2502 \u2514\u2500\u2500 tradingview_indicators/ # Main package source code\n\u2502 \u251c\u2500\u2500 __init__.py # Package initialization and exports\n\u2502 \u251c\u2500\u2500 moving_average.py # MA implementations (SMA, EMA, RMA, SEMA)\n\u2502 \u251c\u2500\u2500 RSI.py # Relative Strength Index\n\u2502 \u251c\u2500\u2500 MACD.py # MACD indicator\n\u2502 \u251c\u2500\u2500 bollinger.py # Bollinger Bands\n\u2502 \u251c\u2500\u2500 stoch.py # Stochastic oscillator\n\u2502 \u251c\u2500\u2500 slow_stoch.py # Slow Stochastic\n\u2502 \u251c\u2500\u2500 DMI.py # Directional Movement Index\n\u2502 \u251c\u2500\u2500 CCI.py # Commodity Channel Index\n\u2502 \u251c\u2500\u2500 ichimoku.py # Ichimoku Cloud\n\u2502 \u251c\u2500\u2500 TRIX.py # Triple Exponential Average\n\u2502 \u251c\u2500\u2500 tsi.py # True Strength Index\n\u2502 \u251c\u2500\u2500 SMIO.py # SMI Ergodic Oscillator\n\u2502 \u251c\u2500\u2500 didi_index.py # Didi Index\n\u2502 \u251c\u2500\u2500 utils.py # Utility functions\n\u2502 \u2514\u2500\u2500 errors_exceptions.py # Custom exceptions\n\u2502\n\u251c\u2500\u2500 tests/ # Comprehensive test suite\n\u2502 \u251c\u2500\u2500 test_moving_average.py\n\u2502 \u251c\u2500\u2500 test_RSI.py\n\u2502 \u251c\u2500\u2500 test_macd.py\n\u2502 \u251c\u2500\u2500 test_bollinger_bands.py\n\u2502 \u2514\u2500\u2500 ... # Additional test files\n\u2502\n\u251c\u2500\u2500 example/ # Usage examples\n\u2502 \u251c\u2500\u2500 example.ipynb # Jupyter notebook with examples\n\u2502 \u2514\u2500\u2500 BTCUSDT_1d_spot.csv # Sample market data\n\u2502\n\u251c\u2500\u2500 pyproject.toml # Project metadata and dependencies\n\u251c\u2500\u2500 setup.py # Package setup configuration\n\u251c\u2500\u2500 requirements.txt # Development dependencies\n\u2514\u2500\u2500 README.md # This file\n```\n\n### Core Components\n\n#### \ud83d\udd27 Source Code (`src/tradingview_indicators/`)\nThe main package contains modular indicator implementations:\n- Each indicator is in its own file for maintainability\n- Type hints for better code quality and IDE support\n- Custom error handling for data validation\n\n#### \ud83e\uddea Tests (`tests/`)\nComprehensive testing framework ensuring accuracy:\n- Unit tests for each indicator\n- Validation against TradingView outputs\n- Edge case handling\n\n#### \ud83d\udcda Examples (`example/`)\nPractical usage demonstrations:\n- Jupyter notebook with real-world examples\n- Sample cryptocurrency market data\n- Step-by-step calculation guides\n\n## \ud83d\udee0\ufe0f Technical Architecture\n\n### Design Principles\n\n1. **Modularity** - Each indicator is self-contained and reusable\n2. **Accuracy** - All calculations validated using TradingView values as reference\n3. **Performance** - Vectorized operations for efficient large-scale processing\n4. **Maintainability** - Clean code following PEP 8 and SOLID principles\n5. **Type Safety** - Comprehensive type hints for better developer experience\n\n### Data Processing Pipeline\n\n```\nRaw Market Data (DataFrame/Series)\n \u2193\n Data Validation\n \u2193\n Vectorized Calculations (NumPy/Pandas)\n \u2193\n Result Transformation\n \u2193\n Type-Safe Output (Series/DataFrame)\n```\n\n## \ud83c\udf93 Use Cases\n\n- **Algorithmic Trading** - Build reliable trading strategies with accurate indicators\n- **Financial Analysis** - Perform technical analysis on stocks, crypto, and forex\n- **Data Science** - Integrate with data pipelines for market research\n- **Backtesting** - Test trading strategies with precise historical calculations\n- **Education** - Learn technical analysis with production-grade implementations\n- **Machine Learning** - Calculate features for predictive models in finance\n\n## \ud83e\uddea Testing\n\nRun the test suite:\n\n```bash\npython -m pytest ./tests\n```\n\nThe library includes 12+ comprehensive test suites covering:\n- Indicator accuracy validation\n- Edge case handling\n- Data type validation\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome! This project follows professional development standards:\n\n1. Fork the repository\n3. Write tests for your changes\n4. Ensure all tests pass (`python -m pytest ./tests`)\n5. Follow PEP 8 style guidelines\n6. Submit a pull request\n\n## \ud83d\udd17 Links\n\n- **PyPI Package**: [tradingview-indicators](https://pypi.org/project/tradingview-indicators/)\n- **GitHub Repository**: [m-marqx/TradingView-Indicators](https://github.com/m-marqx/TradingView-Indicators)\n- **Issue Tracker**: [GitHub Issues](https://github.com/m-marqx/TradingView-Indicators/issues)\n\n\n## \ud83d\udce7 Contact\n\nFor questions, suggestions, or collaboration opportunities, please send me a message via GitHub or any of my social media channels listed on my profile.\n\n\n## \ud83d\udcbc Use Case\n\nI use this library for my financial needs of accurate and reliable technical analysis indicators to compute my variables in my machine learning models, such as in my project [ML-Miner](https://github.com/m-marqx/ML-Miner).\n",
"bugtrack_url": null,
"license": null,
"summary": "An accurate calculation of technical analysis indicators with values aligning with those in TradingView.",
"version": "0.1.3.0",
"project_urls": null,
"split_keywords": [
"python",
" tradingview",
" technical analysis",
" indicators"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "975b791d3c993d13df1ec8b4fdef8bfdbf73aee1413f7eba108c300d5bef5082",
"md5": "2f1709dfb79ea70dcef98e7d4c0c54f1",
"sha256": "f13f56211ecf699bc9fd8ab16a849a857cea1e4e89c2c80fac8aa4daae5b6d56"
},
"downloads": -1,
"filename": "tradingview_indicators-0.1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2f1709dfb79ea70dcef98e7d4c0c54f1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 21169,
"upload_time": "2025-10-23T02:08:17",
"upload_time_iso_8601": "2025-10-23T02:08:17.972037Z",
"url": "https://files.pythonhosted.org/packages/97/5b/791d3c993d13df1ec8b4fdef8bfdbf73aee1413f7eba108c300d5bef5082/tradingview_indicators-0.1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "cd712cb94709a5df87c100e38cc86b49847a9a3a0fc69bb1600e7dbe7324faa1",
"md5": "0997a93de3d7a4c768ecc17021bfd4e3",
"sha256": "a459d4ea3a25159e7c8b1e8f9b8c481228bf453816636321c61c1616384e1eb0"
},
"downloads": -1,
"filename": "tradingview-indicators-0.1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "0997a93de3d7a4c768ecc17021bfd4e3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 18055,
"upload_time": "2025-10-23T02:08:18",
"upload_time_iso_8601": "2025-10-23T02:08:18.864174Z",
"url": "https://files.pythonhosted.org/packages/cd/71/2cb94709a5df87c100e38cc86b49847a9a3a0fc69bb1600e7dbe7324faa1/tradingview-indicators-0.1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-23 02:08:18",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "tradingview-indicators"
}