<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Форум QUIK [тема: Перестал работать скрипт в 11.1.1.11]</title>
		<link>http://forum.quik.ru</link>
		<description>Новое в теме Перестал работать скрипт в 11.1.1.11 форума  на сайте Форум QUIK [forum.quik.ru]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Sun, 03 May 2026 16:41:16 +0300</pubDate>
		<item>
			<title>Перестал работать скрипт в 11.1.1.11 </title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message74678/topic8536/">Перестал работать скрипт в 11.1.1.11 </a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_S7PgYkgH" href="/user/16131/" bx-tooltip-user-id="16131">VPM</a> написал:<br /><noindex><a href="/user/909/" target="_blank" rel="nofollow">sandyman</a></noindex>, &nbsp;Вам просто нужно заменить unpack на table.unpack, это изменения в версии lua/<br />=============<br />Заработало! Огромное спасибо!) <br />
			<i>28.02.2024 19:19:32, sandyman.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message74678/topic8536/</link>
			<guid>http://forum.quik.ru/messages/forum10/message74678/topic8536/</guid>
			<pubDate>Wed, 28 Feb 2024 19:19:32 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Перестал работать скрипт в 11.1.1.11 </title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message74676/topic8536/">Перестал работать скрипт в 11.1.1.11 </a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<a class="blog-p-user-name" id="bp_xtR9RtJ3" href="/user/909/" bx-tooltip-user-id="909">sandyman</a>, &nbsp;Вам просто нужно заменить unpack на table.unpack, это изменения в версии lua/ <br />
			<i>28.02.2024 19:12:41, VPM.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message74676/topic8536/</link>
			<guid>http://forum.quik.ru/messages/forum10/message74676/topic8536/</guid>
			<pubDate>Wed, 28 Feb 2024 19:12:41 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Перестал работать скрипт в 11.1.1.11 </title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message74675/topic8536/">Перестал работать скрипт в 11.1.1.11 </a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Добрый день,<br /><br />После обновления квика до версии 11.1.1.11 перестал работать скрипт отрисовывающий горизонтальные уровни (lineFractals), который работал у меня с незапамятных времён. <br />Пожалуйста, подскажите как поправить индикатор. Писал его не я и сам не смогу разобраться.<br /><br /><U><B>Вид индикатора:</B></U> <noindex><a href="https://ibb.co/GCPfV3D" target="_blank" rel="nofollow">https://ibb.co/GCPfV3D</a></noindex><br /><br />[FILE ID=11851]<br /><br /><B><U>Выдаваемая ошибка: </U></B>&quot;C:\QUIK_VTB\LuaIndicators\lineFractals.lua:114: attempt to call a nil value (global &#39;unpack&#39;)&quot;<br /><br /><B><U>Текст индикатора:</U></B><br /><br />--nnh Glukk Inc.<br />--modifide fractals<br /><br />--logfile=io.open(getWorkingFolder()..&quot;\\LuaIndicators\\qlua_log.txt&quot;, &quot;w&quot;)<br /><br />lines = 50<br /><br />Settings = {<br />Name = &quot;*line Fractals&quot;, <br />Period = 20,<br />line = {{<br />		Name = &quot;FRACTALS - Down&quot;, <br />		Type = TYPE_POINT, <br />		Color = RGB(255, 0, 255)<br />		},<br />		{<br />		Name = &quot;FRACTALS - Up&quot;, <br />		Type = TYPE_POINT, <br />		Color = RGB(0, 128, 255)<br />		}<br />		}<br />}<br /><br /> -- Пользовательcкие функции<br />function myLog(text)<br /><br />	logfile:write(tostring(os.date(&quot;%c&quot;,os.time()))..&quot; &quot;..text..&quot;\n&quot;);<br />	logfile:flush();<br />	LASTLOGSTRING = text;<br /> <br />end<br /> <br />function toYYYYMMDDHHMMSS(datetime)<br />	if type(datetime) ~= &quot;table&quot; then<br />	 &nbsp; --message(&quot;в функции toYYYYMMDDHHMMSS неверно задан параметр: datetime=&quot;..tostring(datetime))<br />	 &nbsp; return &quot;&quot;<br />	else<br />	 &nbsp; local Res = tostring(datetime.year)<br />	 &nbsp; if #Res == 1 then Res = &quot;000&quot;..Res end<br />	 &nbsp; local month = tostring(datetime.month)<br />	 &nbsp; if #month == 1 then Res = Res..&quot;/0&quot;..month; else Res = Res..&#39;/&#39;..month; end<br />	 &nbsp; local day = tostring(datetime.day)<br />	 &nbsp; if #day == 1 then Res = Res..&quot;/0&quot;..day; else Res = Res..&#39;/&#39;..day; end<br />	 &nbsp; local hour = tostring(datetime.hour)<br />	 &nbsp; if #hour == 1 then Res = Res..&quot; 0&quot;..hour; else Res = Res..&#39; &#39;..hour; end<br />	 &nbsp; local minute = tostring(datetime.min)<br />	 &nbsp; if #minute == 1 then Res = Res..&quot;:0&quot;..minute; else Res = Res..&#39;:&#39;..minute; end<br />	 &nbsp; local sec = tostring(datetime.sec);<br />	 &nbsp; if #sec == 1 then Res = Res..&quot;:0&quot;..sec; else Res = Res..&#39;:&#39;..sec; end;<br />	 &nbsp; return Res<br />	end<br />end --toYYYYMMDDHHMMSS<br /> <br />function isnil(a,b)<br />	if a == nil then<br />	 &nbsp; return b<br />	else<br />	 &nbsp; return a<br />	end;<br />end<br /><br />function Init() <br />	func = FRACTALS()<br /><br />	--добавляем линии<br />	for i = 1, lines do<br />		Settings.line&#91;i+2&#93; = {Color = RGB(0, 128, 255), Type = TYPET_BAR, Width = 1} --upLines<br />	end<br />	for i = lines+1, 2*lines do<br />		Settings.line&#91;i+2&#93; = {Color = RGB(255, 0, 255), Type = TYPET_BAR, Width = 1} --downLines<br />	end<br /><br />	return #Settings.line<br />end<br /><br />function OnCalculate(Index) <br />	return func(Index, Settings)<br />end<br /><br />function FRACTALS() --Fractals (&quot;FRACTALS&quot;)<br />	<br />	local H_tmp={}<br />	local L_tmp={}<br /><br />	--стеки линий<br />	local upLines = {}<br />	local downLines = {}<br />	local countUpLines = 0<br />	local countDownLines = 0<br /><br />	return function (I, Fsettings, ds)<br /><br />		local Fsettings=(Fsettings or {})<br />		local P = (Fsettings.Period or 5)<br /><br />		P = math.floor(P/2)*2+1<br />		H_tmp&#91;I&#93;=Value(I,&quot;High&quot;,ds)<br />		L_tmp&#91;I&#93;=Value(I,&quot;Low&quot;,ds)<br /><br />		if I == 1 then<br />			upLines = {}<br />			downLines = {}<br />			countUpLines = 0<br />			countDownLines = 0<br />			return nil<br />		end<br /><br />		local high = Value(I,&quot;High&quot;,ds)<br />		local low = Value(I,&quot;Low&quot;,ds)<br />		--myLog(&quot;T(&quot;..tostring(I)..&quot;); &quot;..isnil(toYYYYMMDDHHMMSS(T(I)))..&#39; high &#39;..tostring(high)..&#39; low &#39;..tostring(low))<br /><br />		if I&gt;=P then<br />			local S = I-P+1+math.floor(P/2)<br />			local val_h=math.max(unpack(H_tmp,I-P+1,I)) <br />			local val_l=math.min(unpack(L_tmp,I-P+1,I))<br />			local L = Value(S,&quot;Low&quot;,ds)<br />			local H = Value(S,&quot;High&quot;,ds)<br />			if (val_h == H) and (val_h &gt;0) <br />				and (val_l == L) and (val_l &gt; 0) then<br />					if ds then return S,S else<br />						SetValue(S, 1, val_l)<br />						SetValue(S, 2, val_h)<br />					end<br />			else<br />				if (val_h == H) and (val_h &gt;0) then<br />					if ds then return S,nil else<br />						SetValue(S, 1, nil)<br />						SetValue(S, 2, val_h)<br />						countUpLines = countUpLines + 1<br />						if countUpLines &gt; 50 then countUpLines = 1 end<br />						for i=S,I do<br />							SetValue(i, 2+countUpLines, val_h)<br />						end<br />						--myLog(&#39;-------- add up index &#39;..tostring(S)..&#39; val &#39;..tostring(val_h)..&#39; line &#39;..tostring(countUpLines))<br />						upLines&#91;countUpLines&#93; = val_h<br />					end<br />				end<br />				if (val_l == L) and (val_l &gt; 0) then<br />					if ds then return nil,S else<br />						SetValue(S, 1, val_l)<br />						SetValue(S, 2, nil)<br />						countDownLines = countDownLines + 1<br />						if countDownLines &gt; 50 then countDownLines = 1 end<br />						for i=S,I do<br />							SetValue(i, 2+lines+countDownLines, val_l)<br />						end<br />						--myLog(&#39;-------- add down index &#39;..tostring(S)..&#39; val &#39;..tostring(val_l)..&#39; line &#39;..tostring(countDownLines))<br />						downLines&#91;countDownLines&#93; = val_l<br />					end<br />				end<br />			end<br />			<br />		end<br />		<br />		--вывод линий<br />		local i=1<br />		while i&lt;=lines do<br />			--myLog(&#39;up i &#39;..tostring(i)..&#39; val &#39;..tostring(upLines&#91;i&#93;))<br />			if upLines&#91;i&#93;~=nil then<br />				SetValue(I-1, 2+i, upLines&#91;i&#93;)<br />				if high&gt;upLines&#91;i&#93; then<br />					--myLog(&#39;cleen up i &#39;..tostring(i))<br />					upLines&#91;i&#93; = nil<br />					<br />					--компрессия стека, если произошел прорыв линии<br />					for j=i,lines-1 do<br />						upLines&#91;j&#93; = upLines&#91;j+1&#93;<br />						upLines&#91;j+1&#93; = nil<br />					end<br />					countUpLines = countUpLines-1<br />					i = i-1<br />				end<br />			end<br />			i = i+1<br />		end<br />		<br />		i=1<br />		while i&lt;=lines do<br />			--myLog(&#39;down i &#39;..tostring(i)..&#39; val &#39;..tostring(downLines&#91;i&#93;))<br />			if downLines&#91;i&#93;~=nil then<br />				SetValue(I-1, 2+lines+i, downLines&#91;i&#93;)<br />				if low&lt;downLines&#91;i&#93; then<br />					--myLog(&#39;cleen down i &#39;..tostring(i))<br />					downLines&#91;i&#93; = nil<br /><br />					--компрессия стека, если произошел прорыв линии<br />					for j=i,lines-1 do<br />						downLines&#91;j&#93; = downLines&#91;j+1&#93;<br />						downLines&#91;j+1&#93; = nil<br />					end<br />					countDownLines = countDownLines-1<br />					i = i-1<br />				end<br />			end<br />			i = i+1<br />		end<br />		<br />		--myLog(&#39;--------------------------------------&#39;)<br />		--myLog(&#39; &#39;)<br /><br />		return nil,nil<br /><br />	end<br />end<br /><br />function Value(I,VType,ds) <br />local Out = nil<br />VType=(VType and string.upper(string.sub(VType,1,1))) or &quot;A&quot;<br />	if VType == &quot;O&quot; then		--Open<br />		Out = (O and O(I)) or (ds and ds:O(I))<br />	elseif VType == &quot;H&quot; then 	--High<br />		Out = (H and H(I)) or (ds and ds:H(I))<br />	elseif VType == &quot;L&quot; then	--Low<br />		Out = (L and L(I)) or (ds and ds:L(I))<br />	elseif VType == &quot;C&quot; then	--Close<br />		Out = (C and C(I)) or (ds and ds:C(I))<br />	elseif VType == &quot;V&quot; then	--Volume<br />		Out = (V and V(I)) or (ds and ds:V(I)) <br />	elseif VType == &quot;M&quot; then	--Median<br />		Out = ((Value(I,&quot;H&quot;,ds) + Value(I,&quot;L&quot;,ds)) / 2)<br />	elseif VType == &quot;T&quot; then	--Typical<br />		Out = ((Value(I,&quot;M&quot;,ds) * 2 + Value(I,&quot;C&quot;,ds))/3)<br />	elseif VType == &quot;W&quot; then	--Weighted<br />		Out = ((Value(I,&quot;T&quot;,ds) * 3 + Value(I,&quot;O&quot;,ds))/4) <br />	elseif VType == &quot;D&quot; then	--Difference<br />		Out = (Value(I,&quot;H&quot;,ds) - Value(I,&quot;L&quot;,ds))<br />	elseif VType == &quot;A&quot; then	--Any<br />		if ds then Out = ds&#91;I&#93; end<br />	end<br />return Out<br />end <br />
			<img src="https://forum.quik.ru/bitrix/components/bitrix/forum.interface/show_file.php?fid=11851&" width="1176" height="882" /><br /><i>28.02.2024 18:49:38, sandyman.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message74675/topic8536/</link>
			<guid>http://forum.quik.ru/messages/forum10/message74675/topic8536/</guid>
			<pubDate>Wed, 28 Feb 2024 18:49:38 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
