Settings =
{Name = «Fracta_l»,
period=31,
line =
{{
Name = «Level_High»,
Color = RGB(0,255,0),
Type = TYPE_POINT,
Width = 1
},{
Name = «Level_Low»,
Color = RGB(255,0,0),
Type = TYPE_POINT,
Width = 1
}}}
idx_prosl=0
function Init()
return #Settings.line
end
function OnCalculate(idx)
if idx==1 then
P = math.floor(Settings.period/2)*2+1
t_H,t_L={},{}
end
if idx~=nil and idx>P then
if idx_prosl~=idx then
local l=idx-P
for l=l,idx-1 do
t_H[l]=H(l)
t_L[l]=L(l)
end
if t_H[#t_H-(P-1)/2]==math.max(unpack(t_H,#t_H-P+1,#t_H)) then
H_ind_value=t_H[#t_H-(P-1)/2]
end
if t_L[#t_L-(P-1)/2]==math.min(unpack(t_L,#t_L-P+1,#t_L)) then
L_ind_value=t_L[#t_L-(P-1)/2]
end
end
else
H_ind_value=nil
L_ind_value=nil
end
idx_prosl=idx
return H_ind_value, L_ind_value
end