
    i`                         S SK Jr  S SKJrJrJrJrJr  S SKJ	r	  S SK
JrJrJr  S SKJrJrJr  \" SS9S 5       r    SS
\	S\S\S\S\S\S\S\S\	4S jjrg	)    )njit)cosexpnansqrt
zeros_like)Series)DictLikeIntIntFloat)v_offsetv_pos_defaultv_seriesT)cachec                     U R                   SU-  U-  pv[        U* U-  5      nSU-  [        SU-  5      -  n	X-  U	-
  S-   n
[        U 5      n[        U 5      n[        U 5      n[	        SU5       H/  nSU
-  X   XS-
     -   -  XUS-
     -  -   X-  XS-
     -  -
  X'   M1     [	        X5       H^  nSn[	        SU5       H  nXU   XU-
     -
  -  nM     X-  nX?-  U-  SU-
  XS-
     -  -   X'   X   S:w  d  ML  U[        X   5      -  X'   M`     U$ )N         g      ?r   g        )sizer   r   r   ranger   )xnkalphapisqrt2mratioabc_f_msresulti_sumjs                    T/var/www/html/trading/venv/lib/python3.13/site-packages/pandas_ta/trend/trendflex.pynb_trendflexr)      s:   vvq5y1}uRC%KA	AC%K  A		AA	AB
Q-C]F1a[a14!E(?+aQU)m;aebQi>OO  1[q!AqEB1uI%%D 	$E	SQZ'??6S=tCF|+FI  M    Ncloselengthsmoothr   r   r   offsetkwargsreturnc                    [        US5      n[        US5      n[        U [        X5      S-   5      n U c  g[        US5      n[        US5      n[        US5      n[        U5      nU R	                  5       n[        XX#XE5      n	[        U	SU& [        XR                  S9n	US:w  a  U	R                  U5      n	S	U;   a  U	R                  US	   S
S9  SU SU SU 3U	l        SU	l        U	$ )u  Trendflex

This trend indicator, by John F. Ehlers, complements the "reflex"
indicator.

Sources:
    * [rengel8](https://github.com/rengel8) (2021-08-11) based on the
      implementation from "ProRealCode" (2021-08-11)
    * [prorealcode](https://www.prorealcode.com/prorealtime-indicators/reflex-and-trendflex-indicators-john-f-ehlers/)
    * [traders](http://traders.com/Documentation/FEEDbk_docs/2020/02/TradersTips.html)

Parameters:
    close (Series): ```close``` Series
    length (int): The period. Default: ```20```
    smooth (int): Super Smoother period. Default: ```20````
    alpha (float): Alpha weight. Default: ```0.04```
    pi (float): Ehlers's truncated value: ```3.14159```.
        Default: ```3.14159```
    sqrt2 (float): Ehlers's truncated value: ```1.414```.
        Default: ```1.414```
    offset (int): Post shift. Default: ```0```

Other Parameters:
    fillna (value): ```pd.DataFrame.fillna(value)```

Returns:
    (Series): 1 column

Note:
    John F. Ehlers introduced two indicators within the article
    "Reflex: A New Zero-Lag Indicator” in February 2020, TASC magazine.
    One of which is Reflex, a lag reduced cycle indicator. Both indicators
    (Reflex/Trendflex) are oscillators that complement each other with the
    focus for cycle and trend.
   r   Ng{Gz?gn!	@g9v?)indexr   fillnaT)inplace
TRENDFLEX__trend)r   r   maxr   to_numpyr)   r   r	   r3   shiftr4   namecategory)
r+   r,   r-   r   r   r   r.   r/   np_closer$   s
             r(   	trendflexr?   '   s    T 62&F62&FUC/!34E}%&E	r7	#B%'EfF ~~H(F2EFF7FOF++.F {f% 6fX&5 vhaxq8FKFOMr*   )NNNNNN)numbar   numpyr   r   r   r   r   pandasr	   pandas_ta._typingr
   r   r   pandas_ta.utilsr   r   r   r)   r?    r*   r(   <module>rF      s     1 1  5 5 = = D 6 "&*.+/	HHHH'H 	H !)H 	H #+	H
 Hr*   