# Path: pyti/catch_errors.py
# def check_for_period_error(data, period):
# def check_for_input_len_diff(*args):
# 
# Path: pyti/smoothed_moving_average.py
# def smoothed_moving_average(data, period):
#     """
#     Smoothed Moving Average.
# 
#     Formula:
#     smma = avg(data(n)) - avg(data(n)/n) + data(t)/n
#     """
#     catch_errors.check_for_period_error(data, period)
#     series = pd.Series(data)
#     return series.ewm(alpha = 1.0/period).mean().values.flatten()
# 
# Path: pyti/average_true_range.py
# def average_true_range(close_data, period):
#     """
#     Average True Range.
# 
#     Formula:
#     ATRt = ATRt-1 * (n - 1) + TRt / n
#     """
#     tr = true_range(close_data, period)
#     atr = smoothed_moving_average(tr, period)
#     atr[0:period-1] = tr[0:period-1]
#     return atr


import numpy as np
from pyti import catch_errors
from pyti.smoothed_moving_average import (
    smoothed_moving_average as smma
    )
from pyti.average_true_range import (
    average_true_range as atr
    )
from six.moves import range
            ndm.append(0)

    return ndm


def positive_directional_index(close_data, high_data, low_data, period):
    """
    Positive Directional Index (+DI).

    Formula:
    +DI = 100 * SMMA(+DM) / ATR
    """
    catch_errors.check_for_input_len_diff(close_data, high_data, low_data)
    pdi = (100 *
           smma(positive_directional_movement(high_data, low_data), period) /
           atr(close_data, period)
           )
    return pdi


def negative_directional_index(close_data, high_data, low_data, period):
    """
    Negative Directional Index (-DI).

    Formula:
    -DI = 100 * SMMA(-DM) / ATR
    """
    catch_errors.check_for_input_len_diff(close_data, high_data, low_data)
    ndi = (100 *
           smma(negative_directional_movement(high_data, low_data), period) /

# Path: pyti/catch_errors.py
# def check_for_period_error(data, period):
# def check_for_input_len_diff(*args):
# 
# Path: pyti/smoothed_moving_average.py
# def smoothed_moving_average(data, period):
#     """
#     Smoothed Moving Average.
# 
#     Formula:
#     smma = avg(data(n)) - avg(data(n)/n) + data(t)/n
#     """
#     catch_errors.check_for_period_error(data, period)
#     series = pd.Series(data)
#     return series.ewm(alpha = 1.0/period).mean().values.flatten()
# 
# Path: pyti/average_true_range.py
# def average_true_range(close_data, period):
#     """
#     Average True Range.
# 
#     Formula:
#     ATRt = ATRt-1 * (n - 1) + TRt / n
#     """
#     tr = true_range(close_data, period)
#     atr = smoothed_moving_average(tr, period)
#     atr[0:period-1] = tr[0:period-1]
#     return atr


# Path: pyti/directional_indicators.py
import numpy as np
from pyti import catch_errors
from pyti.smoothed_moving_average import (
    smoothed_moving_average as smma
    )
from pyti.average_true_range import (
    average_true_range as atr
    )
from six.moves import range

            ndm.append(0)

    return ndm


def positive_directional_index(close_data, high_data, low_data, period):
    """
    Positive Directional Index (+DI).

    Formula:
    +DI = 100 * SMMA(+DM) / ATR
    """
    catch_errors.check_for_input_len_diff(close_data, high_data, low_data)
    pdi = (100 *
           smma(positive_directional_movement(high_data, low_data), period) /
           atr(close_data, period)
           )
    return pdi


def negative_directional_index(close_data, high_data, low_data, period):
    """
    Negative Directional Index (-DI).

    Formula:
    -DI = 100 * SMMA(-DM) / ATR
    """
    catch_errors.check_for_input_len_diff(close_data, high_data, low_data)
    ndi = (100 *
           smma(negative_directional_movement(high_data, low_data), period) /

           atr(close_data, period)