Skip to content

Commit 4bbf104

Browse files
docs: enhance documentation for ProjectX indicators modules with overviews and key features
Co-authored-by: Genie <[email protected]>
1 parent d39204d commit 4bbf104

File tree

9 files changed

+217
-25
lines changed

9 files changed

+217
-25
lines changed

src/project_x_py/indicators/__init__.py

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,41 @@
44
Author: TexasCoding
55
Date: June 2025
66
7-
A comprehensive technical analysis library similar to TA-Lib, built on Polars DataFrames.
8-
Provides both class-based and function-based interfaces for technical indicators.
9-
10-
Example usage:
7+
Overview:
8+
ProjectX Indicators provides a comprehensive, extensible technical analysis library
9+
similar to TA-Lib, built on Polars DataFrames. It offers both class-based and
10+
function-based interfaces for over 60 technical indicators, with seamless integration
11+
for vectorized backtesting and strategy development in ProjectX and beyond.
12+
13+
Key Features:
14+
- Wide range of indicators: trend/overlap, momentum, volatility, volume, and patterns
15+
- Class-based and TA-Lib-style function interface for flexible usage
16+
- All indicators operate on Polars DataFrames for speed and modern analytics
17+
- Utilities for indicator discovery, grouping, and docstring access
18+
- Clean API and naming convention for easy scripting and research
19+
20+
Example Usage:
21+
```python
1122
# Class-based interface
12-
>>> from project_x_py.indicators import RSI, SMA
13-
>>> rsi = RSI()
14-
>>> data_with_rsi = rsi.calculate(ohlcv_data, period=14)
23+
from project_x_py.indicators import RSI, SMA
24+
rsi = RSI()
25+
data_with_rsi = rsi.calculate(ohlcv_data, period=14)
1526
1627
# Function-based interface (TA-Lib style)
17-
>>> from project_x_py.indicators import calculate_rsi, calculate_sma
18-
>>> data_with_rsi = calculate_rsi(ohlcv_data, period=14)
19-
>>> data_with_sma = calculate_sma(ohlcv_data, period=20)
28+
from project_x_py.indicators import calculate_rsi, calculate_sma
29+
data_with_rsi = calculate_rsi(ohlcv_data, period=14)
30+
data_with_sma = calculate_sma(ohlcv_data, period=20)
31+
```
32+
33+
See Also:
34+
- `project_x_py.indicators.base` (abstract base classes/utilities)
35+
- `project_x_py.indicators.momentum`
36+
- `project_x_py.indicators.overlap`
37+
- `project_x_py.indicators.volume`
38+
- `project_x_py.indicators.volatility`
39+
- `project_x_py.indicators.order_block`
40+
- `project_x_py.indicators.fvg`
41+
- `project_x_py.indicators.waddah_attar`
2042
"""
2143

2244
import polars as pl

src/project_x_py/indicators/base.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,35 @@
44
Author: TexasCoding
55
Date: June 2025
66
7-
Base classes and common functionality for technical indicators.
7+
Overview:
8+
Provides abstract base classes and shared validation/utilities for all ProjectX
9+
indicator modules. Encapsulates error handling, cache logic, and call semantics
10+
for consistent and efficient indicator development. All custom indicators should
11+
inherit from these classes for uniformity and extensibility.
12+
13+
Key Features:
14+
- `BaseIndicator` with parameter validation, data checks, and result caching
15+
- Specialized subclasses: OverlapIndicator, MomentumIndicator, VolatilityIndicator,
16+
VolumeIndicator
17+
- Utility functions for safe division, rolling sums, and EMA alpha calculation
18+
- Standardized exception (`IndicatorError`) for all indicator errors
19+
20+
Example Usage:
21+
```python
22+
from project_x_py.indicators.base import BaseIndicator
23+
24+
class MyCustomIndicator(BaseIndicator):
25+
def calculate(self, data, period=10):
26+
self.validate_data(data, ["close"])
27+
self.validate_period(period)
28+
# ... custom calculation ...
29+
```
30+
31+
See Also:
32+
- `project_x_py.indicators.momentum.MomentumIndicator`
33+
- `project_x_py.indicators.overlap.OverlapIndicator`
34+
- `project_x_py.indicators.volatility.VolatilityIndicator`
35+
- `project_x_py.indicators.volume.VolumeIndicator`
836
"""
937

1038
import hashlib

src/project_x_py/indicators/fvg.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,28 @@
44
Author: TexasCoding
55
Date: August 2025
66
7-
Fair Value Gap indicator identifies imbalance areas in price action where there is little
8-
to no trading activity, which can act as support/resistance zones.
7+
Overview:
8+
Implements the Fair Value Gap (FVG) indicator for identifying price imbalances
9+
and potential support/resistance zones. Detects gaps in price action with
10+
optional mitigation logic, helping traders spot areas likely to be revisited.
11+
12+
Key Features:
13+
- Identifies bullish/bearish fair value gaps from OHLC data
14+
- Supports configurable gap size, mitigation threshold, and custom columns
15+
- Returns gap boundary, size, and mitigation status for each bar
16+
- Callable as a class or via TA-Lib-style convenience function
17+
18+
Example Usage:
19+
```python
20+
from project_x_py.indicators import FVG
21+
fvg = FVG()
22+
data_with_fvg = fvg.calculate(ohlcv_data, min_gap_size=0.001)
23+
gaps = data_with_fvg.filter(pl.col("fvg_bullish"))
24+
```
25+
26+
See Also:
27+
- `project_x_py.indicators.order_block`
28+
- `project_x_py.indicators.base.BaseIndicator`
929
"""
1030

1131
from typing import Any

src/project_x_py/indicators/momentum.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,29 @@
44
Author: TexasCoding
55
Date: June 2025
66
7-
Momentum indicators measure the rate of change in price movements,
8-
helping identify overbought/oversold conditions and trend strength.
7+
Overview:
8+
Provides a suite of momentum indicators for ProjectX, covering oscillators and
9+
trend-following calculations. Includes both class-based and TA-Lib-style
10+
function interfaces for RSI, MACD, Stochastic, CCI, and many more, all operating
11+
on Polars DataFrames.
12+
13+
Key Features:
14+
- Relative Strength Index (RSI), MACD, Stochastic, Williams %R, CCI, ROC, MOM, and more
15+
- Directional movement, Aroon, Ultimate Oscillator, and Chande Momentum Oscillator
16+
- All indicators vectorized for performance and chained analysis
17+
- Flexible configuration: periods, smoothing, columns, and more
18+
- Convenient function interface for script-style use
19+
20+
Example Usage:
21+
```python
22+
from project_x_py.indicators import calculate_rsi
23+
data_with_rsi = calculate_rsi(ohlcv_data, period=14)
24+
```
25+
26+
See Also:
27+
- `project_x_py.indicators.base.MomentumIndicator`
28+
- `project_x_py.indicators.overlap`
29+
- `project_x_py.indicators.volume`
930
"""
1031

1132
from typing import Any

src/project_x_py/indicators/order_block.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,28 @@
44
Author: TexasCoding
55
Date: August 2025
66
7-
Order Block indicator identifies institutional order areas based on price action patterns.
8-
These are supply and demand zones where large market participants likely have pending orders.
7+
Overview:
8+
Implements the Order Block indicator, which detects likely institutional supply/demand
9+
zones from price action and volume. Useful for identifying areas where large orders
10+
may cluster, acting as future support or resistance.
11+
12+
Key Features:
13+
- Detects bullish and bearish order blocks based on candle/volume logic
14+
- Configurable volume threshold, mitigation, and lookback
15+
- Outputs block boundaries, strength, and mitigation status per bar
16+
- Class and function interfaces for flexible use
17+
18+
Example Usage:
19+
```python
20+
from project_x_py.indicators import OrderBlock
21+
ob = OrderBlock()
22+
data_with_ob = ob.calculate(ohlcv_data, min_volume_percentile=70)
23+
```
24+
25+
See Also:
26+
- `project_x_py.indicators.fvg`
27+
- `project_x_py.indicators.base.BaseIndicator`
28+
- `project_x_py.indicators.volume`
929
"""
1030

1131
from typing import Any

src/project_x_py/indicators/overlap.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,29 @@
44
Author: TexasCoding
55
Date: June 2025
66
7-
Overlap study indicators are often displaced by default and superimposed
8-
over the main price chart.
7+
Overview:
8+
Contains all trend-following (overlap) indicators for ProjectX, including
9+
moving averages, Bollinger Bands, and adaptive smoothing. Each indicator
10+
provides a class interface and function-style convenience wrapper, and
11+
all outputs are Polars DataFrames for easy chaining.
12+
13+
Key Features:
14+
- SMA, EMA, DEMA, TEMA, WMA, TRIMA, KAMA, and other moving averages
15+
- Bollinger Bands, Parabolic SAR, Hilbert Transform, and more
16+
- Selectable MA type for generic moving average computations
17+
- Rolling, exponential, and adaptive implementations
18+
- All indicators are vectorized and support chaining
19+
20+
Example Usage:
21+
```python
22+
from project_x_py.indicators import calculate_sma
23+
data_with_sma = calculate_sma(ohlcv_data, period=20)
24+
```
25+
26+
See Also:
27+
- `project_x_py.indicators.base.OverlapIndicator`
28+
- `project_x_py.indicators.momentum`
29+
- `project_x_py.indicators.volatility`
930
"""
1031

1132
from typing import Any

src/project_x_py/indicators/volatility.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,28 @@
44
Author: TexasCoding
55
Date: June 2025
66
7-
Volatility indicators measure the rate of price fluctuations,
8-
helping traders understand market volatility and potential breakouts.
7+
Overview:
8+
Implements volatility-focused indicators for ProjectX, quantifying price range,
9+
standard deviation, and directional movement. Designed for gauging market
10+
turbulence, breakout potential, and risk in systematic strategies.
11+
12+
Key Features:
13+
- Average True Range (ATR), ADX, NATR, TRANGE, STDDEV, Ultimate Oscillator
14+
- Wilder's smoothing, EMA, and rolling window variants
15+
- All indicators operate on Polars DataFrames
16+
- TA-Lib-style convenience functions for scripting/backtesting
17+
- Can be chained with other indicator modules
18+
19+
Example Usage:
20+
```python
21+
from project_x_py.indicators import calculate_atr
22+
data_with_atr = calculate_atr(ohlcv_data, period=14)
23+
```
24+
25+
See Also:
26+
- `project_x_py.indicators.base.VolatilityIndicator`
27+
- `project_x_py.indicators.overlap`
28+
- `project_x_py.indicators.momentum`
929
"""
1030

1131
from typing import Any

src/project_x_py/indicators/volume.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,27 @@
44
Author: TexasCoding
55
Date: June 2025
66
7-
Volume indicators analyze trading volume to confirm price movements
8-
and identify potential trend reversals or continuations.
7+
Overview:
8+
Implements volume-based indicators for ProjectX, allowing traders to confirm
9+
trends, spot reversals, and analyze money flow. Includes both cumulative
10+
and oscillator-style volume indicators operating on Polars DataFrames.
11+
12+
Key Features:
13+
- OBV, VWAP, Accumulation/Distribution (AD), AD Oscillator (ADOSC)
14+
- Rolling, cumulative, and EMA-based volume analytics
15+
- TA-Lib-style function interface for direct scripting
16+
- Compatible with all other indicator modules
17+
18+
Example Usage:
19+
```python
20+
from project_x_py.indicators import calculate_vwap
21+
data_with_vwap = calculate_vwap(ohlcv_data, period=20)
22+
```
23+
24+
See Also:
25+
- `project_x_py.indicators.base.VolumeIndicator`
26+
- `project_x_py.indicators.momentum`
27+
- `project_x_py.indicators.overlap`
928
"""
1029

1130
from typing import Any

src/project_x_py/indicators/waddah_attar.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,29 @@
44
Author: TexasCoding
55
Date: August 2025
66
7-
Waddah Attar Explosion indicator is a volatility-based indicator that combines
8-
MACD and Bollinger Bands to identify strong trends and potential breakouts.
7+
Overview:
8+
Implements the Waddah Attar Explosion (WAE) indicator for detecting strong
9+
trends and breakout conditions. Combines MACD, Bollinger Bands, and ATR-based
10+
dead zone logic to filter for high-momentum moves with volatility context.
11+
12+
Key Features:
13+
- Computes explosion line, trend, and dead zone from price/volatility data
14+
- Configurable MACD/Bollinger/ATR parameters for fine-tuning
15+
- Flags bullish/bearish breakouts above dead zone threshold
16+
- Callable as a class or with TA-Lib-style convenience function
17+
18+
Example Usage:
19+
```python
20+
from project_x_py.indicators import WAE
21+
wae = WAE()
22+
data_with_wae = wae.calculate(ohlcv_data)
23+
signals = data_with_wae.filter(pl.col("wae_explosion_above_dz"))
24+
```
25+
26+
See Also:
27+
- `project_x_py.indicators.volatility`
28+
- `project_x_py.indicators.base.BaseIndicator`
29+
- `project_x_py.indicators.momentum`
930
"""
1031

1132
from typing import Any

0 commit comments

Comments
 (0)