
    'i0
                     P    d dl ZdgZ G d dej                  j                        Zy)    NFractalc            
       t    e Zd ZdZdZ eddd      Z e edddd	d
       edddd	d
            ZdZd Z	y)r   zc
    References:
        [Ref 1] http://www.investopedia.com/articles/trading/06/fractals.asp

    )fractal_bearishfractal_bullishFT)subplotplotlinelabelsplot^g      @	lightbluefull )marker
markersizecolor	fillstylelsv))period   )bardistgQ?)shift_to_potential_fractal   c                    | j                   j                  j                  | j                  j                        }t        |      }|j                  |      }|| j                  j                  k(  r3|d| j                  j                  z   z  | j                  j                  d<   | j                   j                  j                  | j                  j                        }t        |      }|j                  |      }|| j                  j                  k(  r4|d| j                  j                  z
  z  | j                  j                  d<   y y )N)size   )datahighgetpr   maxindexr   r   linesr   lowminlr   )selflast_five_highsmax_valmax_idxlast_five_lowsmin_valmin_idxs          `/var/www/app/trading-bot/venv/lib/python3.12/site-packages/backtrader/studies/contrib/fractal.pynextzFractal.next4   s     ))..,,$&&--,@o&!''0dff777-4DFFNN8J-KDJJ&&r* ***>n% &&w/dff777)0A4F)GDFF""2& 8    N)
__name__
__module____qualname____doc__r#   dictplotinfo	plotlinesparamsr/    r0   r.   r   r      sY    
 3EE%dCHCC{'-"6CC{'-"6IFHr0   )
backtraderbt__all__indPeriodNr   r9   r0   r.   <module>r?      s)   0  +(Hbffnn (Hr0   