<?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>Mon, 11 May 2026 03:46:33 +0300</pubDate>
		<item>
			<title>Скрипт не видит значение индикатора с определенной периодичностью.</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message69203/topic8000/">Скрипт не видит значение индикатора с определенной периодичностью.</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_1bdG4ma7" href="/user/15690/" bx-tooltip-user-id="15690">Юрий</a> написал:<br />Я бы вообще сложил всё это в общую сумму, например так: hour*10000+minute*100+sec, и поставил условие, если больше 30, то ок.<br /><br />По поводу вывести сообщение - совет правильный, но для меня это будет сложно, не программист я...<br />=============<br />Не программист и в алготрейдинг? Смело. Поищете, где-то были истории, как из-за ошибок в торговых роботах миллионы сливали. <br />
			<i>26.04.2023 08:42:29, paluke.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message69203/topic8000/</link>
			<guid>http://forum.quik.ru/messages/forum10/message69203/topic8000/</guid>
			<pubDate>Wed, 26 Apr 2023 08:42:29 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт не видит значение индикатора с определенной периодичностью.</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message69186/topic8000/">Скрипт не видит значение индикатора с определенной периодичностью.</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_XyeucYqg" href="/user/15690/" bx-tooltip-user-id="15690">Юрий</a> написал:<br />Методом научного тыка определил, что проблема кроется в этом блоке (297 строка кода): &nbsp; &nbsp; Скрытый текст &nbsp; &nbsp; &nbsp; &nbsp;
====code====
<pre>&nbsp;&nbsp; IF&nbsp;&nbsp;( 0&nbsp;&nbsp; +&nbsp;&nbsp;IS_CONNECTED()&nbsp;&nbsp;=&nbsp;&nbsp; 1 )
seconline = SUBSTR(Get_Info_Param( "CONNECTIONTIME" ), 6 , 2 )
minonline = SUBSTR(Get_Info_Param( "CONNECTIONTIME" ), 3 , 2 )
houronline = SUBSTR(Get_Info_Param( "CONNECTIONTIME" ), 0 , 2 )
&nbsp;&nbsp; if&nbsp;&nbsp;(((houronline +&nbsp;&nbsp;0 ) &#62;&nbsp;&nbsp;1 )&nbsp;&nbsp;or&nbsp;&nbsp;((minonline +&nbsp;&nbsp;0 ) &#62;&nbsp;&nbsp;1 )&nbsp;&nbsp;or&nbsp;&nbsp;((seconline +&nbsp;&nbsp;0 ) &#62;&nbsp;&nbsp;20 )) 
&nbsp;&nbsp;work =&nbsp;&nbsp;1 
&nbsp;&nbsp; end&nbsp;&nbsp; if 
 end&nbsp;&nbsp; if&nbsp;&nbsp;&nbsp;&nbsp;</pre>
=============
 Не нашел информации в каком формате предоставляются данные CONNECTIONTIME.<br />Знающие люди, подскажите пожалуйста!<br />=============<br />внимательно читайте документацию:<br /><B>STRING </B>getInfoParam (STRING param_name) <br />
			<i>24.04.2023 11:58:44, nikolz.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message69186/topic8000/</link>
			<guid>http://forum.quik.ru/messages/forum10/message69186/topic8000/</guid>
			<pubDate>Mon, 24 Apr 2023 11:58:44 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт не видит значение индикатора с определенной периодичностью.</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message69183/topic8000/">Скрипт не видит значение индикатора с определенной периодичностью.</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Не так всё печально! Получилось) Результат - 0:28:32 <br />
			<i>24.04.2023 08:30:06, Юрий.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message69183/topic8000/</link>
			<guid>http://forum.quik.ru/messages/forum10/message69183/topic8000/</guid>
			<pubDate>Mon, 24 Apr 2023 08:30:06 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт не видит значение индикатора с определенной периодичностью.</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message69182/topic8000/">Скрипт не видит значение индикатора с определенной периодичностью.</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Я бы вообще сложил всё это в общую сумму, например так: hour*10000+minute*100+sec, и поставил условие, если больше 30, то ок.<br /><br />По поводу вывести сообщение - совет правильный, но для меня это будет сложно, не программист я... <br />
			<i>24.04.2023 08:17:54, Юрий.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message69182/topic8000/</link>
			<guid>http://forum.quik.ru/messages/forum10/message69182/topic8000/</guid>
			<pubDate>Mon, 24 Apr 2023 08:17:54 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт не видит значение индикатора с определенной периодичностью.</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message69181/topic8000/">Скрипт не видит значение индикатора с определенной периодичностью.</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			1. Что такое Get_Info_Param()? В документации есть getInfoParam() - без подчеркиваний и с маленькой буквы. <br /><br />2. Ну выведите сообщение message(Get_Info_Param(&quot;CONNECTIONTIME&quot;)) и посмотрите своими глазами, в каком формате.<br />3. И дергать функцию три раза нехорошо. У вас может смениться секунда и минута - первый вызов отработал в 1:02:59 а второй в 1:03:00. Лучше записать результат вызова в переменную и дальше из нее вырезать часы-минуты-секунды. <br />
			<i>24.04.2023 08:00:15, paluke.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message69181/topic8000/</link>
			<guid>http://forum.quik.ru/messages/forum10/message69181/topic8000/</guid>
			<pubDate>Mon, 24 Apr 2023 08:00:15 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт не видит значение индикатора с определенной периодичностью.</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message69179/topic8000/">Скрипт не видит значение индикатора с определенной периодичностью.</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Методом научного тыка определил, что проблема кроется в этом блоке (297 строка кода):<table class="forum-spoiler"><thead onclick="if (this.nextSibling.style.display=='none') { this.nextSibling.style.display=''; BX.addClass(this, 'forum-spoiler-head-open'); } else { this.nextSibling.style.display='none'; BX.removeClass(this, 'forum-spoiler-head-open'); } BX.onCustomEvent('BX.Forum.Spoiler:toggle', [{node: this}]); event.stopPropagation();"><tr><th><div>Скрытый текст</div></th></tr></thead><tbody class="forum-spoiler" style="display:none;"><tr><td>
====code====
<pre>IF (0 + IS_CONNECTED() = 1)
seconline=SUBSTR(Get_Info_Param("CONNECTIONTIME"),6,2)
minonline=SUBSTR(Get_Info_Param("CONNECTIONTIME"),3,2)
houronline=SUBSTR(Get_Info_Param("CONNECTIONTIME"),0,2)
&nbsp;&nbsp;if (((houronline+0)&#62;1) or ((minonline+0)&#62;1) or ((seconline+0)&#62;20)) 
&nbsp;&nbsp;work=1
&nbsp;&nbsp;end if
end if </pre>
=============
</td></tr></tbody></table>Не нашел информации в каком формате предоставляются данные CONNECTIONTIME.<br />Знающие люди, подскажите пожалуйста! <br />
			<i>24.04.2023 07:40:28, Юрий.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message69179/topic8000/</link>
			<guid>http://forum.quik.ru/messages/forum10/message69179/topic8000/</guid>
			<pubDate>Mon, 24 Apr 2023 07:40:28 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Скрипт не видит значение индикатора с определенной периодичностью.</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message68985/topic8000/">Скрипт не видит значение индикатора с определенной периодичностью.</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Здравствуйте! Помогите разобраться с кодом. Проблема в следующем, тф5, в 9:00:10 (иногда значение секунд другое) на 2 минуты значение индикатора = 0... и так каждые 10 минут, т.е. в 9:10:10, 9:20:10, 9:30:10 и тд до 10 часов! потом всё нормально работает! Где причина, не могу понять... Подскажите, если кто знает. <br />====quote====<br />func createString(v1,v2,v3)<br /> &nbsp;string=set_value(string, &quot;ins&quot;,v1)<br />		 &nbsp; string=set_value(string, &quot;last&quot;,v2)<br />	 &nbsp; &nbsp; &nbsp; string=set_value(string, &quot;cci&quot;,v3)<br />		 &nbsp; <br /> &nbsp; &nbsp; &nbsp;	 &nbsp; line=line+1<br /> &nbsp; &nbsp; &nbsp; 	 &nbsp; add_item(line, string) <br />end func<br /><br /><br />func get_market(class_code)<br />market=&quot;&quot;<br /><br /><br />if ((class_code&amp;&quot;&quot;==&quot;EQNE&quot;) or (class_code&amp;&quot;&quot;==&quot;EQBR&quot;) or (class_code&amp;&quot;&quot;==&quot;EQNL&quot;) or (class_code&amp;&quot;&quot;==&quot;EQLV&quot;) or (class_code&amp;&quot;&quot;==&quot;EQLV&quot;) or (class_code&amp;&quot;&quot;==&quot;EQBS&quot;) or (class_code&amp;&quot;&quot;==&quot;RTSST&quot;))<br />market=&quot;micex&quot;<br />end if<br /><br /><br />if ((class_code&amp;&quot;&quot;==&quot;TQNE&quot;) or (class_code&amp;&quot;&quot;==&quot;TQBR&quot;) or (class_code&amp;&quot;&quot;==&quot;TQNL&quot;) or (class_code&amp;&quot;&quot;==&quot;TQLV&quot;) or (class_code&amp;&quot;&quot;==&quot;TQLV&quot;) or (class_code&amp;&quot;&quot;==&quot;TQBS&quot;) or (class_code&amp;&quot;&quot;==&quot;RTSST&quot;))<br />market=&quot;micex&quot;<br />end if<br /><br /><br />if ((class_code&amp;&quot;&quot;==&quot;SPBFUT&quot;))<br />market=&quot;forts&quot;<br />end if<br /><br /><br />result=market<br />	 &nbsp;<br />end func<br /><br /><br />func get_class(security_code)<br /> &nbsp; &nbsp; &nbsp; &nbsp;EQNE = &nbsp;GET_CLASS_SECURITIES (&quot;EQNE&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;EQBR = &nbsp;GET_CLASS_SECURITIES (&quot;EQBR&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;EQNL = &nbsp;GET_CLASS_SECURITIES (&quot;EQNL&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;EQLI = &nbsp;GET_CLASS_SECURITIES (&quot;EQLI&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;EQLV = &nbsp;GET_CLASS_SECURITIES (&quot;EQLV&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;EQBS = &nbsp;GET_CLASS_SECURITIES (&quot;EQBS&quot;)<br />		<br />		TQNE = &nbsp;GET_CLASS_SECURITIES (&quot;TQNE&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;TQBR = &nbsp;GET_CLASS_SECURITIES (&quot;TQBR&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;TQNL = &nbsp;GET_CLASS_SECURITIES (&quot;TQNL&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;TQLI = &nbsp;GET_CLASS_SECURITIES (&quot;TQLI&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;TQLV = &nbsp;GET_CLASS_SECURITIES (&quot;TQLV&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;TQBS = &nbsp;GET_CLASS_SECURITIES (&quot;TQBS&quot;)<br />		<br />		GTS = &nbsp;GET_CLASS_SECURITIES (&quot;GTS&quot;)<br />		SPBFUT = &nbsp;GET_CLASS_SECURITIES (&quot;SPBFUT&quot;)<br />	 &nbsp; &nbsp;RTSST = &nbsp;GET_CLASS_SECURITIES (&quot;RTSST&quot;)<br />		class=&quot;&quot;<br />		<br />	 &nbsp; for sec_code in TQNE<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;TQNE&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br />		 <br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in TQBR<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;TQBR&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in &nbsp;TQNL<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;TQNL&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in TQLI<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;TQLI&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in TQLV<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;TQLV&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in TQBS<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;TQBS&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; for sec_code in EQNE<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;EQNE&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br />		 <br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in EQBR<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;EQBR&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in &nbsp;EQNL<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;EQNL&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in EQLI<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;EQLI&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in EQLV<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;EQLV&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp;<br /> &nbsp; &nbsp; &nbsp; for sec_code in EQBS<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;EQBS&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp; <br /> &nbsp; &nbsp; &nbsp; for sec_code in GTS<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;GTS&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp; <br />	 &nbsp; for sec_code in SPBFUT<br /> &nbsp; &nbsp; &nbsp; &nbsp; if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;SPBFUT&quot;<br />		 break<br /> &nbsp; &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; end for<br />	 &nbsp; <br />	 &nbsp; &#39;for sec_code in RTSST<br /> &nbsp; &nbsp; &nbsp; &nbsp; &#39;if sec_code==security_code<br /> &nbsp; &nbsp; &nbsp; &nbsp; &#39;class=&quot;RTSST&quot;<br />		 &#39;break<br /> &nbsp; &nbsp; &nbsp; &nbsp; &#39;end if<br /> &nbsp; &nbsp; &nbsp; &#39;end for<br />	 &nbsp; <br />	 &nbsp; result=class<br />	 &nbsp;<br />end func<br /><br /><br />func get_total_net(market,client,code)<br /> &nbsp; &nbsp;<br />	<br />	if market=&quot;micex&quot; &nbsp;or class&amp;&quot;&quot;==&quot;RTSST&quot;<br />	<br />	 &nbsp; n=GET_NUMBER_OF(&quot;DEPO_LIMITS&quot;)<br /> &nbsp; &nbsp; &nbsp; cur_bal_lim=0<br /> &nbsp; &nbsp; &nbsp; TOTAL_NET=0<br /><br /><br /> &nbsp; &nbsp; <br /> &nbsp; &nbsp; &nbsp; FOR i FR OM 1 to n<br /> &nbsp; &nbsp; &nbsp; &nbsp;limit = GET_ITEM (&quot;DEPO_LIMITS&quot;, i)<br /> &nbsp; &nbsp; &nbsp; &nbsp;<br />		LIMIT_KIND= GET_VALUE (limit, &quot;LIMIT_KIND&quot;)&amp;&quot;&quot;<br /> &nbsp; &nbsp; &nbsp; &nbsp;sch= GET_VALUE (limit, &quot;CLIENT_CODE&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;sec_t=GET_VALUE (limit, &quot;SECCODE&quot;)<br /> &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;if sch==client and LIMIT_KIND&amp;&quot;&quot;==&quot;2&quot; and sec_t==code<br /> &nbsp; &nbsp; &nbsp; &nbsp;TOTAL_NET=GET_VALUE (limit, &quot;CURRENT_BALANCE&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp;usl=1<br /> &nbsp; &nbsp; &nbsp; &nbsp;break<br /> &nbsp; &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; END FOR<br /> &nbsp; &nbsp;result=TOTAL_NET<br />	end if<br />	<br />	if market=&quot;forts&quot; and class&amp;&quot;&quot;!=&quot;RTSST&quot;<br /> &nbsp; &nbsp; &nbsp; n=GET_NUMBER_OF(&quot;FUTURES_CLIENT_HOLDINGS&quot;)<br /> &nbsp; &nbsp; &nbsp; TOTAL_NET=0<br /><br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; FOR i FR OM 1 to n<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; limit = GET_ITEM (&quot;FUTURES_CLIENT_HOLDINGS&quot;, i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sch= GET_VALUE (limit, &quot;TRDACCID&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sec_t=GET_VALUE (limit, &quot;SECCODE&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; 		 &nbsp; &nbsp; if sch=client<br />					 if sec_t=code<br />					 TOTAL_NET=GET_VALUE (limit, &quot;TOTAL_NET&quot;)+0<br />					 end if<br />					 end if<br />					 &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp; END FOR<br /> &nbsp; &nbsp; &nbsp; <br />	 &nbsp; result=TOTAL_NET<br />	end if<br /> &nbsp;<br />end func<br /><br /><br />func get_CBPLPLANNED(market,client)<br /><br /><br /><br /><br /> &nbsp; &nbsp;<br /> &nbsp;if market=&quot;micex&quot;<br /> &nbsp;<br /> &nbsp; &nbsp;n=GET_NUMBER_OF(&quot;MONEY_LIMITS&quot;)<br /> &nbsp; &nbsp;usl=0<br /> &nbsp; &nbsp;CBPLPLANNED=0<br /> <br /> &nbsp; &nbsp; &nbsp; FOR i FR OM 1 to n<br /> &nbsp; &nbsp; &nbsp; &nbsp;limit = GET_ITEM (&quot;MONEY_LIMITS&quot;, i)<br /> &nbsp; &nbsp; &nbsp; &nbsp;sch = GET_VALUE (limit, &quot;CLIENT_CODE&quot;)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LIMIT_KIND= GET_VALUE (limit, &quot;LIMIT_KIND&quot;)&amp;&quot;&quot;<br />		 &nbsp;<br /> &nbsp; &nbsp; &nbsp; &nbsp;if usl=0	and LIMIT_KIND&amp;&quot;&quot;==&quot;2&quot;		<br /> &nbsp; &nbsp; &nbsp; &nbsp;if sch=client<br /> &nbsp; &nbsp; &nbsp; &nbsp;usl=1<br /> &nbsp; &nbsp; &nbsp; &nbsp;CBPLPLANNED=GET_VALUE (limit, &quot;CURRENT_BALANCE&quot;)+0<br /> &nbsp; &nbsp; &nbsp; &nbsp;break<br /> &nbsp; &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp; &nbsp;end if &nbsp;<br /> &nbsp; &nbsp; &nbsp;END FOR<br /> &nbsp;result=CBPLPLANNED<br /> &nbsp;end if<br /> &nbsp;<br /> &nbsp;if market=&quot;forts&quot;<br /> &nbsp; &nbsp; &nbsp;n=GET_NUMBER_OF(&quot;FUTURES_CLIENT_LIMITS&quot;)<br /> &nbsp; &nbsp; &nbsp;CBPLPLANNED=0<br /> &nbsp; &nbsp; &nbsp;usl=0 <br /> &nbsp; &nbsp; &nbsp; &nbsp; FOR i FROM 1 to n<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lim it = GET_ITEM (&quot;FUTURES_CLIENT_LIMITS&quot;, i)<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sch = GET_VALUE (lim it, &quot;TRDACCID&quot;)<br /> &nbsp; &nbsp; &nbsp; <br /> 			if usl=0<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if sch=client<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CBPLPLANNED=GET_VALUE (lim it, &quot;CBPLPLANNED&quot;)+0 <br />		 &nbsp; &nbsp;usl=1<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp; &nbsp;END FOR<br />		<br />		result=CBPLPLANNED<br /> &nbsp;end if &nbsp;<br /><br /><br /><br /><br /> &nbsp;<br />end func<br /><br /><br /><br /><br /><br /><br />func time()<br /><br /><br />time=get_datetime()<br />year=get_value(time,&quot;YEAR&quot;)<br />month=get_value(time,&quot;MONTH&quot;)<br />day=get_value(time,&quot;DAY&quot;)<br />minute=get_value(time,&quot;MIN&quot;)<br />hour=get_value(time,&quot;HOUR&quot;)<br />sec=get_value(time,&quot;SEC&quot;)<br />curdate=year*10000+month*100+day<br />curtime=hour*10000+minute*100+sec<br /><br /><br />res=0<br />if market=&quot;forts&quot;<br /> if (curtime&gt;90005 and &nbsp;curtime&lt;135940) or (curtime&gt;140505 and &nbsp;curtime&lt;184900) or (curtime&gt;190505 and &nbsp;curtime&lt;234500)<br /> res=1<br /> end if<br />end if<br /><br /><br />if market=&quot;micex&quot;<br /> if (curtime&gt;100010 and &nbsp;curtime&lt;184450) <br /> res=1<br /> end if<br />end if<br /><br /><br />work=0<br /><br /><br />IF (0 + IS_CONNECTED() = 1)<br />seconline=SUBSTR(Get_Info_Param(&quot;CONNECTIONTIME&quot;),6,2)<br />minonline=SUBSTR(Get_Info_Param(&quot;CONNECTIONTIME&quot;),3,2)<br />houronline=SUBSTR(Get_Info_Param(&quot;CONNECTIONTIME&quot;),0,2)<br /> &nbsp;if (((houronline+0)&gt;1) or ((minonline+0)&gt;1) or ((seconline+0)&gt;20)) <br /> &nbsp;work=1<br /> &nbsp;end if<br />end if<br /><br /><br /><br /><br /><br /><br />if (work+0)=1<br />result=res<br />else <br />result=0<br />end if<br /><br /><br /><br /><br />end func<br /><br /><br /><br /><br />func get_profit(code_profit)<br />n=get_number_of(&quot;TRADES&quot;)<br />summ=0<br />start_net_trades=get_open_net(market,client,code)<br /><br /><br /><br /><br /><br /><br />if market=&quot;micex&quot;<br />price_close=get_value(get_candle(id_base,true_date,184900,0),&quot;close&quot;)<br />end if<br />if market=&quot;forts&quot;<br />price_close=get_value(get_candle(id_base,true_date,235000,0),&quot;close&quot;)<br />end if<br />message(price_close,1)<br /><br /><br />if (start_net_trades+0)&gt;620<br />summ=summ-(start_net_trades-620)*price_trades<br />end if<br /><br /><br />if (start_net_trades+0)&lt;620<br />summ=summ+(620-start_net_trades)*price_trades<br />end if<br /><br /><br /> for i from 1 to n<br /> str_trades=get_item(&quot;TRADES&quot;,i)<br /> seccode_trades=get_value(str_trades,&quot;SECCODE&quot;)<br /> operation_trades=get_value(str_trades,&quot;OPERATION&quot;)<br /> quantity_trades=get_value(str_trades,&quot;QUANTITY&quot;)<br /> price_trades=get_value(str_trades,&quot;PRICE&quot;)<br /> <br /> &nbsp; if seccode_trades&amp;&quot;&quot;==code_profit<br /> &nbsp; <br /> &nbsp; &nbsp; &nbsp;if operation_trades&amp;&quot;&quot;=&quot;BUY&quot;<br /> &nbsp; &nbsp; &nbsp;summ=summ-quantity_trades*price_trades<br />	 &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if operation_trades&amp;&quot;&quot;=&quot;SELL&quot;<br /> &nbsp; &nbsp; &nbsp;summ=summ+quantity_trades*price_trades<br />	 &nbsp;end if	<br />	 &nbsp;<br /> &nbsp; end if<br /> &nbsp; &nbsp;<br /> end for<br /> <br /> if (total_net+0)&gt;620 <br /> summ=summ+(total_net-620)*last<br /> end if<br /> if (total_net+0)&lt;620 <br /> summ=summ-(620-total_net)*last<br /> end if<br /> <br />&#39;result=summ<br />end func<br /><br /><br />FUNC operation(client,depo,operation,price,quantity,seccode,classcode,market)<br /><br /><br />new_global(&quot;trans_params&quot;, &quot;&quot;) &nbsp;<br />new_global(&quot;trans_result&quot;, &quot;&quot;)<br /><br /><br />trans_params = &quot;&quot;<br />trans_params = set_value (trans_params, &quot;TRANS_ID&quot;, &quot;1&quot;)<br />trans_params = set_value (trans_params, &quot;ACTION&quot;, &quot;NEW_ORDER&quot;)<br />trans_params = set_value (trans_params, &quot;CLASSCODE&quot;, classcode)<br />trans_params = set_value (trans_params, &quot;SECCODE&quot;,seccode)<br /><br /><br />if (market&amp;&quot;&quot;)==&quot;micex&quot;<br />trans_params = set_value (trans_params, &quot;ACCOUNT&quot;,depo)<br />trans_params = set_value (trans_params, &quot;CLIENT_CODE&quot;, client)<br />end if<br /><br /><br />if (market&amp;&quot;&quot;)==&quot;forts&quot;<br />trans_params = set_value (trans_params, &quot;ACCOUNT&quot;,client)<br />trans_params = set_value (trans_params, &quot;CLIENT_CODE&quot;,&quot;&quot;)<br />end if<br /><br /><br /><br /><br />trans_params = set_value (trans_params, &quot;OPERATION&quot;, operation)<br />trans_params = set_value (trans_params, &quot;QUANTITY&quot;, quantity)<br />trans_params = set_value (trans_params, &quot;TYPE&quot;, &quot;L&quot;)<br />trans_params = set_value (trans_params, &quot;PRICE&quot;, price)<br />trans_result=SEND_TRANSACTION (30, trans_params)<br /><br /><br /><br /><br />curr_datetime=Get_DateTime()<br />WRITELN (&quot;qpile_trans.log&quot;, get_value (curr_datetime, &quot;DATETIME&quot;) &amp; &quot;: &quot; &amp; &quot;Result: &quot; &amp; get_value (trans_result, &quot;RESULT&quot;) &amp; &quot;, Result_ex: &quot; &amp; get_value (trans_result, &quot;RESULT_EX&quot;) &amp; &quot;, OrderNum: &quot; &amp; get_value (trans_result, &quot;ORDER_NUMBER&quot;) &amp; &quot;, Description: &quot; &amp; get_value (trans_result, &quot;DESCRIPTION&quot;))<br />if (get_value (trans_result, &quot;RESULT_EX&quot;)+0)!=3<br />message(get_value (trans_result, &quot;DESCRIPTION&quot;),1)<br />end if<br />END FUNC<br /><br /><br /><br /><br />FUNC stop_order(client,depo,operation,price,stopprice,quantity,seccode,classcode,market)<br /><br /><br />trans_params = &quot;&quot;<br />trans_params = set_value (trans_params, &quot;TRANS_ID&quot;, 1)<br />trans_params = set_value (trans_params, &quot;ACTION&quot;, &quot;NEW_STOP_ORDER&quot;)<br />trans_params = set_value (trans_params, &quot;CLASSCODE&quot;, classcode)<br />trans_params = set_value (trans_params, &quot;SECCODE&quot;,seccode)<br /><br /><br />if (market&amp;&quot;&quot;)==&quot;micex&quot;<br />trans_params = set_value (trans_params, &quot;ACCOUNT&quot;,depo)<br />trans_params = set_value (trans_params, &quot;CLIENT_CODE&quot;, client)<br />end if<br /><br /><br />if (market&amp;&quot;&quot;)==&quot;forts&quot;<br />trans_params = set_value (trans_params, &quot;ACCOUNT&quot;,client)<br />trans_params = set_value (trans_params, &quot;CLIENT_CODE&quot;,&quot;&quot;)<br />end if<br /><br /><br /><br /><br /><br /><br />trans_params = set_value (trans_params, &quot;OPERATION&quot;, operation)<br />trans_params = set_value (trans_params, &quot;QUANTITY&quot;, quantity)<br />trans_params = set_value (trans_params, &quot;TYPE&quot;, &quot;L&quot;)<br />trans_params = set_value (trans_params, &quot;PRICE&quot;, price)<br />trans_params = set_value (trans_params, &quot;STOPPRICE&quot;, stopprice)<br />trans_params = set_value (trans_params, &quot;EXPIRY_DATE&quot;,&quot;GTC&quot;)<br /><br /><br />trans_result=SEND_TRANSACTION (30, trans_params)<br /><br /><br />curr_datetime=Get_DateTime()<br />WRITELN (&quot;qpile_trans.log&quot;, get_value (curr_datetime, &quot;DATETIME&quot;) &amp; &quot;: &quot; &amp; &quot;Result: &quot; &amp; get_value (trans_result, &quot;RESULT&quot;) &amp; &quot;, Result_ex: &quot; &amp; get_value (trans_result, &quot;RESULT_EX&quot;) &amp; &quot;, OrderNum: &quot; &amp; get_value (trans_result, &quot;ORDER_NUMBER&quot;) &amp; &quot;, Description: &quot; &amp; get_value (trans_result, &quot;DESCRIPTION&quot;))<br />stop_number=get_value (trans_result, &quot;ORDER_NUMBER&quot;)+0<br /><br /><br /><br /><br />END FUNC<br /><br /><br />FUNC trailing_stop(client,depo,operation,stop_price,offset,SPREAD,quantity,seccode,classcode,market)<br /><br /><br />new_global(&quot;trans_params&quot;, &quot;&quot;) &nbsp;<br />new_global(&quot;trans_result&quot;, &quot;&quot;)<br /><br /><br />trans_params = &quot;&quot;<br />trans_params = set_value (trans_params, &quot;TRANS_ID&quot;, &quot;1&quot;)<br />trans_params = set_value (trans_params, &quot;ACTION&quot;, &quot;NEW_STOP_ORDER&quot;)<br />trans_params = set_value (trans_params, &quot;STOP_ORDER_KIND&quot;, &quot;TAKE_PROFIT_STOP_ORDER&quot;)<br />trans_params = set_value (trans_params, &quot;CLASSCODE&quot;, classcode)<br />trans_params = set_value (trans_params, &quot;SECCODE&quot;,seccode)<br /><br /><br />if (market&amp;&quot;&quot;)==&quot;micex&quot;<br />trans_params = set_value (trans_params, &quot;ACCOUNT&quot;,depo)<br />trans_params = set_value (trans_params, &quot;CLIENT_CODE&quot;, client)<br />end if<br /><br /><br />if (market&amp;&quot;&quot;)==&quot;forts&quot;<br />trans_params = set_value (trans_params, &quot;ACCOUNT&quot;,client)<br />trans_params = set_value (trans_params, &quot;CLIENT_CODE&quot;,&quot;&quot;)<br />end if<br /><br /><br /><br /><br />trans_params = set_value (trans_params, &quot;OPERATION&quot;, operation)<br />trans_params = set_value (trans_params, &quot;QUANTITY&quot;, quantity)<br />trans_params = set_value (trans_params, &quot;TYPE&quot;, &quot;L&quot;) <br />trans_params = set_value (trans_params, &quot;STOPPRICE&quot;, stop_price)<br />trans_params = set_value (trans_params, &quot;OFFSET&quot;, OFFSET)<br />trans_params = set_value (trans_params, &quot;OFFSET_UNITS&quot;, &quot;PRICE_UNITS&quot;)<br />trans_params = set_value (trans_params, &quot;SPREAD&quot;, spread)<br />trans_params = set_value (trans_params, &quot;SPREAD_UNITS&quot;, &quot;PRICE_UNITS&quot;)<br />trans_params = set_value (trans_params, &quot;EXPIRY_DATE&quot;,&quot;GTC&quot;)<br />trans_result=SEND_TRANSACTION (30, trans_params)<br /><br /><br />take_order=get_value (trans_result,&quot;ORDER_NUMBER&quot;) <br />curr_datetime=Get_DateTime()<br />WRITELN (&quot;qpile_trans.log&quot;, get_value (curr_datetime, &quot;DATETIME&quot;) &amp; &quot;: &quot; &amp; &quot;Result: &quot; &amp; get_value (trans_result, &quot;RESULT&quot;) &amp; &quot;, Result_ex: &quot; &amp; get_value (trans_result, &quot;RESULT_EX&quot;) &amp; &quot;, OrderNum: &quot; &amp; get_value (trans_result, &quot;ORDER_NUMBER&quot;) &amp; &quot;, Description: &quot; &amp; get_value (trans_result, &quot;DESCRIPTION&quot;))<br /><br /><br />END FUNC<br /><br /><br /><br /><br /><br /><br />FUNC binded_stop(client,depo,operation,stop_price,price,linked_price,quantity,seccode,classcode,market)<br /><br /><br /><br /><br />new_global(&quot;trans_params&quot;, &quot;&quot;) &nbsp;<br />new_global(&quot;trans_result&quot;, &quot;&quot;)<br /><br /><br />trans_params = &quot;&quot;<br />trans_params = set_value (trans_params, &quot;TRANS_ID&quot;, &quot;1&quot;)<br />trans_params = set_value (trans_params, &quot;ACTION&quot;, &quot;NEW_STOP_ORDER&quot;)<br />trans_params = set_value (trans_params, &quot;STOP_ORDER_KIND&quot;, &quot;WITH_LINKED_LIMIT_ORDER&quot;)<br />trans_params = set_value (trans_params, &quot;CLASSCODE&quot;, classcode)<br />trans_params = set_value (trans_params, &quot;SECCODE&quot;,seccode)<br /><br /><br />if (market&amp;&quot;&quot;)==&quot;micex&quot;<br />trans_params = set_value (trans_params, &quot;ACCOUNT&quot;,depo)<br />trans_params = set_value (trans_params, &quot;CLIENT_CODE&quot;, client)<br />end if<br /><br /><br />if (market&amp;&quot;&quot;)==&quot;forts&quot;<br />trans_params = set_value (trans_params, &quot;ACCOUNT&quot;,client)<br />trans_params = set_value (trans_params, &quot;CLIENT_CODE&quot;,&quot;&quot;)<br />end if<br /><br /><br /><br /><br />trans_params = set_value (trans_params, &quot;OPERATION&quot;, operation)<br />trans_params = set_value (trans_params, &quot;QUANTITY&quot;, quantity)<br />trans_params = set_value (trans_params, &quot;TYPE&quot;, &quot;L&quot;) <br />trans_params = set_value (trans_params, &quot;STOPPRICE&quot;, stop_price)<br />trans_params = set_value (trans_params, &quot;PRICE&quot;, price)<br />trans_params = set_value (trans_params, &quot;LINKED_ORDER_PRICE&quot;, linked_price)<br />trans_params = set_value (trans_params, &quot;KILL_IF_LINKED_ORDER_PARTLY_FILLED&quot;, &quot;NO&quot;)<br />trans_result=SEND_TRANSACTION (30, trans_params)<br /><br /><br />binded_stop_number=get_value (trans_result,&quot;ORDER_NUMBER&quot;) <br />curr_datetime=Get_DateTime()<br />WRITELN (&quot;qpile_trans.log&quot;, get_value (curr_datetime, &quot;DATETIME&quot;) &amp; &quot;: &quot; &amp; &quot;Result: &quot; &amp; get_value (trans_result, &quot;RESULT&quot;) &amp; &quot;, Result_ex: &quot; &amp; get_value (trans_result, &quot;RESULT_EX&quot;) &amp; &quot;, OrderNum: &quot; &amp; get_value (trans_result, &quot;ORDER_NUMBER&quot;) &amp; &quot;, Description: &quot; &amp; get_value (trans_result, &quot;DESCRIPTION&quot;))<br /><br /><br />END FUNC<br /><br /><br /><br /><br /><br /><br />FUNC kill_stop_order(orderkey,classcode,seccode)<br /><br /><br /><br /><br />trans_params = &quot;&quot;<br />trans_params = SET_VALUE(trans_params,&quot;CLASSCODE&quot;,classcode)<br />trans_params = set_value (trans_params, &quot;SECCODE&quot;,seccode)<br />trans_params = SET_VALUE(trans_params,&quot;TRANS_ID&quot;,&quot;1&quot;)<br />trans_params = SET_VALUE(trans_params,&quot;ACTION&quot;,&quot;KILL_STOP_ORDER&quot;)<br />trans_params = set_value (trans_params, &quot;OPERATION&quot;, &quot;s&quot;)<br />trans_params = SET_VALUE(trans_params,&quot;STOP_ORDER_KEY&quot;,orderkey)<br />trans_result = SEND_TRANSACTION (30,trans_params)<br /><br /><br /><br /><br />curr_datetime=Get_DateTime()<br />WRITELN (&quot;qpile_trans.log&quot;, get_value (curr_datetime, &quot;DATETIME&quot;) &amp; &quot;: &quot; &amp; &quot;Result: &quot; &amp; get_value (trans_result, &quot;RESULT&quot;) &amp; &quot;, Result_ex: &quot; &amp; get_value (trans_result, &quot;RESULT_EX&quot;) &amp; &quot;, OrderNum: &quot; &amp; get_value (trans_result, &quot;ORDER_NUMBER&quot;) &amp; &quot;, Description: &quot; &amp; get_value (trans_result, &quot;DESCRIPTION&quot;))<br /><br /><br />END FUNC<br /><br /><br /><br /><br /><br /><br />FUNC get_candle(id,date,time,line_id)<br />candle=create_map()<br />slice = Get_Candle_Ex(id, date,time) <br />time =Get_Value(slice,&quot;TIME&quot;) <br />lines=Get_Value(slice,&quot;LINES&quot;)<br />line=Get_Collection_Item(lines, line_id)<br />close=Get_Value(line,&quot;CLOSE&quot;)+0<br />high=Get_Value(line,&quot;HIGH&quot;)+0<br />low=Get_Value(line,&quot;LOW&quot;)+0<br />open=Get_Value(line,&quot;OPEN&quot;)+0<br />candle=set_value(candle,&quot;open&quot;,open)<br />candle=set_value(candle,&quot;high&quot;,high)<br />candle=set_value(candle,&quot;low&quot;,low)<br />candle=set_value(candle,&quot;close&quot;,close)<br />candle=set_value(candle,&quot;time&quot;,time)<br />result=candle<br />end func<br /><br /><br /><br /><br />FUNC get_prices(id,market)<br /><br /><br />if id&amp;&quot;&quot;!=&quot;&quot;<br />new_global(&quot;cur_time_bar_pred&quot;,0)<br />new_global(&quot;close_pred&quot;,0)<br />new_global(&quot;open_pred&quot;,0)<br />new_global(&quot;high_pred&quot;,0)<br />new_global(&quot;low_pred&quot;,0)<br /><br /><br />time=get_datetime()<br />hour=get_value(time,&quot;HOUR&quot;)<br />min=get_value(time,&quot;MIN&quot;)<br />day=get_value(time,&quot;DAY&quot;)<br />month=get_value(time,&quot;MONTH&quot;)<br />year=get_value(time,&quot;YEAR&quot;)<br />cur_date=year*10000+month*100+day<br />cur_time=hour*10000+min*100<br />true_date=0<br /><br /><br />for i from 0 to 100000<br /><br /><br />candle=get_candle(id,cur_date,183000,0)<br /><br /><br /> &nbsp; if (get_value(candle,&quot;open&quot;)+0)=0<br /> &nbsp; <br /> &nbsp; &nbsp; &nbsp;if (day+0)&lt;2<br /> &nbsp; &nbsp; &nbsp;month=month-1<br /> &nbsp; &nbsp; &nbsp;day=32<br /> &nbsp; &nbsp; &nbsp;if month=0<br /> &nbsp; &nbsp; &nbsp;month=12<br /> &nbsp; &nbsp; &nbsp;year=year-1<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;end if<br />	 &nbsp;<br /><br /><br /> &nbsp; &nbsp; &nbsp;day=day-1<br />	 &nbsp;cur_date=year*10000+month*100+day<br /> &nbsp; &nbsp;else <br />	true_date=cur_date<br />	break<br />	end if<br /> &nbsp; <br />end for<br /><br /><br />timeframe_collection=create_collection()<br />hour=18<br />min=30<br />time=hour*10000+min*100<br />pred_time=&quot;0&quot;<br />j=0<br />timeframe=&quot;&quot;<br /><br /><br />for i from 0 to &nbsp;1000<br /><br /><br /> &nbsp; candle=get_candle(id,true_date,time,0)<br /> &nbsp; <br /> &nbsp; if (get_value(candle,&quot;time&quot;)+0)=0<br /> &nbsp; timeframe=&quot;day&quot;<br /> &nbsp; break<br /> &nbsp; end if<br /> &nbsp; <br /> &nbsp; if get_value(candle,&quot;time&quot;)&amp;&quot;&quot;=pred_time&amp;&quot;&quot;<br /> &nbsp; else<br /> &nbsp; timeframe_collection=insert_collection_item(timeframe_collection,j,get_value(candle,&quot;time&quot;))<br /> &nbsp; pred_time=get_value(candle,&quot;time&quot;)<br /> &nbsp; j=j+1<br /> &nbsp; end if<br /> &nbsp; <br /> &nbsp; <br /> &nbsp; if (min+0)=0<br /> &nbsp; hour=hour-1<br /> &nbsp; min=59<br /> &nbsp; else<br /> &nbsp; min=min-1<br /> &nbsp; end if<br /> &nbsp; <br /> &nbsp; time=hour*10000+min*100<br /> &nbsp; <br /> &nbsp; if (get_collection_count(timeframe_collection)+0)&gt;1<br /> &nbsp; break<br /> &nbsp; end if<br /> &nbsp;<br />end for<br /><br /><br /><br /><br />dateframe_collection=create_collection()<br />counter=0<br />time=get_datetime()<br />day=get_value(time,&quot;DAY&quot;)<br />month=get_value(time,&quot;MONTH&quot;)<br />year=get_value(time,&quot;YEAR&quot;)<br />cur_date=year*10000+month*100+day<br />pred_open=0<br />pred_high=0<br />pred_close=0<br />pred_low=0<br />if (timeframe&amp;&quot;&quot;)==&quot;day&quot;<br /> &nbsp; for i from 0 to &nbsp;1000<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; candle=get_candle(id,cur_date,150000,0) <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />		 &nbsp; if ((get_value(candle,&quot;open&quot;)+0)!=(pred_open+0) or (get_value(candle,&quot;high&quot;)+0)!=(pred_high+0) or (get_value(candle,&quot;close&quot;)+0)!=(pred_close+0)) <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((get_value(candle,&quot;close&quot;)+0)!=0)<br />		 &nbsp; dateframe_collection=INSERT_COLLECTION_ITEM(dateframe_collection,counter,cur_date)		 &nbsp; <br />		 &nbsp; pred_open=get_value(candle,&quot;open&quot;)<br />		 &nbsp; pred_high=get_value(candle,&quot;high&quot;)<br />		 &nbsp; pred_close=get_value(candle,&quot;close&quot;)<br />		 &nbsp; counter=counter+1<br />		 &nbsp; end if<br />		 &nbsp; end if<br /><br /><br />		 &nbsp; &nbsp;if (day+0)=1<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;month=month-1<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;day=32<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (month+0)=0<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; month=12<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; year=year-1<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end if<br />			 end if<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;day=day-1 &nbsp;<br /><br /><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if get_collection_count(dateframe_collection)&gt;20<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break		 &nbsp; <br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end if<br />		 <br /> &nbsp; &nbsp; &nbsp; &nbsp;cur_date=year*10000+month*100+day<br /> &nbsp; end for<br />end if<br /><br /><br /><br /><br /><br /><br />hour1=SUBSTR (get_collection_item(timeframe_collection,0), 0, 2)<br />min1=SUBSTR (get_collection_item(timeframe_collection,0), 2, 2) <br />hour2=SUBSTR (get_collection_item(timeframe_collection,1), 0, 2)<br />min2=SUBSTR (get_collection_item(timeframe_collection,1), 2, 2) <br />chislo=0<br />if (((timeframe&amp;&quot;&quot;)&lt;&gt;&quot;&quot;) or ((timeframe&amp;&quot;&quot;)&lt;&gt;&quot;day&quot;))<br /><br /><br />if ((hour1+0)=(hour2+0))<br /> &nbsp;if (min1-min2)=1<br /> &nbsp;timeframe=1<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;if (min1-min2)=2<br /> &nbsp;timeframe=2<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;if (min1-min2)=3<br /> &nbsp;timeframe=3<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;if (min1-min2)=4<br /> &nbsp;timeframe=4<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;if (min1-min2)=5<br /> &nbsp;timeframe=5<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;if (min1-min2)=6<br /> &nbsp;timeframe=6<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;if (min1-min2)=10<br /> &nbsp;timeframe=10<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;if (min1-min2)=15<br /> &nbsp;timeframe=15<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;if (min1-min2)=20<br /> &nbsp;timeframe=20<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;if (min1-min2)=30<br /> &nbsp;timeframe=30<br /> &nbsp;chislo=1<br /> &nbsp;end if<br /> &nbsp;<br />end if<br /><br /><br />if ((hour1+0)&lt;&gt;(hour2+0))<br /> &nbsp;<br /> &nbsp;if (hour1-hour2)=1<br /> &nbsp; &nbsp; timeframe=60<br />	 chislo=1<br /> &nbsp;end if<br /> &nbsp;<br /> &nbsp;if (hour1-hour2)=2<br /> &nbsp; &nbsp; timeframe=120<br />	 chislo=1<br /> &nbsp;end if<br /> &nbsp;<br /> &nbsp;if (hour1-hour2)=4<br /> &nbsp; &nbsp; timeframe=240<br />	 chislo=1<br /> &nbsp;end if<br /> <br />end if<br /><br /><br /><br /><br />end if<br /><br /><br /><br /><br />hour1=SUBSTR (get_collection_item(timeframe_collection,0), 0, 2)<br />min1=SUBSTR (get_collection_item(timeframe_collection,0), 2, 2) <br />hour2=SUBSTR (get_collection_item(timeframe_collection,1), 0, 2)<br />min2=SUBSTR (get_collection_item(timeframe_collection,1), 2, 2) <br />day_temp=0<br /><br /><br />&#39;if (timeframe&amp;&quot;&quot;==&quot;day&quot;)<br />&#39;timeframe=&quot;week&quot;<br />&#39; &nbsp;for i from 0 to get_collection_count(dateframe_collection)-1<br /> &#39; &nbsp; z=get_collection_item(dateframe_collection,i)<br /> &#39; &nbsp; t=SUBSTR(get_collection_item(dateframe_collection,i), 6, 2)<br />&#39;	if (i+0)&gt;0<br />&#39;	if abs(t-day_temp)==1<br />&#39;	timeframe=&quot;day&quot;<br />&#39;	break<br />&#39;	end if<br />&#39;	end if<br />	<br /> &#39; day_temp=SUBSTR (get_collection_item(dateframe_collection,i), 6, 2)<br /> &#39; end for<br /><br /><br />&#39;end if<br /><br /><br /><br /><br />time=get_datetime()<br />hour=get_value(time,&quot;HOUR&quot;)<br />min=get_value(time,&quot;MIN&quot;)<br />day=get_value(time,&quot;DAY&quot;)<br />correct_day=day<br />month=get_value(time,&quot;MONTH&quot;)<br />year=get_value(time,&quot;YEAR&quot;)<br />cur_date=year*10000+month*100+day<br />cur_time=hour*10000+min*100<br /><br /><br />LOW_col=CREATE_COLLECTION()<br />HIGH_col=CREATE_COLLECTION()<br />open_col=CREATE_COLLECTION()<br />CLOSE_col=CREATE_COLLECTION()<br />time_col=CREATE_COLLECTION()<br />date_col=CREATE_COLLECTION()<br />cur_time_bar=get_value(get_candle(id,cur_date,cur_time,0),&quot;time&quot;)<br /><br /><br /><br /><br />if ((cur_time_bar&amp;&quot;&quot;)!=&quot;&quot;)<br />cur_time_bar_pred=cur_time_bar<br />else<br />cur_time_bar=cur_time_bar_pred<br />end if<br />f=0<br /><br /><br /> &nbsp;if (cur_time_bar+0)!=0<br /> &nbsp;low_col=INSERT_COLLECTION_ITEM(low_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),&quot;low&quot;))<br /> &nbsp;high_col=INSERT_COLLECTION_ITEM(high_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),&quot;high&quot;))<br /> &nbsp;open_col=INSERT_COLLECTION_ITEM(open_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),&quot;open&quot;))<br /> &nbsp;close_col=INSERT_COLLECTION_ITEM(close_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),&quot;close&quot;))<br /> &nbsp;time_col=INSERT_COLLECTION_ITEM(time_col,0,cur_time_bar)<br /> &nbsp;date_col=INSERT_COLLECTION_ITEM(date_col,0,cur_date)<br /> &nbsp;f=1<br /> &nbsp;end if<br /><br /><br /><br /><br />find_date=cur_date<br />point=0<br /><br /><br /><br /><br />if (chislo+0)==1<br /><br /><br /><br /><br />for i from 1 to 2000<br />temp3=ceil(cur_time_bar/10000)<br />temp4=cur_time_bar/10000<br /><br /><br />if temp3=temp4<br /><br /><br />if floor(cur_time_bar/10000)=cur_time_bar/10000<br /><br /><br />if timeframe=1<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5900<br />end if<br />if timeframe=2<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5800<br />end if<br />if timeframe=3<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5700<br />end if<br />if timeframe=4<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5600<br />end if<br />if timeframe=5<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5500<br />end if<br />if timeframe=6<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+4800<br />end if<br />if timeframe=10<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5000<br />end if<br />if timeframe=15<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+4500<br />end if<br />if timeframe=20<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+4000<br />end if<br />if timeframe=30<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000+3000<br />end if<br />if timeframe=60<br />cur_time_bar=ceil(cur_time_bar/10000-1)*10000<br />end if<br />if timeframe=120<br />cur_time_bar=ceil(cur_time_bar/10000-2)*10000<br />end if<br />if timeframe=240<br />cur_time_bar=ceil(cur_time_bar/10000-4)*10000<br />end if<br /><br /><br />end if<br />else<br />cur_time_bar=cur_time_bar-timeframe*100<br />end if<br /><br /><br /><br /><br /><br /><br /><br /><br />if timeframe&lt;60<br />if &nbsp;cur_time_bar&lt;90000<br /><br /><br />if (market&amp;&quot;&quot;)=&quot;micex&quot;<br /> if timeframe=1<br /> cur_time_bar=184400<br /> end if<br /> if timeframe=2<br /> cur_time_bar=184400<br /> end if<br /> if timeframe=3<br /> cur_time_bar=184200<br /> end if<br /> if timeframe=4<br /> cur_time_bar=184400<br /> end if<br /> if timeframe=5<br /> cur_time_bar=184000<br /> end if<br /> if timeframe=6<br /> cur_time_bar=184200<br /> end if<br /> if timeframe=10<br /> cur_time_bar=184000<br /> end if<br /> if timeframe=15<br /> cur_time_bar=183000<br /> end if<br /> if timeframe=20<br /> cur_time_bar=184000<br /> end if<br /> if timeframe=30<br /> cur_time_bar=183000<br /> end if<br />end if<br /><br /><br /><br /><br />if (market&amp;&quot;&quot;)=&quot;forts&quot;<br /> if timeframe=1<br /> cur_time_bar=234900<br /> end if<br /> if timeframe=2<br /> cur_time_bar=234800<br /> end if<br /> if timeframe=3<br /> cur_time_bar=234800<br /> end if<br /> if timeframe=4<br /> cur_time_bar=234800<br /> end if<br /> if timeframe=5<br /> cur_time_bar=234500<br /> end if<br /> if timeframe=6<br /> cur_time_bar=234800<br /> end if<br /> if timeframe=10<br /> cur_time_bar=234000<br /> end if<br /> if timeframe=15<br /> cur_time_bar=234500<br /> end if<br /> if timeframe=20<br /> cur_time_bar=234000<br /> end if<br /> if timeframe=30<br /> cur_time_bar=233000<br /> end if<br />end if<br /><br /><br />if timeframe&gt;50<br /><br /><br />if cur_time_bar=100000<br />break<br />end if<br /><br /><br /><br /><br />if cur_time_bar&lt;90000<br /><br /><br />if timeframe=60<br />cur_time_bar=230000<br />end if<br /><br /><br />if timeframe=120<br />cur_time_bar=220000<br />end if<br /><br /><br />if timeframe=240<br />cur_time_bar=200000<br />end if<br /><br /><br />end if<br /><br /><br />end if<br /><br /><br /><br /><br />usl=0<br /><br /><br /> &nbsp;for j from 1 to 15<br /><br /><br /> &nbsp; &nbsp;if (day+0)&lt;2<br /> &nbsp; &nbsp;month=month-1<br /> &nbsp; &nbsp;day=32<br /> &nbsp; &nbsp;if month=0<br /> &nbsp; &nbsp;month=12<br /> &nbsp; &nbsp;year=year-1<br /> &nbsp; &nbsp;end if<br /> &nbsp; &nbsp;end if<br /><br /><br /> &nbsp; &nbsp;day=day-1<br />	<br /><br /><br /><br /><br /> &nbsp; &nbsp;cur_date=year*10000+month*100+day<br />	<br /> &nbsp; &nbsp;slice_day = Get_Candle_Ex(id, cur_date, 103000) <br /> &nbsp; &nbsp;LineCount_day=Get_Value(slice_day,&quot;COUNT&quot;) +0<br />	<br /> &nbsp; &nbsp; &nbsp;if (usl+0)=0<br /> &nbsp; &nbsp; &nbsp;if LineCount_day&gt;0 <br /> &nbsp; &nbsp; &nbsp;find_date=cur_date<br /> &nbsp; &nbsp; &nbsp;usl=1<br />	 &nbsp;break<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp;end for<br />	<br />end if<br />end if<br /><br /><br /><br /><br /><br /><br />if &nbsp;timeframe&gt;59<br />if &nbsp;cur_time_bar&lt;80000<br /><br /><br />if (market&amp;&quot;&quot;)=&quot;forts&quot;<br /><br /><br /> if &nbsp;timeframe=60<br /> cur_time_bar=230000<br /> end if<br /><br /><br /> if timeframe=120<br /> cur_time_bar=220000<br /> end if<br /><br /><br /> if timeframe=240<br /> cur_time_bar=200000<br /> end if<br /><br /><br />end if<br /><br /><br />if (market&amp;&quot;&quot;)=&quot;micex&quot;<br /><br /><br /> if &nbsp;timeframe=60<br /> cur_time_bar=180000<br /> end if<br /><br /><br /> if timeframe=120<br /> cur_time_bar=180000<br /> end if<br /><br /><br /> if timeframe=240<br /> cur_time_bar=160000<br /> end if<br /><br /><br />end if<br /><br /><br /><br /><br />usl=0<br /><br /><br /> &nbsp;for j from 1 to 15<br /> &nbsp;<br /> &nbsp; &nbsp;if (day+0)&lt;2<br /> &nbsp; &nbsp;month=month-1<br /> &nbsp; &nbsp;day=32<br /> &nbsp; &nbsp;if month=0<br /> &nbsp; &nbsp;month=12<br /> &nbsp; &nbsp;year=year-1<br /> &nbsp; &nbsp;end if<br /> &nbsp; &nbsp;end if<br /><br /><br /> &nbsp; &nbsp;day=day-1<br /><br /><br /> &nbsp; &nbsp;curdate=year*10000+month*100+day<br /> &nbsp; slice_day = Get_Candle_Ex(id, curdate, 103000) <br /> &nbsp; &nbsp;LineCount_day=Get_Value(slice_day,&quot;COUNT&quot;) +0<br /> &nbsp; &nbsp; &nbsp;if (usl+0)=0<br /> &nbsp; &nbsp; &nbsp;if LineCOUNT_day&gt;0 <br /> &nbsp; &nbsp; &nbsp;find_date=curdate<br /> &nbsp; &nbsp; &nbsp;usl=1<br /> &nbsp; &nbsp; &nbsp; break<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp;end for<br />	<br />end if<br />end if<br /><br /><br />slice = Get_Candle_Ex(id, find_date,cur_time_bar) <br />LineCount=Get_Value(slice,&quot;COUNT&quot;) +0<br />time=Get_Value(slice,&quot;TIME&quot;) <br />lines=Get_Value(slice,&quot;LINES&quot;)<br /><br /><br /><br /><br /><br /><br />if f&lt;5<br />if LineCount&gt;0<br />if ((cur_time_bar+0)&lt;&gt;0)<br /> &nbsp;LineCount=Get_Value(slice,&quot;COUNT&quot;) <br /> &nbsp;time=Get_Value(slice,&quot;TIME&quot;) <br /> &nbsp;lines=Get_Value(slice,&quot;LINES&quot;)<br /> &nbsp;line=Get_Collection_Item(lines, 0)<br /><br /><br /> &nbsp;low=Get_Value(line,&quot;LOW&quot;)<br /> &nbsp;high=Get_Value(line,&quot;HIGH&quot;)<br /> &nbsp;open=Get_Value(line,&quot;OPEN&quot;)<br /> &nbsp;close=Get_Value(line,&quot;CLOSE&quot;)<br /> &nbsp;line_name =Get_Value(line,&quot;NAME&quot;) <br /> &nbsp;volume=Get_Value(line,&quot;VOLUME&quot;)<br /> &nbsp;<br /> <br /> &nbsp;low_col=INSERT_COLLECTION_ITEM(low_col,f,low)<br /> &nbsp;high_col=INSERT_COLLECTION_ITEM(high_col,f,high)<br /> &nbsp;open_col=INSERT_COLLECTION_ITEM(open_col,f,open)<br /> &nbsp;close_col=INSERT_COLLECTION_ITEM(close_col,f,close)<br /> &nbsp;time_col=INSERT_COLLECTION_ITEM(time_col,f,cur_time_bar)<br /> &nbsp;date_col=INSERT_COLLECTION_ITEM(date_col,f,find_date)<br /><br /><br /> &nbsp;<br />f=f+1<br />end if<br />end if<br />else<br />break<br />end if<br /><br /><br />end for<br />end if<br /><br /><br />prices=create_map()<br />prices=SET_VALUE(prices,&quot;days&quot;,dateframe_collection)<br />prices=SET_VALUE(prices,&quot;timeframe&quot;,timeframe)<br />prices=SET_VALUE(prices,&quot;high&quot;,high_col)<br />prices=SET_VALUE(prices,&quot;low&quot;,low_col)<br />prices=SET_VALUE(prices,&quot;close&quot;,close_col)<br />prices=SET_VALUE(prices,&quot;open&quot;,open_col)<br />prices=SET_VALUE(prices,&quot;time&quot;,time_col)<br />prices=SET_VALUE(prices,&quot;date&quot;,date_col)<br />result=prices<br />else<br />result=0<br />end if<br />end func<br />=============<br /> <br />
			<i>07.04.2023 10:51:43, Юрий.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message68985/topic8000/</link>
			<guid>http://forum.quik.ru/messages/forum10/message68985/topic8000/</guid>
			<pubDate>Fri, 07 Apr 2023 10:51:43 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
