<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Форум QUIK [тема: создание из Lua заявки тэйк-профит и стоп-лимит]</title>
		<link>http://forum.quik.ru</link>
		<description>Новое в теме создание из Lua заявки тэйк-профит и стоп-лимит форума  на сайте Форум QUIK [forum.quik.ru]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Sun, 03 May 2026 05:21:07 +0300</pubDate>
		<item>
			<title>создание из Lua заявки тэйк-профит и стоп-лимит</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message37044/topic4384/">создание из Lua заявки тэйк-профит и стоп-лимит</a></b> <i>заявка не выставляется</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Благодарю!<br /><br />Решено. Проблема оказаль в неправильном формате значений отступа и спреда (нужно было задавать их через string.format... <br />
			<i>20.03.2019 16:17:03, Михаил.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message37044/topic4384/</link>
			<guid>http://forum.quik.ru/messages/forum10/message37044/topic4384/</guid>
			<pubDate>Wed, 20 Mar 2019 16:17:03 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>создание из Lua заявки тэйк-профит и стоп-лимит</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message37041/topic4384/">создание из Lua заявки тэйк-профит и стоп-лимит</a></b> <i>заявка не выставляется</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_sWa1En20" href="/user/12950/" bx-tooltip-user-id="12950">Михаил</a> написал:<br /><br />Стоп-заявку терминал вообще не замечает, никаких ошибок не выдает. Заявки нет.<br /><br />sendTransaction(stop)<br /><br /><br />=============<br /><br />По документации:<br />&quot;Формат вызова: &nbsp;STRING result sendTransaction(TABLE transaction)&quot;<br /><br />Сделайте так:<br />
====code====
<pre>local result = sendTransaction(stop)</pre>
=============
И посмотрите, что вернул сам терминал в result, например:<br />
====code====
<pre>message(result)
</pre>
============= <br />
			<i>20.03.2019 13:46:37, SDL.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message37041/topic4384/</link>
			<guid>http://forum.quik.ru/messages/forum10/message37041/topic4384/</guid>
			<pubDate>Wed, 20 Mar 2019 13:46:37 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>создание из Lua заявки тэйк-профит и стоп-лимит</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message37037/topic4384/">создание из Lua заявки тэйк-профит и стоп-лимит</a></b> <i>заявка не выставляется</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Добрый день!<br /><br />Помогите, пожалуйста, разобраться. Скрипт отправляет две заявки: обычную и стоп-заявку типа &quot;тэйк-профит и стоп-лимит&quot;. Обычная заявка проходит. Стоп-заявку терминал вообще не замечает, никаких ошибок не выдает. Заявки нет.<br />Причем, когда отправляет обычную стоп заявку типа стоп-лимит - все работает. Видимо, у меня где-то что-то неправильно указано для заявки типа &quot;тэйк-профит и стоп-лимит&quot;....<br />Вот функция, которая вызывает заявку:<br /><br />function doBuy(curPrice)<br /> &nbsp; &nbsp;local price = curPrice + BUFFER -- цена заявки на покупку<br /> &nbsp; &nbsp;local q = getQuantity(&quot;B&quot;, price)<br /><br /> &nbsp; &nbsp;PrintDbgStr(&quot;ПОКУПАЕМ! &quot;..tostring(q))<br /><br /> &nbsp; &nbsp;-- посчитаем относительный размер стопа<br /> &nbsp; &nbsp;local relStopSize = getStopSize()<br /> &nbsp; &nbsp;PrintDbgStr(&quot;размер стопа: &quot; .. relStopSize)<br /><br /> &nbsp; &nbsp;local stop_price = curPrice - relStopSize -- уровень стопа<br /> &nbsp; &nbsp;PrintDbgStr(&quot;Стоп-цена: &quot; .. stop_price)<br />	<br />	local take_profit_price = curPrice + PROFIT_SIZE -- уроверь тейк-профита<br />	PrintDbgStr(&quot;Тейк-профит: &quot; .. take_profit_price)<br />	<br /> &nbsp; &nbsp;-- заявка<br /> &nbsp; &nbsp;local order = {<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;TRANS_ID&quot;&#93; &nbsp; &nbsp;= &quot;1&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;ACTION&quot;&#93; &nbsp; &nbsp; &nbsp;= &quot;NEW_ORDER&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;CLASSCODE&quot;&#93; &nbsp; = &quot;SPBFUT&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;CLIENT_CODE&quot;&#93; = CLIENT_CODE,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;SECCODE&quot;&#93; &nbsp; &nbsp; = INSTRUMENT,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;ACCOUNT&quot;&#93; &nbsp; &nbsp; = ACCOUNT,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;OPERATION&quot;&#93; &nbsp; = &quot;B&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;QUANTITY&quot;&#93; &nbsp; &nbsp;= string.format('%.0f', q),<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;PRICE&quot;&#93; &nbsp; &nbsp; &nbsp; = string.format('%.0f', price)<br /> &nbsp; &nbsp; &nbsp; &nbsp;--&#91;&quot;TYPE&quot;&#93; &nbsp; &nbsp; &nbsp; &nbsp;= L &nbsp;-- так было в прошлом роботе, не знаю что это значит<br /> &nbsp; &nbsp;}<br /><br /> &nbsp; &nbsp;-- стоп-заявка<br /> &nbsp; &nbsp;local stop = {<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;TRANS_ID&quot;&#93; &nbsp; &nbsp;	= &quot;2&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;ACTION&quot;&#93; &nbsp; &nbsp; &nbsp;	= &quot;NEW_STOP_ORDER&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;CLASSCODE&quot;&#93; &nbsp; 	= &quot;SPBFUT&quot;,<br />		&#91;&quot;CLIENT_CODE&quot;&#93; &nbsp; &nbsp; = CLIENT_CODE,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;SECCODE&quot;&#93; &nbsp; &nbsp; 	= INSTRUMENT,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;ACCOUNT&quot;&#93; &nbsp; &nbsp; 	= ACCOUNT,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;OPERATION&quot;&#93; &nbsp;		= &quot;S&quot;,<br />		&#91;&quot;QUANTITY&quot;&#93; 		= string.format('%.0f', q),<br />		&#91;&quot;STOPPRICE&quot;&#93; &nbsp; 	= string.format('%.0f', take_profit_price),<br />		&#91;&quot;STOP_ORDER_KIND&quot;&#93; = &quot;TAKE_PROFIT_AND_STOP_LIMIT_ORDER&quot;,<br />		&#91;&quot;STOPPRICE2&quot;&#93; &nbsp; 	= string.format('%.0f', stop_price),<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;PRICE&quot;&#93; &nbsp; &nbsp; &nbsp; 	= string.format('%.0f', stop_price - BUFFER),<br />		&#91;&quot;OFFSET&quot;&#93;			= OTSTUP,<br />		&#91;&quot;OFFSET_UNITS&quot;&#93;	= &quot;PRICE_UNITS&quot;,<br />		&#91;&quot;SPREAD&quot;&#93;			= SPRED,<br />		&#91;&quot;SPREAD_UNITS&quot;&#93;	= &quot;PRICE_UNITS&quot;,<br /> &nbsp; &nbsp; &nbsp; &nbsp;&#91;&quot;EXPIRY_DATE&quot;&#93; 	= &quot;TODAY&quot;<br />	}	<br /><br /> &nbsp; &nbsp;sendTransaction(order)<br /> &nbsp; &nbsp;sendTransaction(stop)<br />end <br />
			<i>20.03.2019 11:30:16, Михаил.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message37037/topic4384/</link>
			<guid>http://forum.quik.ru/messages/forum10/message37037/topic4384/</guid>
			<pubDate>Wed, 20 Mar 2019 11:30:16 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
