Skip to content

Commit f3e31ab

Browse files
committed
Update readme and images
1 parent 6406959 commit f3e31ab

4 files changed

Lines changed: 185 additions & 0 deletions

File tree

README.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ pip install pyindicators
3838
* [Stochastic Oscillator (STO)](#stochastic-oscillator-sto)
3939
* [Volatility indicators](#volatility-indicators)
4040
* [Bollinger Bands (BB)](#bollinger-bands-bb)
41+
* [Bollinger Bands Overshoot](#bollinger-bands-overshoot)
4142
* [Average True Range (ATR)](#average-true-range-atr)
43+
* [Moving Average Envelope (MAE)](#moving-average-envelope-mae)
44+
* [Support and Resistance](#support-and-resistance)
45+
* [Fibonacci Retracement](#fibonacci-retracement)
4246
* [Pattern recognition](#pattern-recognition)
4347
* [Detect Peaks](#detect-peaks)
4448
* [Detect Bullish Divergence](#detect-bullish-divergence)
@@ -590,6 +594,68 @@ pd_df.tail(10)
590594

591595
![BOLLINGER_BANDS](https://github.com/coding-kitties/PyIndicators/blob/main/static/images/indicators/bollinger_bands.png)
592596

597+
#### Bollinger Bands Overshoot
598+
599+
Bollinger Bands Overshoot measures how far the price has exceeded the upper or lower Bollinger Band, expressed as a percentage of the half-band width (distance from middle to upper/lower band). This indicator helps identify extreme price movements and potential mean reversion opportunities.
600+
601+
**Calculation:**
602+
- When price > upper band (bullish overshoot): `((Price - Upper Band) / (Upper Band - Middle Band)) × 100`
603+
- When price < lower band (bearish overshoot): `((Price - Lower Band) / (Middle Band - Lower Band)) × 100`
604+
- When price is within bands: `0%`
605+
606+
**Interpretation:**
607+
- Positive values indicate overbought conditions (price above upper band)
608+
- Negative values indicate oversold conditions (price below lower band)
609+
- High overshoots (e.g., 40%) indicate increased risk of mean reversion
610+
611+
```python
612+
def bollinger_overshoot(
613+
data: Union[PdDataFrame, PlDataFrame],
614+
source_column='Close',
615+
period=20,
616+
std_dev=2,
617+
result_column='bollinger_overshoot'
618+
) -> Union[PdDataFrame, PlDataFrame]:
619+
```
620+
621+
Example
622+
623+
```python
624+
from investing_algorithm_framework import download
625+
626+
from pyindicators import bollinger_overshoot
627+
628+
pl_df = download(
629+
symbol="btc/eur",
630+
market="binance",
631+
time_frame="1d",
632+
start_date="2023-12-01",
633+
end_date="2023-12-25",
634+
save=True,
635+
storage_path="./data"
636+
)
637+
pd_df = download(
638+
symbol="btc/eur",
639+
market="binance",
640+
time_frame="1d",
641+
start_date="2023-12-01",
642+
end_date="2023-12-25",
643+
pandas=True,
644+
save=True,
645+
storage_path="./data"
646+
)
647+
648+
# Calculate Bollinger Bands Overshoot for Polars DataFrame
649+
pl_df = bollinger_overshoot(pl_df, source_column="Close")
650+
pl_df.show(10)
651+
652+
# Calculate Bollinger Bands Overshoot for Pandas DataFrame
653+
pd_df = bollinger_overshoot(pd_df, source_column="Close")
654+
pd_df.tail(10)
655+
```
656+
657+
![BOLLINGER_OVERSHOOT](https://github.com/coding-kitties/PyIndicators/blob/main/static/images/indicators/bollinger_overshoot.png)
658+
593659
#### Average True Range (ATR)
594660

595661
The Average True Range (ATR) is a volatility indicator that measures the average range between the high and low prices over a specified period. It helps traders identify potential price fluctuations and adjust their strategies accordingly.
@@ -641,6 +707,125 @@ pd_df.tail(10)
641707

642708
![ATR](https://github.com/coding-kitties/PyIndicators/blob/main/static/images/indicators/atr.png)
643709

710+
#### Moving Average Envelope (MAE)
711+
712+
Moving Average Envelopes are percentage-based envelopes set above and below a moving average. The moving average forms the base, and the envelopes are set at a fixed percentage above and below. This indicator is useful for identifying overbought/oversold conditions, spotting trend direction, and finding support and resistance levels.
713+
714+
```python
715+
def moving_average_envelope(
716+
data: Union[PdDataFrame, PlDataFrame],
717+
source_column: str = 'Close',
718+
period: int = 20,
719+
percentage: float = 2.5,
720+
ma_type: str = 'sma',
721+
middle_column: str = 'ma_envelope_middle',
722+
upper_column: str = 'ma_envelope_upper',
723+
lower_column: str = 'ma_envelope_lower'
724+
) -> Union[PdDataFrame, PlDataFrame]:
725+
```
726+
727+
Example
728+
729+
```python
730+
from investing_algorithm_framework import download
731+
732+
from pyindicators import moving_average_envelope
733+
734+
pl_df = download(
735+
symbol="btc/eur",
736+
market="binance",
737+
time_frame="1d",
738+
start_date="2023-12-01",
739+
end_date="2023-12-25",
740+
save=True,
741+
storage_path="./data"
742+
)
743+
pd_df = download(
744+
symbol="btc/eur",
745+
market="binance",
746+
time_frame="1d",
747+
start_date="2023-12-01",
748+
end_date="2023-12-25",
749+
pandas=True,
750+
save=True,
751+
storage_path="./data"
752+
)
753+
754+
# Calculate Moving Average Envelope for Polars DataFrame
755+
pl_df = moving_average_envelope(pl_df, source_column="Close", period=20, percentage=2.5)
756+
pl_df.show(10)
757+
758+
# Calculate Moving Average Envelope for Pandas DataFrame
759+
pd_df = moving_average_envelope(pd_df, source_column="Close", period=20, percentage=2.5)
760+
pd_df.tail(10)
761+
```
762+
763+
![MOVING_AVERAGE_ENVELOPE](https://github.com/coding-kitties/PyIndicators/blob/main/static/images/indicators/moving_average_envelope.png)
764+
765+
### Support and Resistance
766+
767+
Indicators that help identify potential support and resistance levels in the market.
768+
769+
#### Fibonacci Retracement
770+
771+
Fibonacci retracement levels are horizontal lines that indicate where support and resistance are likely to occur. They are based on Fibonacci numbers and are drawn between a swing high and swing low. The standard levels are 0.0 (0%), 0.236 (23.6%), 0.382 (38.2%), 0.5 (50%), 0.618 (61.8% - Golden Ratio), 0.786 (78.6%), and 1.0 (100%).
772+
773+
The calculation formula is:
774+
```
775+
Level Price = Swing High - (Swing High - Swing Low) × Fibonacci Ratio
776+
```
777+
778+
```python
779+
def fibonacci_retracement(
780+
data: Union[PdDataFrame, PlDataFrame],
781+
high_column: str = 'High',
782+
low_column: str = 'Low',
783+
levels: Optional[List[float]] = None,
784+
lookback_period: Optional[int] = None,
785+
swing_high: Optional[float] = None,
786+
swing_low: Optional[float] = None,
787+
result_prefix: str = 'fib'
788+
) -> Union[PdDataFrame, PlDataFrame]:
789+
```
790+
791+
Example
792+
793+
```python
794+
from investing_algorithm_framework import download
795+
796+
from pyindicators import fibonacci_retracement
797+
798+
pl_df = download(
799+
symbol="btc/eur",
800+
market="binance",
801+
time_frame="1d",
802+
start_date="2023-12-01",
803+
end_date="2023-12-25",
804+
save=True,
805+
storage_path="./data"
806+
)
807+
pd_df = download(
808+
symbol="btc/eur",
809+
market="binance",
810+
time_frame="1d",
811+
start_date="2023-12-01",
812+
end_date="2023-12-25",
813+
pandas=True,
814+
save=True,
815+
storage_path="./data"
816+
)
817+
818+
# Calculate Fibonacci retracement for Polars DataFrame
819+
pl_df = fibonacci_retracement(pl_df, high_column="High", low_column="Low")
820+
pl_df.show(10)
821+
822+
# Calculate Fibonacci retracement for Pandas DataFrame
823+
pd_df = fibonacci_retracement(pd_df, high_column="High", low_column="Low")
824+
pd_df.tail(10)
825+
```
826+
827+
![FIBONACCI_RETRACEMENT](https://github.com/coding-kitties/PyIndicators/blob/main/static/images/indicators/fibonacci_retracement.png)
828+
644829
### Pattern Recognition
645830

646831
#### Detect Peaks
140 KB
Loading
151 KB
Loading
67.3 KB
Loading

0 commit comments

Comments
 (0)