<?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>Fri, 17 Apr 2026 19:20:24 +0300</pubDate>
		<item>
			<title>Функция выставления тейк профита</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message40121/topic4797/">Функция выставления тейк профита</a></b> <i>Ошибка в выставлении профита</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Спасибо. В написании я новичок, только учусь, не могли подсказать как прописать условия при которых стоп не должен сниматься. <br />
			<i>11.10.2019 10:04:02, Виталий.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message40121/topic4797/</link>
			<guid>http://forum.quik.ru/messages/forum10/message40121/topic4797/</guid>
			<pubDate>Fri, 11 Oct 2019 10:04:02 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Функция выставления тейк профита</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message40120/topic4797/">Функция выставления тейк профита</a></b> <i>Ошибка в выставлении профита</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<a class="blog-p-user-name" id="bp_u2fBvCzj" href="/user/13309/" bx-tooltip-user-id="13309">Виталий</a>, <br />У Вас в коде в цикле "for i=1,#index do" снимаются все активные стопы.<br />Видимо функция ProfitControl вызывается несколько раз, от этого предыдущий стоп и снимается.<br />либо не запускайте функцию по нескольку раз, либо предусмотрите в указанном цикле условия при которых стоп не должен сниматься. <br />
			<i>11.10.2019 09:46:20, Sergey Gorokhov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message40120/topic4797/</link>
			<guid>http://forum.quik.ru/messages/forum10/message40120/topic4797/</guid>
			<pubDate>Fri, 11 Oct 2019 09:46:20 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Функция выставления тейк профита</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message40119/topic4797/">Функция выставления тейк профита</a></b> <i>Ошибка в выставлении профита</i> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Добрый день.<br />При выставлении заявки выставляется стоп-профит на нужный уровень, но потом с интервалом пару секунд заявка профита снимается и ставится на том же уровне. Подскажите пожалуйста как исправить?<br />Спасибо.<br />function ProfitControl(posNow,acc,emit,class,file)<br /> &nbsp; &nbsp;local function fn1(param1,param2,param3)<br /> &nbsp; &nbsp; &nbsp; &nbsp;if(param1==acc and &nbsp;param2==emit and param3==class)then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return true<br /> &nbsp; &nbsp; &nbsp; &nbsp;else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return false<br /> &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp;end<br /> &nbsp; &nbsp;local step = tonumber(getParamEx(class,emit,&quot;SEC_PRICE_STEP&quot;).param_value)<br /> &nbsp; &nbsp;local EnterPrice = RoundForStep(EnterPriceUni(posNow,emit,class,acc),step)<br /> &nbsp; &nbsp;local profitPrice = EnterPrice + SignFunc(posNow) * Profit * step<br /> &nbsp; &nbsp;local ProfCorrect = false &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp;local count = 0<br /> &nbsp; &nbsp;local index = &nbsp;SearchItems(&quot;stop_orders&quot;, 0, getNumberOf(&quot;stop_orders&quot;)-1, fn1, &quot;account,sec_code,class_code&quot;)<br /> &nbsp; &nbsp;if(index~=nil)then<br /> &nbsp; &nbsp; &nbsp; &nbsp;for i=1,#index do<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local row = getItem(&quot;stop_orders&quot;,index&#91;i&#93;)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local flag = bit.band(row.flags,1) &nbsp; &nbsp;--проверяем активна заявка или нет<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(flag&gt;0)then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(row.stop_order_type~=6 or ProfCorrect==true)then &nbsp; &nbsp;--6 тип тейк профит<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local keyNumber = row.order_num<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DeletProfitByNumber(emit,class,keyNumber,file)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;count = count + 1<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local qtyX = row.qtyX<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local profitPriceX = RoundForStep(row.condition_price,step) &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local buySellX = row.condition<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local signPosX = 0<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(buySellX&lt;=4)then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;signPosX = -1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;elseif(buySellX&gt;=5)then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;signPosX = 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(signPosX==SignFunc(posNow) and qtyX==math.abs(posNow) and profitPriceX==profitPrice)then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ProfCorrect = true<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;local keyNumber = row.order_num<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DeletProfitByNumber(emit,class,keyNumber,file)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;count = count + 1<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp;end<br /> &nbsp; &nbsp;if(ProfCorrect==false and posNow~=0)then<br /> &nbsp; &nbsp; &nbsp; &nbsp;local profitSpread = 30 * step<br /> &nbsp; &nbsp; &nbsp; &nbsp;if(posNow&gt;0)then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;buySell = &quot;S&quot;<br /> &nbsp; &nbsp; &nbsp; &nbsp;else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;buySell = &quot;B&quot;<br /> &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp; &nbsp; &nbsp;NewStopProfit(acc,emit,class,buySell,math.abs(posNow),profitPrice,0,profitSpread,file,&quot;Функция ProfitControl&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;count = count + 1<br /> &nbsp; &nbsp;end<br /> &nbsp; &nbsp;return count<br />end <br />
			<i>11.10.2019 09:39:39, Виталий.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message40119/topic4797/</link>
			<guid>http://forum.quik.ru/messages/forum10/message40119/topic4797/</guid>
			<pubDate>Fri, 11 Oct 2019 09:39:39 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
