Message from Python discussions

December 2018

— Result:

[2, 3, 4]

— 

Yes but when applied to hshighs it says

TypeError: '>' not supported between instances of 'tuple' and 'int'

— 

    hshighs = [max(a) for a in hshighslows if a > 0]

— And when try for print the last element of the list
hslows[-1]
it says list out of range

— You don't need that condition there

— Look at this

— This is the output

— Yes you slice the list skipping the first element

— Right?

— 

    hshighslows = zip(opens,closes,highs,lows)


hsopens=[(opens[i-1] + closes[i-1])/2 for i, x in enumerate(opens) if i > 0]
hscloses=[(opens[i] + highs[i] + lows[i] + closes[i])/4 for i, x in enumerate(opens) if i > 0]
hshighs = [max(a) for a in hshighslows]
hslows = [min(a) for a in hshighslows]
I do:
    print("_______Heikin Ashi Open_______")
print(hsopens[-1])
print("_______Heikin Ashi Close______")

print(hscloses[-1])
print("_______Heikin Ashi High_______")
print(hshighs[-1])
print("_______Heikin Ashi Low______")
print(hslows[-1])

In the Heikin Ashi low it returns out of range

Message permanent page

— Have you tried printing hslows and checkinh what it contains?

— It contains nothing