Files
pandas-ta/pandas_ta/overlap/hl2.py
T
2019-05-20 13:25:33 -07:00

22 lines
464 B
Python

# -*- coding: utf-8 -*-
from ..utils import get_offset, verify_series
def hl2(high, low, offset=None, **kwargs):
"""Indicator: HL2 """
# Validate Arguments
high = verify_series(high)
low = verify_series(low)
offset = get_offset(offset)
# Calculate Result
hl2 = 0.5 * (high + low)
# Offset
if offset != 0:
hl2 = hl2.shift(offset)
# Name & Category
hl2.name = "HL2"
hl2.category = 'overlap'
return hl2