Nov-02-2022, 03:22 PM
Works fine for me.
cma = 0 max_close = 10000 for index in range(10): fibo = (max_close - (3853.5)) / (max_close - cma) # Will use current cma value, not always zero print(fibo, cma) cma = cma + 100
0.61465 0 0.6208585858585859 100 0.6271938775510204 200 0.6336597938144329 300 0.6402604166666667 400 0.647 500 0.6538829787234043 600 0.6609139784946236 700 0.6680978260869566 800 0.6754395604395604 900Of cource cma may not change based on the equations used to calculate cma.
cma = 0 # <- Assigned outside any loop max_close = 10000 for index in range(10): fibo = (max_close - (3853.5)) / (max_close - cma) # Will use current cma value, not always zero print(fibo, cma) cma = cma **2
Output:0.61465 0
0.61465 0
0.61465 0
0.61465 0
0.61465 0
0.61465 0
0.61465 0
0.61465 0
0.61465 0
0.61465 0
If you initialize cma = 0 outside of any loop and assign a different value to cma inside the loop, fibo will change value.