Hi guys I could really use some help. I'm not a programmer I'm just started out
Im trying to store every resulting calculated value of two tables and somehow store it into another table for later use.
Close = {1,2,6,2,2,...8} --livedata with a series of value upto 100
Open = {3,10,1,5,3,...10}--livedata with series of value upto 100
So here's my code
body = {}
For i = 1,100 do
if close[i] > open[i] then
V = close[i] - open[i]
else
V = open[i] - close[i]
end
table.insert(body,1,V)
end
for k,v in pairs(body) do print(k,v) end
Here's the result
1 2
2 2
3 2
4 2
5 2
100 2
It just keep repeating it last calculated value for a 100 times
I'd expect it the result to be something like this
1 2
2 8
3 5
4 3
5 1
100 2
Really appreciate it anyone who help