Message from Python discussions
December 2018
—
list_1 = [1, 2, 3, 4, 5, 6]
list_2 = []
for ...
your magic here, append elements to list_2
HAO = (Open of previous bar + Close of previous bar) / 2
HAC = (Open + High + Low + Close) / 4
HAH = Highest of High, Open, or Close
HAL = Lowest of Low, Open, or Close
— So i have a list with each Open, High, Low, Close
— And i try to do this:
for x in opens:
hsopens+=[(opens[-2]+closes[-2])/2]
— But my approach is not correct, i am trying to figure out how to solve this formula
— So i have the list of opens for example that is:
[232,12435,343,12312,5545]
and closes that is:
[9343,5452,2341,6767]
For example, and i want to deploy this formula
— HAO
— I tought at first that opens[-2] would do the trick but i need to do it recursively trough all the list
— So i think i need an aditional forloop
— Use simple list comprehension
— Much easier to read and write
— Yes i've found solution using forloop