<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Форум QUIK [тема: Скрипт правильно ли написан]</title>
		<link>http://forum.quik.ru</link>
		<description>Новое в теме Скрипт правильно ли написан форума  на сайте Форум QUIK [forum.quik.ru]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Sun, 24 May 2026 23:20:55 +0300</pubDate>
		<item>
			<title>Скрипт правильно ли написан</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message81529/topic9363/">Скрипт правильно ли написан</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Обращайтесь.<br />Лучше в личку. <br />
			<i>19.02.2026 12:52:07, Ziveleos.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message81529/topic9363/</link>
			<guid>http://forum.quik.ru/messages/forum10/message81529/topic9363/</guid>
			<pubDate>Thu, 19 Feb 2026 12:52:07 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт правильно ли написан</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message81527/topic9363/">Скрипт правильно ли написан</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Не могли ли вы бы мне помочь написать скрипт.он должен выполняться по определенной логике. Но куплю, продажу акций я незнаю как написать. <br />
			<i>19.02.2026 12:07:54, Qwertserg.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message81527/topic9363/</link>
			<guid>http://forum.quik.ru/messages/forum10/message81527/topic9363/</guid>
			<pubDate>Thu, 19 Feb 2026 12:07:54 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт правильно ли написан</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message81181/topic9363/">Скрипт правильно ли написан</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_tbcvUrcL" href="/user/17142/" bx-tooltip-user-id="17142">Йцукен</a> написал:<br /> <br />====quote====<br /><noindex><a href="/user/15985/" target="_blank" rel="nofollow">Ziveleos</a></noindex> написал:<br />в qlua нет функции print<br />=============<br /> Вообще-то есть. Но куда она выводит текст - не понятно.<br />=============<br />Похоже, что никуда, а если функция не исполняет свою роль, то это все равно, что её нет.<br />В qlua есть и другие функции - &quot;призраки&quot;, например: warn, UpdateRow.<br />Но есть и полезная, но недокументированная getUniqTransID - общий для всех скриптов счетчик. <br />
			<i>07.02.2026 08:12:54, Ziveleos.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message81181/topic9363/</link>
			<guid>http://forum.quik.ru/messages/forum10/message81181/topic9363/</guid>
			<pubDate>Sat, 07 Feb 2026 08:12:54 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт правильно ли написан</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message81114/topic9363/">Скрипт правильно ли написан</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_ZZFNFVOa" href="/user/15985/" bx-tooltip-user-id="15985">Ziveleos</a> написал:<br />в qlua нет функции print<br />=============<br />Вообще-то есть. Но куда она выводит текст - не понятно. <br />
			<i>01.02.2026 22:53:05, Йцукен.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message81114/topic9363/</link>
			<guid>http://forum.quik.ru/messages/forum10/message81114/topic9363/</guid>
			<pubDate>Sun, 01 Feb 2026 22:53:05 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт правильно ли написан</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message80394/topic9363/">Скрипт правильно ли написан</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Переделал<br /><br />
====code====
<pre>&nbsp;&nbsp; local classCode = "TQBR"
l&#91;B&#93;&#91;/B&#93;ocal secCode = "GAZP"
local param = "last"
local is_run = true


function candlesProcessing () 
&nbsp;&nbsp;&nbsp;&nbsp;while true do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local paramEx = getParamEx(classCode, secCode, param)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dr1 = paramEx.param_value
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message (dr1)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uvb =20
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ovb =( dr1*uvb/100/1000)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ovbm=dr1+ovb
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep (900)
&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local paramEx = getParamEx(classCode, secCode, param)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dr2 = paramEx.param_value
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;massage (dr2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;u =20
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ovbml =( dr2*u/100/1000)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if dr2&#62;ovbm+dr1 then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpenPosition()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep (900)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;local paramEx = getParamEx(classCode, secCode, param)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dr3 = paramEx.param_value
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;u =20
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ovbml =( dr2*u/100/1000)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ovbm2= ovbml+dr2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ovbmln= dr2-ovbml
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if dr3 &#62; ovbm2 then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;massage (dr2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ClosePositionorders()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;delete()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if dr3 &#62; ovbmln then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message (dr2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OpenPosition()
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;&nbsp;end
end


-- Функция ОТКРЫВАЕТ позицию
function OpenPosition()
&nbsp;&nbsp; -- Устанавливает флаг текущего процесса в ОТКРЫТИЕ позиции
&nbsp;&nbsp; STATE = "OPEN";
&nbsp;&nbsp; -- Сбрасывает флаг обработки открытия позиций
&nbsp;&nbsp; OpenPosProcessed = false;
 
&nbsp;&nbsp; trans_id_OPT = math.random(1,9999);
&nbsp;&nbsp; -- Заполняет структуру для отправки транзакции на покупку 2-х ОПЦИОНОВ
&nbsp;&nbsp; local Transaction={
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"TRANS_ID"&#93;&nbsp;&nbsp; = tostring(trans_id_OPT),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"ACTION"&#93;&nbsp;&nbsp;&nbsp;&nbsp; = "NEW_ORDER",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"CLASSCODE"&#93;&nbsp;&nbsp;= classCode,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"SECCODE"&#93;&nbsp;&nbsp;&nbsp;&nbsp;= secCode ,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"OPERATION"&#93;&nbsp;&nbsp;= "B", -- покупка (BUY)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"TYPE"&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = "M", -- по рынку (MARKET)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"QUANTITY"&#93;&nbsp;&nbsp; = "2", -- количество
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"ACCOUNT"&#93;&nbsp;&nbsp;&nbsp;&nbsp;= TRADE_ACC,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"PRICE"&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= tostring(getParamEx(CLASS_CODE_OPT, SEC_CODE_OPT_FOR_OPEN, "offer").param_value + 10*getParamEx(CLASS_CODE_OPT, SEC_CODE_OPT_FOR_OPEN, "SEC_PRICE_STEP").param_value), -- по цене, завышенной на 10 мин. шагов цены
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"COMMENT"&#93;&nbsp;&nbsp;&nbsp;&nbsp;= "Покупка опционов скриптом"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"ORDER_KEY"&#93; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= tostring(number_order)
&nbsp;&nbsp; }
&nbsp;&nbsp; -- Флаг, что ОПЦИОНЫ еще не куплены
&nbsp;&nbsp; NotBuy_OPT = true;
&nbsp;&nbsp; local Result = sendTransaction(Transaction);
&nbsp;&nbsp; 
&nbsp;&nbsp; -- ЕСЛИ функция вернула строку диагностики ошибки, ТО значит транзакция не прошла
&nbsp;&nbsp; if Result ~= "" then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Выводит сообщение с ошибкой
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message("Покупка ОПЦИОНОВ не удалась!&#92;nОШИБКА: "..Result);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Завершает выполнение функции
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return(0);
&nbsp;&nbsp; end;
end

-- Функция ЗАКРЫВАЕТ позицию
function ClosePosition()
&nbsp;&nbsp; -- Устанавливает флаг текущего процесса&nbsp;&nbsp;в ЗАКРЫТИЕ позиции
&nbsp;&nbsp; STATE = "CLOSE";
&nbsp;&nbsp; -- Сбрасывает флаг обработки закрытия позиций
&nbsp;&nbsp; ClosePosProcessed = false;
 
&nbsp;&nbsp; trans_id_OPT = math.random(1,9999);
&nbsp;&nbsp; -- Заполняет структуру для отправки транзакции на продажу 2-х ОПЦИОНОВ
&nbsp;&nbsp; local Transaction={
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"TRANS_ID"&#93;&nbsp;&nbsp; = tostring(trans_id_OPT),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"ACTION"&#93;&nbsp;&nbsp;&nbsp;&nbsp; = "NEW_ORDER",
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"CLASSCODE"&#93;&nbsp;&nbsp;= classCode,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"SECCODE"&#93;&nbsp;&nbsp;&nbsp;&nbsp;= secCode ,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"OPERATION"&#93;&nbsp;&nbsp;= "S", -- продажа (SELL)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"TYPE"&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = "M", -- по рынку (MARKET)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"QUANTITY"&#93;&nbsp;&nbsp; = "2", -- количество
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"ACCOUNT"&#93;&nbsp;&nbsp;&nbsp;&nbsp;= TRADE_ACC,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"PRICE"&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= tostring(getParamEx(CLASS_CODE_OPT, SEC_CODE_OPT_FOR_OPEN, "bid").param_value - 10*getParamEx(CLASS_CODE_OPT, SEC_CODE_OPT_FOR_OPEN, "SEC_PRICE_STEP").param_value), -- по цене, заниженной на 10 мин. шагов цены
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"COMMENT"&#93;&nbsp;&nbsp;&nbsp;&nbsp;= "Продажа опционов скриптом"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#91;"ORDER_KEY"&#93; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= tostring(number_order)
&nbsp;&nbsp; }
&nbsp;&nbsp; -- Флаг, что ОПЦИОНЫ еще не проданы
&nbsp;&nbsp; NotSell_OPT = true;
&nbsp;&nbsp; local Result = sendTransaction(Transaction);
&nbsp;&nbsp; -- ЕСЛИ функция вернула строку диагностики ошибки, ТО значит транзакция не прошла
&nbsp;&nbsp; if Result ~= "" then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Выводит сообщение с ошибкой
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message("Продажа ОПЦИОНОВ не удалась!&#92;nОШИБКА: "..Result);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-- Завершает выполнение функции
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return(0);
&nbsp;&nbsp; end;
end

function trasactiondelete(number_order)

id_transact = id_transact + 1

deleteorder&nbsp;&nbsp;= 
&nbsp;&nbsp;&nbsp;{
&nbsp;&nbsp;&nbsp;&#91;"TRANS_ID"&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= tostring(id_transact), 
&nbsp;&nbsp;&nbsp;&#91;"ACTION"&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= "KILL_ORDER", &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&#91;"CLASSCODE"&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=classCode,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&#91;"SECCODE"&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= secCode ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&#91;"ACCOUNT"&#93;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= account,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&#91;"ORDER_KEY"&#93; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= tostring(number_order)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;
end

function delete()
 &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;num_orders = getNumberOf("orders")
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;for i = num_orders - 1, 0, -1 do
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myorder = getItem("orders", i)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if myorder&#91;"client_code"&#93;==client_code and myorder&#91;"sec_code"&#93;==tiker then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if bit.band(tonumber(myorder&#91;"flags"&#93;),1) &#62; 0 then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message(progname.." ����� ������: "..myorder.order_num)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trasactiondelete(myorder.order_num)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error_transaction = sendTransaction(deleteorder)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep(300)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if error_transaction ~= "" then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message(progname.." : ������ ="..error_transaction, 3)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message(progname.." : ������ ������ "..myorder&#91;"order_num"&#93;.." ����:"..myorder&#91;"price"&#93;.." �����: "..myorder&#91;"balance"&#93;.." �����������:"..myorder&#91;"brokerref"&#93;, 2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--break -- ������� �� ����� ����� ���� ��� ����� 1 �������� ������

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;end

end



function ClosePositionorders()
 &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;num_orders = getNumberOf("orders")
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;for i = num_orders - 1, 0, -1 do
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;myorder = getItem("orders", i)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if myorder&#91;"client_code"&#93;==client_code and myorder&#91;"sec_code"&#93;==tiker then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if bit.band(tonumber(myorder&#91;"flags"&#93;),1) &#62; 0 then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message(progname.." ����� ������: "..myorder.order_num)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ClosePosition(myorder.order_num)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error_transaction = sendTransaction(deleteorder)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sleep(300)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if error_transaction ~= "" then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message(progname.." : ������ ="..error_transaction, 3)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message(progname.." : ������ ������ "..myorder&#91;"order_num"&#93;.." ����:"..myorder&#91;"price"&#93;.." �����: "..myorder&#91;"balance"&#93;.." �����������:"..myorder&#91;"brokerref"&#93;, 2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--break -- ������� �� ����� ����� ���� ��� ����� 1 �������� ������

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;end

end


function main ()
&nbsp;&nbsp; while is_run do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; candlesProcessing ()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
&nbsp;&nbsp; end
end&nbsp;&nbsp;&nbsp;&nbsp; </pre>
============= <br />
			<i>30.11.2025 15:42:38, Qwertserg.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message80394/topic9363/</link>
			<guid>http://forum.quik.ru/messages/forum10/message80394/topic9363/</guid>
			<pubDate>Sun, 30 Nov 2025 15:42:38 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт правильно ли написан</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message80302/topic9363/">Скрипт правильно ли написан</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<a class="blog-p-user-name" id="bp_PCIDbX0i" href="/user/16996/" bx-tooltip-user-id="16996">Qwertserg</a>, какой нейросетью пользовались? <br />
			<i>21.11.2025 19:36:04, Ziveleos.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message80302/topic9363/</link>
			<guid>http://forum.quik.ru/messages/forum10/message80302/topic9363/</guid>
			<pubDate>Fri, 21 Nov 2025 19:36:04 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт правильно ли написан</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message80301/topic9363/">Скрипт правильно ли написан</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Много что не так. На всидку: кодировка должна быть 1251; в qlua нет функции print; if предполагает then, тут Вам не пайтон; и т.д.<br />И ещё, скрипт желательно выкладывать в виде кода, иначе он трудно читается.<br />[FILE ID=12865] <br />
			<img src="https://forum.quik.ru/bitrix/components/bitrix/forum.interface/show_file.php?fid=12865&" width="824" height="164" /><br /><i>21.11.2025 19:16:51, Ziveleos.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message80301/topic9363/</link>
			<guid>http://forum.quik.ru/messages/forum10/message80301/topic9363/</guid>
			<pubDate>Fri, 21 Nov 2025 19:16:51 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт правильно ли написан</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message80299/topic9363/">Скрипт правильно ли написан</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Прикольно, <br />А компьютера у Вас нет? <br />
			<i>21.11.2025 19:02:52, nikolz.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message80299/topic9363/</link>
			<guid>http://forum.quik.ru/messages/forum10/message80299/topic9363/</guid>
			<pubDate>Fri, 21 Nov 2025 19:02:52 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт правильно ли написан</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message80296/topic9363/">Скрипт правильно ли написан</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Есть ли програмисты,хотел бы проверить <br />правильно ли написан.<br />local classCode = &quot;TQBR&quot;<br />local secCode = &quot;GAZP&quot;<br />local param = &quot;last&quot;<br />local is_run = true<br /><br /><br />function candlesProcessing () <br /> &nbsp; &nbsp;while true do<br /> &nbsp; &nbsp; &nbsp; &nbsp;local paramEx = getParamEx(classCode, secCode, param)<br /> &nbsp; &nbsp; &nbsp; &nbsp;dr1 = paramEx.param_value<br /> &nbsp; &nbsp; &nbsp; &nbsp;print (dr1)<br /> &nbsp; &nbsp; &nbsp; &nbsp;uvb =20<br /> &nbsp; &nbsp; &nbsp; &nbsp;ovb =( dr1*uvb/100/1000)<br /> &nbsp; &nbsp; &nbsp; &nbsp;ovbm=dr1+ovb<br /> &nbsp; &nbsp; &nbsp; &nbsp;sleep (900)<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;local paramEx = getParamEx(classCode, secCode, param)<br /> &nbsp; &nbsp; &nbsp; &nbsp;dr2 = paramEx.param_value<br /> &nbsp; &nbsp; &nbsp; &nbsp;print (dr2)<br /> &nbsp; &nbsp; &nbsp; &nbsp;u =20<br /> &nbsp; &nbsp; &nbsp; &nbsp;ovbml =( dr2*u/100/1000)<br /> &nbsp; &nbsp; &nbsp; &nbsp;if dr2&gt;ovbm+dr1 :<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OpenPosition()<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sleep (900)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local paramEx = getParamEx(classCode, secCode, param)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dr3 = paramEx.param_value<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;u =20<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ovbml =( dr2*u/100/1000)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ovbm2= ovbml+dr2<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ovbmln= dr2-ovbml<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if dr3 &gt; ovbm2:<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;print (dr2)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ClosePositionorders()<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;delete()<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if dr3 &gt; ovbmln:<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;print (dr2)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OpenPosition()<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp;end<br />end<br /><br /><br />-- Функция ОТКРЫВАЕТ позицию<br />function OpenPosition()<br /> &nbsp; -- Устанавливает флаг текущего процесса в ОТКРЫТИЕ позиции<br /> &nbsp; STATE = &quot;OPEN&quot;;<br /> &nbsp; -- Сбрасывает флаг обработки открытия позиций<br /> &nbsp; OpenPosProcessed = false;<br /> <br /> &nbsp; trans_id_OPT = math.random(1,9999);<br /> &nbsp; -- Заполняет структуру для отправки транзакции на покупку 2-х ОПЦИОНОВ<br /> &nbsp; local Transaction={<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;TRANS_ID&quot;&#93; &nbsp; = tostring(trans_id_OPT),<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;ACTION&quot;&#93; &nbsp; &nbsp; = &quot;NEW_ORDER&quot;,<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;CLASSCODE&quot;&#93; &nbsp;= CLASS_CODE_OPT,<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;SECCODE&quot;&#93; &nbsp; &nbsp;= SEC_CODE_OPT_FOR_OPEN,<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;OPERATION&quot;&#93; &nbsp;= &quot;B&quot;, -- покупка (BUY)<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;TYPE&quot;&#93; &nbsp; &nbsp; &nbsp; = &quot;M&quot;, -- по рынку (MARKET)<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;QUANTITY&quot;&#93; &nbsp; = &quot;2&quot;, -- количество<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;ACCOUNT&quot;&#93; &nbsp; &nbsp;= TRADE_ACC,<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;PRICE&quot;&#93; &nbsp; &nbsp; &nbsp;= tostring(getParamEx(CLASS_CODE_OPT, SEC_CODE_OPT_FOR_OPEN, &quot;offer&quot;).param_value + 10*getParamEx(CLASS_CODE_OPT, SEC_CODE_OPT_FOR_OPEN, &quot;SEC_PRICE_STEP&quot;).param_value), -- по цене, завышенной на 10 мин. шагов цены<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;COMMENT&quot;&#93; &nbsp; &nbsp;= &quot;Покупка опционов скриптом&quot;<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;ORDER_KEY&quot;&#93; 			= tostring(number_order)<br /> &nbsp; }<br /> &nbsp; -- Флаг, что ОПЦИОНЫ еще не куплены<br /> &nbsp; NotBuy_OPT = true;<br /> &nbsp; local Result = sendTransaction(Transaction);<br /> &nbsp; <br /> &nbsp; -- ЕСЛИ функция вернула строку диагностики ошибки, ТО значит транзакция не прошла<br /> &nbsp; if Result ~= &quot;&quot; then<br /> &nbsp; &nbsp; &nbsp;-- Выводит сообщение с ошибкой<br /> &nbsp; &nbsp; &nbsp;message(&quot;Покупка ОПЦИОНОВ не удалась!\nОШИБКА: &quot;..Result);<br /> &nbsp; &nbsp; &nbsp;-- Завершает выполнение функции<br /> &nbsp; &nbsp; &nbsp;return(0);<br /> &nbsp; end;<br />end<br /><br />-- Функция ЗАКРЫВАЕТ позицию<br />function ClosePosition()<br /> &nbsp; -- Устанавливает флаг текущего процесса &nbsp;в ЗАКРЫТИЕ позиции<br /> &nbsp; STATE = &quot;CLOSE&quot;;<br /> &nbsp; -- Сбрасывает флаг обработки закрытия позиций<br /> &nbsp; ClosePosProcessed = false;<br /> <br /> &nbsp; trans_id_OPT = math.random(1,9999);<br /> &nbsp; -- Заполняет структуру для отправки транзакции на продажу 2-х ОПЦИОНОВ<br /> &nbsp; local Transaction={<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;TRANS_ID&quot;&#93; &nbsp; = tostring(trans_id_OPT),<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;ACTION&quot;&#93; &nbsp; &nbsp; = &quot;NEW_ORDER&quot;,<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;CLASSCODE&quot;&#93; &nbsp;= CLASS_CODE_OPT,<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;SECCODE&quot;&#93; &nbsp; &nbsp;= SEC_CODE_OPT_IN_POS,<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;OPERATION&quot;&#93; &nbsp;= &quot;S&quot;, -- продажа (SELL)<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;TYPE&quot;&#93; &nbsp; &nbsp; &nbsp; = &quot;M&quot;, -- по рынку (MARKET)<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;QUANTITY&quot;&#93; &nbsp; = &quot;2&quot;, -- количество<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;ACCOUNT&quot;&#93; &nbsp; &nbsp;= TRADE_ACC,<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;PRICE&quot;&#93; &nbsp; &nbsp; &nbsp;= tostring(getParamEx(CLASS_CODE_OPT, SEC_CODE_OPT_FOR_OPEN, &quot;bid&quot;).param_value - 10*getParamEx(CLASS_CODE_OPT, SEC_CODE_OPT_FOR_OPEN, &quot;SEC_PRICE_STEP&quot;).param_value), -- по цене, заниженной на 10 мин. шагов цены<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;COMMENT&quot;&#93; &nbsp; &nbsp;= &quot;Продажа опционов скриптом&quot;<br /> &nbsp; &nbsp; &nbsp;&#91;&quot;ORDER_KEY&quot;&#93; 			= tostring(number_order)<br /> &nbsp; }<br /> &nbsp; -- Флаг, что ОПЦИОНЫ еще не проданы<br /> &nbsp; NotSell_OPT = true;<br /> &nbsp; local Result = sendTransaction(Transaction);<br /> &nbsp; -- ЕСЛИ функция вернула строку диагностики ошибки, ТО значит транзакция не прошла<br /> &nbsp; if Result ~= &quot;&quot; then<br /> &nbsp; &nbsp; &nbsp;-- Выводит сообщение с ошибкой<br /> &nbsp; &nbsp; &nbsp;message(&quot;Продажа ОПЦИОНОВ не удалась!\nОШИБКА: &quot;..Result);<br /> &nbsp; &nbsp; &nbsp;-- Завершает выполнение функции<br /> &nbsp; &nbsp; &nbsp;return(0);<br /> &nbsp; end;<br />end<br /><br />function trasactiondelete(number_order)<br /><br />id_transact = id_transact + 1<br /><br />deleteorder &nbsp;= <br />	{<br />	&#91;&quot;TRANS_ID&quot;&#93;			= tostring(id_transact), <br />	&#91;&quot;ACTION&quot;&#93;				= &quot;KILL_ORDER&quot;, 			 <br />	&#91;&quot;CLASSCODE&quot;&#93;			= class ,				 <br />	&#91;&quot;SECCODE&quot;&#93;				= tiker,				 			 <br />	&#91;&quot;ACCOUNT&quot;&#93;				= account,				<br />	&#91;&quot;ORDER_KEY&quot;&#93; 			= tostring(number_order)		<br />	}<br />	<br />end<br /><br />function delete()<br /> 	<br />	num_orders = getNumberOf(&quot;orders&quot;)<br />	<br />	for i = num_orders - 1, 0, -1 do<br />	<br />		myorder = getItem(&quot;orders&quot;, i)<br />		<br />		if myorder&#91;&quot;client_code&quot;&#93;==client_code and myorder&#91;&quot;sec_code&quot;&#93;==tiker then<br />		<br />			if bit.band(tonumber(myorder&#91;&quot;flags&quot;&#93;),1) &gt; 0 then<br />			<br />				message(progname..&quot; ����� ������: &quot;..myorder.order_num)<br />					<br />					trasactiondelete(myorder.order_num)<br />					error_transaction = sendTransaction(deleteorder)<br />					sleep(300)<br />					<br />					if error_transaction ~= &quot;&quot; then<br />						message(progname..&quot; : ������ =&quot;..error_transaction, 3)<br />					else<br />						message(progname..&quot; : ������ ������ &quot;..myorder&#91;&quot;order_num&quot;&#93;..&quot; ����:&quot;..myorder&#91;&quot;price&quot;&#93;..&quot; �����: &quot;..myorder&#91;&quot;balance&quot;&#93;..&quot; �����������:&quot;..myorder&#91;&quot;brokerref&quot;&#93;, 2)<br />					end<br />				<br />				--break -- ������� �� ����� ����� ���� ��� ����� 1 �������� ������<br /><br />			end<br />	<br />		end<br />	<br />	end<br /><br />end<br /><br /><br /><br />function ClosePositionorders()<br /> 	<br />	num_orders = getNumberOf(&quot;orders&quot;)<br />	<br />	for i = num_orders - 1, 0, -1 do<br />	<br />		myorder = getItem(&quot;orders&quot;, i)<br />		<br />		if myorder&#91;&quot;client_code&quot;&#93;==client_code and myorder&#91;&quot;sec_code&quot;&#93;==tiker then<br />		<br />			if bit.band(tonumber(myorder&#91;&quot;flags&quot;&#93;),1) &gt; 0 then<br />			<br />				message(progname..&quot; ����� ������: &quot;..myorder.order_num)<br />					<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ClosePosition(myorder.order_num)<br />					error_transaction = sendTransaction(deleteorder)<br />					sleep(300)<br />					<br />					if error_transaction ~= &quot;&quot; then<br />						message(progname..&quot; : ������ =&quot;..error_transaction, 3)<br />					else<br />						message(progname..&quot; : ������ ������ &quot;..myorder&#91;&quot;order_num&quot;&#93;..&quot; ����:&quot;..myorder&#91;&quot;price&quot;&#93;..&quot; �����: &quot;..myorder&#91;&quot;balance&quot;&#93;..&quot; �����������:&quot;..myorder&#91;&quot;brokerref&quot;&#93;, 2)<br />					end<br />				<br />				--break -- ������� �� ����� ����� ���� ��� ����� 1 �������� ������<br /><br />			end<br />	<br />		end<br />	<br />	end<br /><br />end<br /><br /><br />function main ()<br /> &nbsp; while is_run do<br /> &nbsp; &nbsp; &nbsp; candlesProcessing () &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; <br /> &nbsp; end<br />end <br />
			<i>21.11.2025 16:54:40, Qwertserg.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message80296/topic9363/</link>
			<guid>http://forum.quik.ru/messages/forum10/message80296/topic9363/</guid>
			<pubDate>Fri, 21 Nov 2025 16:54:40 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
