
    'i                     b    d dl mZmZmZmZ d dlZddlmZ ddgZ	 G d dej                        Zy)    )absolute_importdivisionprint_functionunicode_literalsN   )MovAvhaDeltahaDc                        e Zd ZdZdZdZddej                  fdfZ e	d      Z
 e	 e	d	
       e	ddd            Z fdZ xZS )r	   a  Heikin Ashi Delta. Defined by Dan Valcu in his book "Heikin-Ashi: How to
    Trade Without Candlestick Patterns ".

    This indicator measures difference between Heikin Ashi close and open of
    Heikin Ashi candles, the body of the candle.

    To get signals add haDelta smoothed by 3 period moving average.

    For correct use, the data for the indicator must have been previously
    passed by the Heikin Ahsi filter.

    Formula:
      - haDelta = Heikin Ashi close - Heikin Ashi open
      - smoothed = movav(haDelta, period)

    )r
   )r	   smoothed)period   movav)
autoheikinTT)subplotred)colorgrey)r   green)r   r   )r   _fill_gt_fill_ltc                    | j                   j                  r)t        j                  j	                  | j
                        n| j
                  }|j                  |j                  z
  x| j                  _	        }| j                   j                  || j                   j                        | j                  _        t        t        | ;          y )N)r   )pr   btind
HeikinAshidatacloseopenlinesr	   r   r   r   super__init__)selfdhd	__class__s      [/var/www/app/trading-bot/venv/lib/python3.12/site-packages/backtrader/indicators/hadelta.pyr"   zhaDelta.__init__B   s}    ,0FF,=,=BFFdii(499"#''AFF"22

R"ffll2dffmmlD

gt%'    )__name__
__module____qualname____doc__aliasr    r   SMAparamsdictplotinfo	plotlinesr"   __classcell__)r&   s   @r'   r	   r	       sc      E#E 		%))F D!H5!F\JOI
( (r(   )
__future__r   r   r   r   
backtraderr    r   __all__	Indicatorr	    r(   r'   <module>r:      s3   ** *   e
'(bll '(r(   