If the for only does one iteration it correctly calculates the value to plot but if I do it two or more times, which is what I need, the variable is calculated incorrectly.
size = array.size(etf_sectoriales)
for m = 0 to size - 1
float fractal_convergence = na
[wave_up_one,wave_down_one,structure_up_one,structure_down_one] = william_fractal(array.get(etf_sectoriales,m),temporality_one,n)
[wave_up_two,wave_down_two,structure_up_two,structure_down_two] = william_fractal(array.get(etf_sectoriales,m),temporality_two,n)
[wave_up_three,wave_down_three,structure_up_three,structure_down_three] = william_fractal(array.get(etf_sectoriales,m),temporality_three,n)
first_value := (wave_up_one ? weight_one : 0 ) + (wave_down_one ? -weight_one : 0) + (structure_up_one ? weight_one : 0) + (structure_down_one ? -weight_one : 0)
second_value := (wave_up_two ? weight_two : 0 ) + (wave_down_two ? -weight_two : 0) + (structure_up_two ? weight_two : 0) + (structure_down_two ? -weight_two : 0)
third_value := (wave_up_three ? weight_three : 0 ) + (wave_down_three ? -weight_three : 0) + (structure_up_three ? weight_three : 0) + (structure_down_three ? -weight_three : 0)
fractal_convergence := first_value + second_value + third_value
array.push(fractal_convergence_array,fractal_convergence)
plot(array.get(fractal_convergence_array,0))
My idea is to have an array with the calculation done for n different tickers and then plot each element of the array