
    Q-j@                         d dl mZmZmZmZ d dlmZmZ d dlm	Z	m
Z
mZ d dlmZ d dlmZmZmZmZmZmZ ddlmZ 	 	 	 	 dd	ed
e
de
dedede
de
de	defdZy)    )isnanmaximumminimumnan)	DataFrameSeries)DictLikeIntIntFloat)ma)v_driftv_mamodev_offsetv_pos_defaultv_scalarv_series   )rsiNcloselengthsmoothfactormamodedriftoffsetkwargsreturnc                     t        |d      }t        |d      }d|z  dz
  }||z   }	t        | |	      } | yt        |d      }t        |d      }t	        |      }t        |      }t        | |      }
|dk7  r|j                         d   nd	}t        ||
|
      }|j                  |      j                         }t        t        |            ryt        d||
      }t        t        |            ry|t        d||
      z  }t        t        |            ry||z   }||z
  }| j                  }t        d| j                        }t        d| j                        }t        d| j                        }t        |j                   d   | j                        }t        t"        | j                        }t        t"        | j                        }t%        d|      D ]/  }|j                   |   |j                   |dz
     }}|j                   |dz
     |j                   |dz
     }}|j                   |dz
     |j                   |dz
     }}||kD  r,||kD  r't'        ||j                   |         |j                   |<   n|j                   |   |j                   |<   ||k  r,||k  r't)        ||j                   |         |j                   |<   n|j                   |   |j                   |<   ||kD  r||k  s
||k  rA||k\  r<d|j                   |<   |j                   |   x|j                   |<   |j                   |<   W||kD  r||k  s
||k  rA||k\  r<d|j                   |<   |j                   |   x|j                   |<   |j                   |<   |j                   |dz
     |j                   |<   |j                   |   dk(  r-|j                   |   x|j                   |<   |j                   |<   |j                   |   x|j                   |<   |j                   |<   2 |dk7  rD|j+                  |      }|j+                  |      }|j+                  |      }|j+                  |      }d|v rX|j-                  |d   d       |j-                  |d   d       |j-                  |d   d       |j-                  |d   d       | d| d| d| } d|  |_        d|  d|j1                          d|_        d|  |_        d|  |_        dx|_        |_        |j2                  x|_        |_        |j.                  ||j.                  ||j.                  ||j.                  |i}!t5        |!| j                        }"d|  |"_        |j2                  |"_        |"S )u  Quantitative Qualitative Estimation

    This indicator is similar to SuperTrend but uses a Smoothed ```rsi```
    with upper and lower bands.

    Sources:
        * [prorealcode](https://www.prorealcode.com/prorealtime-indicators/qqe-quantitative-qualitative-estimation/)
        * [tradingpedia](https://www.tradingpedia.com/forex-trading-indicators/quantitative-qualitative-estimation)
        * [tradingview](https://www.tradingview.com/script/IYfA9R2k-QQE-MT4/)

    Parameters:
        close (Series): ```close``` Series
        length (int): RSI period. Default: ```14```
        smooth (int): RSI smoothing period. Default: ```5```
        factor (float): QQE Factor. Default: ```4.236```
        mamode (str): See ```help(ta.ma)```. Default: ```"ema"```
        drift (int): Difference amount. Default: ```1```
        offset (int): Post shift. Default: ```0```

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

    Returns:
        (DataFrame): 4 columns

    Tip: Trend
        * Long: When the Smoothed RSI crosses the previous upperband.
        * Short: When the Smoothed RSI crosses the previous lowerband.

    Note: See also
        * QQE.mq5 by EarnForex Copyright © 2010
        * Tim Hyder (2008) version
        * Roman Ignatov (2006) version
             r   Ngl@emar    )r   )indexfillnaT)inplace_QQE_RSIMAQQElQQEsmomentum)r   r   r   r   r   r   r   lowerr   diffabsallr   sizer   r$   iatr   ranger   r   shiftr&   nameuppercategoryr   )#r   r   r   r   r   r   r   r   wilders_length_lengthrsi__modersi_ma	rsi_ma_trsmoothed_rsi_tr_madar	upperband	lowerbandmlongshorttrendqqeqqe_long	qqe_shortic_rsip_rsic_longp_longc_shortp_short_propsdatadfs#                                      d/Users/jameslopez/projects/TradingBot25/.venv/lib/python3.12/site-packages/pandas_ta/momentum/qqe.pyrH   rH      s   R 62&F61%FZ!^Nv%GUG$E}fe$Ffe$FENEfF ufD!'5FLLN1bEV,F E"&&(I
5 E9^D
5#$%
2e/G
GC
5: II

A!5;;'D1EKK(E1EKK(E
Aekk
2Cc-Hs%++.I1a[zz!}fjjQ&7u!a%$((1q5/ 99QU+UYYq1u-= 6>efn!&)--*:;DHHQK#--*DHHQK 7?uw"7IMM!,<=EIIaL$==+EIIaL
 GOg%7"2EIIaL+/88A;6CGGAJafnf_&EIIaL,1IIaL8CGGAJq) 99QU+EIIaLyy|q /3xx{:
X\\!_05		!<
Y]]1-C H {f%iizz&!F# 6fX&5

6(#T
2x($7)48 waxq&2FVH~CHxtEKKM?"5FK6(OHMF8_IN%//CL6?-0\\9H	* 	#V 	x	D 
4u{{	+BF8nBG,,BKI    )NNNNNN)numpyr   r   r   r   pandasr   r   pandas_ta._typingr	   r
   r   pandas_ta.mar   pandas_ta.utilsr   r   r   r   r   r   r   strrH    rV   rU   <module>r^      s    . . $ 5 5   
 "&+/%)	\\\\ (\ \  #\ 	\ #+	\
 \rV   