
    Q-j^                     v    d dl mZ d dlmZmZ d dlmZ d dl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fdZy)    )Series)DictLikeInt)Imports)v_offsetv_pos_defaultv_seriesv_talib   )smaNcloselengthtaliboffsetkwargsreturnc                 z   t        |d      }t        | |      } | yt        |      }t        |      }t        d   r|rddlm}  || |      }n-t        d|dz   z        }t        | ||      }	t        |	||      }|dk7  r|j                  |      }d	|v r|j                  |d	   d
       d| |_        d|_        |S )a  Triangular Moving Average

    This indicator is a weighted moving average where the shape of the
    weights are triangular with the greatest weight is in the middle
    of the period.

    Sources:
        * [tradingtechnologies](https://www.tradingtechnologies.com/help/x-study/technical-indicator-definitions/triangular-moving-average-trima/)

    Parameters:
        close (Series): ```close``` Series
        length (int): The period. Default: ```10```
        talib (bool): If installed, use TA Lib. Default: ```True```
        offset (int): Post shift. Default: ```0```

    Other Parameters:
        adjust (bool): Default: True
        fillna (value): ```pd.DataFrame.fillna(value)```

    Returns:
        (Series): 1 column

    Note:
        tma = sma(sma(src, ceil(length / 2)), floor(length / 2) + 1)  # Tradingview
        trima = sma(sma(x, n), n)  # Tradingview

    Warning:
        TA-Lib Correlation: ```np.float64(0.9991752493891967)```

    Tip:
        Corrective contributions welcome!
    
   Nr   r   )TRIMAg      ?r   )r   r   fillnaT)inplaceTRIMA_overlap)r   r	   r
   r   r   r   r   roundr   shiftr   namecategory)
r   r   r   r   r   mode_talr   trimahalf_lengthsma1s
             e/Users/jameslopez/projects/TradingBot25/.venv/lib/python3.12/site-packages/pandas_ta/overlap/trima.pyr   r   
   s    J 62&FUF#E}u~HfF wHeV$C6A:./5H=DH= {F# 6VH%t4 &"EJENL    )NNN)pandasr   pandas_ta._typingr   r   pandas_ta.mapsr   pandas_ta.utilsr   r   r	   r
   r   boolr    r#   r"   <module>r*      s]     + " F F 
 6:CCC.2CC"*C Cr#   