def calculate_accumulation_distribution(open, high, low, close, volume):
    """
    Calculates changes in accumulation/distribution line.
    A/D = ((Close - Low) - (High - Close))/(High - Low)

    Args:
        open: Float representing exchange rate at the beginning of an interval
        high: Float representing the highest exchange rate during the interval
        low: Float respresenting the lowest exchange rate during the interval
        close: Float representing the exchange rate at the end of an interval
        volume: Float representing the number of trades during the interval

    Returns:
        Float representing the change in accumulation/distribution
    """
    if high == low:
        # Prevent x/0 undefined error
        return 0
    return ((2*close - low - high)/(high - low))*volume