Skip to content

Commit 8c3852d

Browse files
authored
Merge pull request #66 from xgboosted/feature-improve-indicator-docs
docs: Improve indicator documentation for clarity and completeness
2 parents 308ec72 + bc1a17e commit 8c3852d

File tree

14 files changed

+320
-5
lines changed

14 files changed

+320
-5
lines changed

pandas_ta_classic/candles/cdl_doji.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def cdl_doji(
1717
offset=None,
1818
**kwargs,
1919
):
20-
"""Candle Type: Doji"""
20+
"""Indicator: Candle Type - Doji"""
2121
# Validate Arguments
2222
length = int(length) if length and length > 0 else 10
2323
factor = float(factor) if is_percent(factor) else 10

pandas_ta_classic/candles/cdl_inside.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
def cdl_inside(open_, high, low, close, asbool=False, offset=None, **kwargs):
8-
"""Candle Type: Inside Bar"""
8+
"""Indicator: Candle Type - Inside Bar"""
99
# Validate arguments
1010
open_ = verify_series(open_)
1111
high = verify_series(high)

pandas_ta_classic/candles/cdl_pattern.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def cdl_pattern(
8484
offset=None,
8585
**kwargs,
8686
) -> DataFrame:
87-
"""Candle Pattern"""
87+
"""Indicator: Candle Pattern"""
8888
# Validate Arguments
8989
open_ = verify_series(open_)
9090
high = verify_series(high)

pandas_ta_classic/candles/cdl_z.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
def cdl_z(
99
open_, high, low, close, length=None, full=None, ddof=None, offset=None, **kwargs
1010
):
11-
"""Candle Type: Z Score"""
11+
"""Indicator: Candle Type - Z Score"""
1212
# Validate Arguments
1313
length = int(length) if length and length > 0 else 30
1414
ddof = int(ddof) if ddof and ddof >= 0 and ddof < length else 1

pandas_ta_classic/candles/ha.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
def ha(open_, high, low, close, offset=None, **kwargs):
8-
"""Candle Type: Heikin Ashi"""
8+
"""Indicator: Candle Type - Heikin Ashi"""
99
# Validate Arguments
1010
open_ = verify_series(open_)
1111
high = verify_series(high)

pandas_ta_classic/overlap/hl2.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,35 @@ def hl2(high, low, offset=None, **kwargs):
2222
hl2.category = "overlap"
2323

2424
return hl2
25+
26+
27+
hl2.__doc__ = """HL2 (Median Price)
28+
29+
HL2 calculates the median price, which is the average of the High and Low
30+
prices for each period. This indicator is commonly used to represent the
31+
mid-point of a period's price range and is often used in technical analysis
32+
as a reference point for price action.
33+
34+
Sources:
35+
https://www.tradingview.com/support/solutions/43000502274-hl2/
36+
https://www.investopedia.com/terms/m/median.asp
37+
https://school.stockcharts.com/doku.php?id=chart_analysis:typical_price
38+
39+
Calculation:
40+
Default Inputs:
41+
None (uses raw high and low prices)
42+
43+
HL2 = (High + Low) / 2
44+
45+
Args:
46+
high (pd.Series): Series of 'high' prices
47+
low (pd.Series): Series of 'low' prices
48+
offset (int): How many periods to offset the result. Default: 0
49+
50+
Kwargs:
51+
fillna (value, optional): pd.DataFrame.fillna(value)
52+
fill_method (value, optional): Type of fill method
53+
54+
Returns:
55+
pd.Series: New feature generated.
56+
"""

pandas_ta_classic/overlap/hlc3.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,38 @@ def hlc3(high, low, close, talib=None, offset=None, **kwargs):
3030
hlc3.category = "overlap"
3131

3232
return hlc3
33+
34+
35+
hlc3.__doc__ = """HLC3 (Typical Price)
36+
37+
HLC3 calculates the typical price, which is the average of the High, Low,
38+
and Close prices for each period. This indicator provides a simple measure
39+
of the average price level during a period and is widely used in technical
40+
analysis. It's also known as the TA-Lib TYPPRICE function.
41+
42+
Sources:
43+
https://www.tradingview.com/support/solutions/43000502273-hlc3/
44+
https://school.stockcharts.com/doku.php?id=chart_analysis:typical_price
45+
https://www.investopedia.com/terms/t/typicalprice.asp
46+
47+
Calculation:
48+
Default Inputs:
49+
None (uses raw HLC prices)
50+
51+
HLC3 = (High + Low + Close) / 3
52+
53+
Args:
54+
high (pd.Series): Series of 'high' prices
55+
low (pd.Series): Series of 'low' prices
56+
close (pd.Series): Series of 'close' prices
57+
talib (bool): If TA Lib is installed and talib is True, Returns the TA Lib
58+
version. Default: True
59+
offset (int): How many periods to offset the result. Default: 0
60+
61+
Kwargs:
62+
fillna (value, optional): pd.DataFrame.fillna(value)
63+
fill_method (value, optional): Type of fill method
64+
65+
Returns:
66+
pd.Series: New feature generated.
67+
"""

pandas_ta_classic/overlap/midpoint.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,39 @@ def midpoint(close, length=None, talib=None, offset=None, **kwargs):
5353
midpoint.category = "overlap"
5454

5555
return midpoint
56+
57+
58+
midpoint.__doc__ = """Midpoint Over Period (MIDPOINT)
59+
60+
MIDPOINT calculates the midpoint between the highest and lowest values of
61+
the close price over a specified period. This indicator helps identify the
62+
center of the price range and can be used to detect potential support and
63+
resistance levels.
64+
65+
Sources:
66+
https://www.tradingview.com/support/solutions/43000594683-midpoint/
67+
https://ta-lib.org/function.html?name=MIDPOINT
68+
69+
Calculation:
70+
Default Inputs:
71+
length=2
72+
73+
LOWEST = MIN(close, length)
74+
HIGHEST = MAX(close, length)
75+
MIDPOINT = (LOWEST + HIGHEST) / 2
76+
77+
Args:
78+
close (pd.Series): Series of 'close's
79+
length (int): Its period. Default: 2
80+
talib (bool): If TA Lib is installed and talib is True, Returns the TA Lib
81+
version. Default: True
82+
offset (int): How many periods to offset the result. Default: 0
83+
84+
Kwargs:
85+
min_periods (int, optional): Minimum number of observations required. Default: length
86+
fillna (value, optional): pd.DataFrame.fillna(value)
87+
fill_method (value, optional): Type of fill method
88+
89+
Returns:
90+
pd.Series: New feature generated.
91+
"""

pandas_ta_classic/overlap/midprice.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,40 @@ def midprice(high, low, length=None, talib=None, offset=None, **kwargs):
5555
midprice.category = "overlap"
5656

5757
return midprice
58+
59+
60+
midprice.__doc__ = """Midpoint Price Over Period (MIDPRICE)
61+
62+
MIDPRICE calculates the midpoint between the highest high and lowest low
63+
over a specified period. Similar to MIDPOINT but uses high and low prices
64+
instead of close prices. This provides a measure of the center of the
65+
price range and is useful for identifying equilibrium levels.
66+
67+
Sources:
68+
https://www.tradingview.com/support/solutions/43000594684-midprice/
69+
https://ta-lib.org/function.html?name=MIDPRICE
70+
71+
Calculation:
72+
Default Inputs:
73+
length=2
74+
75+
LOWEST_LOW = MIN(low, length)
76+
HIGHEST_HIGH = MAX(high, length)
77+
MIDPRICE = (LOWEST_LOW + HIGHEST_HIGH) / 2
78+
79+
Args:
80+
high (pd.Series): Series of 'high's
81+
low (pd.Series): Series of 'low's
82+
length (int): Its period. Default: 2
83+
talib (bool): If TA Lib is installed and talib is True, Returns the TA Lib
84+
version. Default: True
85+
offset (int): How many periods to offset the result. Default: 0
86+
87+
Kwargs:
88+
min_periods (int, optional): Minimum number of observations required. Default: length
89+
fillna (value, optional): pd.DataFrame.fillna(value)
90+
fill_method (value, optional): Type of fill method
91+
92+
Returns:
93+
pd.Series: New feature generated.
94+
"""

pandas_ta_classic/overlap/ohlc4.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,36 @@ def ohlc4(open_, high, low, close, offset=None, **kwargs):
2424
ohlc4.category = "overlap"
2525

2626
return ohlc4
27+
28+
29+
ohlc4.__doc__ = """OHLC4 (Average of Open, High, Low, Close)
30+
31+
OHLC4 calculates the average of the Open, High, Low, and Close prices for
32+
each period. This simple average provides a balanced representation of price
33+
action across the entire period, giving equal weight to all four OHLC values.
34+
It's commonly used as a smoother alternative to close prices alone.
35+
36+
Sources:
37+
https://www.tradingview.com/support/solutions/43000502001-ohlc4/
38+
https://www.investopedia.com/terms/o/ohlc-chart.asp
39+
40+
Calculation:
41+
Default Inputs:
42+
None (uses raw OHLC prices)
43+
44+
OHLC4 = (Open + High + Low + Close) / 4
45+
46+
Args:
47+
open_ (pd.Series): Series of 'open' prices
48+
high (pd.Series): Series of 'high' prices
49+
low (pd.Series): Series of 'low' prices
50+
close (pd.Series): Series of 'close' prices
51+
offset (int): How many periods to offset the result. Default: 0
52+
53+
Kwargs:
54+
fillna (value, optional): pd.DataFrame.fillna(value)
55+
fill_method (value, optional): Type of fill method
56+
57+
Returns:
58+
pd.Series: New feature generated.
59+
"""

0 commit comments

Comments
 (0)