You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function AD()
local out = {}
for i = 1, #CLOSE, 1 do
hi=high[i];
lo=low[i];
cl=close[i];
sum=(cl-lo)-(hi-cl);
if hi==lo then
sum=0.0;
else
sum=(sum/(hi-lo))*VOLUME[i];
end
if i>1 then
sum=sum+out[i-1];
end
out[i]=sum;
end
return out
end
the following function return table:
function SMA(source, period)
if type(source) == type(1) then
if source == 0 then
source = CLOSE
elseif source == 1 then
source = OPEN
elseif source == 2 then
source = HIGH
elseif source == 3 then
source = LOW
elseif source == 4 then
source = MEDIAN
elseif source == 5 then
source = TYPICAL
elseif source == 6 then
source = WEIGHTED
end
end
local sum = SUM(source, period)
local out = {}
for j = 1, #sum, 1 do out[j] = sum[j] / period end
return out
end
why is first function return userdata? i want table, process is easy:
//c++
auto ret_val = lua["blabla"].get<std::vector>();
How do I process userdata?
The text was updated successfully, but these errors were encountered:
the following function return userdata:
function AD()
local out = {}
for i = 1, #CLOSE, 1 do
hi=high[i];
lo=low[i];
cl=close[i];
sum=(cl-lo)-(hi-cl);
if hi==lo then
sum=0.0;
else
sum=(sum/(hi-lo))*VOLUME[i];
end
if i>1 then
sum=sum+out[i-1];
end
end
return out
end
the following function return table:
function SMA(source, period)
if type(source) == type(1) then
if source == 0 then
source = CLOSE
elseif source == 1 then
source = OPEN
elseif source == 2 then
source = HIGH
elseif source == 3 then
source = LOW
elseif source == 4 then
source = MEDIAN
elseif source == 5 then
source = TYPICAL
elseif source == 6 then
source = WEIGHTED
end
end
local sum = SUM(source, period)
local out = {}
for j = 1, #sum, 1 do out[j] = sum[j] / period end
return out
end
why is first function return userdata? i want table, process is easy:
//c++
auto ret_val = lua["blabla"].get<std::vector>();
How do I process userdata?
The text was updated successfully, but these errors were encountered: