(df, n)
return out(SETTINGS, df, result)
Donchian Channel
Donchian Channel
Donchian Channel
def DONCH(df, n):
    """
    Donchian Channel
    """
    i = 0
    DC_l = []
    while i < n - 1:
        DC_l.append(0)
        i = i + 1
    i = 0
    while i + n - 1 < len(df) - 1:  # df.index[-1]:
        DC = max(df['High'].ix[i:i + n - 1]) - min(df['Low'].ix[i:i + n - 1])
        DC_l.append(DC)
        i = i + 1
    DonCh = pd.Series(DC_l, name='Donchian_' + str(n))
    result = DonCh.shift(n - 1)
    return out(SETTINGS, df, result)
def DONCH ( df , n ) : i = 0 DC_l = [ ] while i < n - 1 : DC_l . append ( 0 ) i = i + 1 i = 0 while i + n - 1 < len ( df ) - 1 : # df.index[-1]: DC = max ( df [ 'High' ] . ix [ i : i + n - 1 ] ) - min ( df [ 'Low' ] . ix [ i : i + n - 1 ] ) DC_l . append ( DC ) i = i + 1 DonCh = pd . Series ( DC_l , name = 'Donchian_' + str ( n ) ) result = DonCh . shift ( n - 1 ) return out ( SETTINGS , df , result )