You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`
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.
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
+
defmoving_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
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
+
deffibonacci_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
0 commit comments