<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>Форум QUIK [тема: Есть функция OHLC для прошлых свечей - помогите разобраться]</title>
		<link>http://forum.quik.ru</link>
		<description>Новое в теме Есть функция OHLC для прошлых свечей - помогите разобраться форума  на сайте Форум QUIK [forum.quik.ru]</description>
		<language>ru</language>
		<docs>http://backend.userland.com/rss2</docs>
		<pubDate>Sat, 23 May 2026 17:43:56 +0300</pubDate>
		<item>
			<title>Есть функция OHLC для прошлых свечей - помогите разобраться</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum9/message34212/topic3989/">Есть функция OHLC для прошлых свечей - помогите разобраться</a></b> <i>как вытащить из нее OHLC дневных свечей по номеру свечи</i> в форуме <a href="http://forum.quik.ru/forum9/">Программирование на языке QPILE</a>. <br />
			Вот это спасибо!!! <br />
			<i>04.10.2018 15:29:38, Евгений.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum9/message34212/topic3989/</link>
			<guid>http://forum.quik.ru/messages/forum9/message34212/topic3989/</guid>
			<pubDate>Thu, 04 Oct 2018 15:29:38 +0300</pubDate>
			<category>Программирование на языке QPILE</category>
		</item>
		<item>
			<title>Есть функция OHLC для прошлых свечей - помогите разобраться</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum9/message34210/topic3989/">Есть функция OHLC для прошлых свечей - помогите разобраться</a></b> <i>как вытащить из нее OHLC дневных свечей по номеру свечи</i> в форуме <a href="http://forum.quik.ru/forum9/">Программирование на языке QPILE</a>. <br />
			<a class="blog-p-user-name" id="bp_PiJ2exNm" href="/user/12595/" bx-tooltip-user-id="12595">Евгений</a>, <br />Проблема в том что для дневных свечек нужно в качестве времени передавать "000000", иначе не работает. <br />
			<i>04.10.2018 14:21:02, Sergey Gorokhov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum9/message34210/topic3989/</link>
			<guid>http://forum.quik.ru/messages/forum9/message34210/topic3989/</guid>
			<pubDate>Thu, 04 Oct 2018 14:21:02 +0300</pubDate>
			<category>Программирование на языке QPILE</category>
		</item>
		<item>
			<title>Есть функция OHLC для прошлых свечей - помогите разобраться</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum9/message34204/topic3989/">Есть функция OHLC для прошлых свечей - помогите разобраться</a></b> <i>как вытащить из нее OHLC дневных свечей по номеру свечи</i> в форуме <a href="http://forum.quik.ru/forum9/">Программирование на языке QPILE</a>. <br />
			Само собой самописная. Работает великолепно, на всех таймфреймах кроме ДНЕВКИ.<br /><br />То что вы выложили, работатет только до 60 минут. А нужен день. У вас есть функция для <br />вывода open, high, low, close &nbsp;для заданного количества свечей в прошлое по номерам 1,2,3, 4....??? <br />Ваш пример мне бесполезен.<br /><br />Или помогите вытащить дневки из моего кода. Они там есть, но у меня знаний программирования<br />не хватает чтобы понять как их достать. Остальное достал - там пару ошибок было поправил, и теперь <br />тащит всё - от минуты до 4 часов включитльно. <br />А ДЕНЬ НЕ ХОЧЕТ. НУЖЕН ДЕНЬ !!!!!!!!!!!!!! <br />
			<i>04.10.2018 13:04:04, Евгений.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum9/message34204/topic3989/</link>
			<guid>http://forum.quik.ru/messages/forum9/message34204/topic3989/</guid>
			<pubDate>Thu, 04 Oct 2018 13:04:04 +0300</pubDate>
			<category>Программирование на языке QPILE</category>
		</item>
		<item>
			<title>Есть функция OHLC для прошлых свечей - помогите разобраться</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum9/message34196/topic3989/">Есть функция OHLC для прошлых свечей - помогите разобраться</a></b> <i>как вытащить из нее OHLC дневных свечей по номеру свечи</i> в форуме <a href="http://forum.quik.ru/forum9/">Программирование на языке QPILE</a>. <br />
			Здравствуйте,<br />Не понятно как оно вообще у Вас работает. Стандартная функция GET_CANDLE имеет гораздо больше параметров. Видимо у Вас не родная функция, а самописная.<br />Рекомендуем посмотреть наш пример, возможно в нем найдете ответ.<br /><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>PORTFOLIO_EX GetDayCandles;
DESCRIPTION Сохранение свечей графиков ряда параметров набора инструментов за текущую торговую сессию (в таблицу и в файл);
CLIENTS_LIST ALL_CLIENTS;
FIRMS_LIST ALL_FIRMS;
USE_CASE_SENSITIVE_CONSTANTS

PROGRAM

ClassCodeList = "SPBFUT"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' коды классов бумаг, по которым будет осуществляться вывод
SecCodeList = "RIZ2"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' коды бумаг, по которым будет осуществляться вывод
Params = ""&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' параметры, по которым будут строиться свечи 
GraphType = "PRICE" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' тип графика
Intervals = "1,2,3,4,5,6,10,15,20,30,60" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' интервал графика: 1 - минутный, 5 - 5-минутный и пр.
Separator = "."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' разделитель дробной части
OutPath = "c:&#92;"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' путь к директории с файлом свечей
razn=3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' разница с Москвой в часах
start_time="10:00:00"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' 10 часов 00 минут утра по Москве - время начала текущей торговой сессии "HHMMSS"


'=============================ФУНКЦИИ===============================
'ВЫЧИСЛЯЕТ ЧАСТНОЕ ОТ ДЕЛЕНИЯ
'DOUBLE div(DOUBLE Value, DOUBLE Value)
'Для работы нужны функции: никаких
func div(result,y_)
&nbsp;&nbsp;&nbsp;result=FLOOR(result/y_)
end func

'ВЫЧИСЛЯЕТ ОСТАТОК ОТ ДЕЛЕНИЯ
'DOUBLE mod(DOUBLE Value, DOUBLE Value)
'Для работы нужны функции: никаких
func mod(result,y_)
&nbsp;&nbsp;&nbsp;result=result-FLOOR(result/y_)*y_
end func

'ПРОВЕРЯЕМ ВХОЖДЕНИЕ pattern в СТРОКЕ list
'DOUBLE is_in_list(STRING Value, STRING Value)
'Для работы нужны функции: никаких
FUNC is_in_list(list, pattern)
&nbsp;&nbsp;result = 0
&nbsp;&nbsp;if&nbsp;&nbsp;0 + find(list, 0, pattern) = -1 
&nbsp;&nbsp;&nbsp;&nbsp;result = 0
&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;result = 1
&nbsp;&nbsp;end if
END FUNC

'ПЕРЕВОДИМ ВРЕМЯ ИЗ ФОРМАТА HHMMSS в HH:MM:SS
'STRING HHMMSS2Time(STRING Value)
'Для работы нужны функции: никаких
FUNC HHMMSS2Time(result)
 result=""&#38;result
&nbsp;&nbsp; if LEN(result)=5
&nbsp;&nbsp;&nbsp;&nbsp;result="0"&#38;result
&nbsp;&nbsp; end if
 if LEN(result)=6
&nbsp;&nbsp;&nbsp;result&nbsp;&nbsp;= substr(result, 0, 2) &#38; ":" &#38; substr(result, 2, 2) &#38; ":" &#38; substr(result, 4, 2) 
 end if
END FUNC

'ПЕРЕВОДИМ ВРЕМЯ ИЗ ФОРМАТА HH:MM:SS в HHMMSS
'STRING Time2HHMMSS(STRING Value)
'Для работы нужны функции: FTEXT
Func Time2HHMMSS(result)
result=FTEXT(SUBSTR(result,0,FIND(result,0,":")))&#38; _
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FTEXT(SUBSTR(result,FIND(result,0,":")+1,FIND(result,FIND(result,0,":")+1,":")-FIND(result,0,":")-1)) &#38; _
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FTEXT(SUBSTR(result,FIND(result,FIND(result,0,":")+1,":")+1,len(result)-FIND(result,FIND(result,0,":")+1,":")-1))
result=FTEXT(result)
end Func

'ПРОВЕРЯЕМ КОРРЕКТНОСТЬ КОЛИЧЕСТВА СИМОЛОВ ПЕРЕМЕННОЙ
'STRING FTEXT(STRING Value)
'Для работы нужны функции: никаких
func FTEXT(result)
result=""&#38;result
&nbsp;&nbsp; if (len(result)=1) OR (len(result)=5)
&nbsp;&nbsp;&nbsp;&nbsp;result="0"&#38;result
&nbsp;&nbsp; end if
end func

'ЗАМЕНЯЕМ 0 ПУСТОЙ СТРОКОЙ
'STRING REPLACE_0(STRING Value)
'Для работы нужны функции: никаких
func REPLACE_0(result)
&nbsp;&nbsp; if result+0=0
&nbsp;&nbsp;&nbsp;&nbsp;result=""
&nbsp;&nbsp; end if
end func

'ПЕРЕВОДИМ НОРМАЛЬНОЕ ВРЕМЯ HHMMSS В СЕКУНДЫ
'DOUBLE Time2Sec(STRING Value)
'Для работы нужны функции: Time2HHMMSS, FTEXT
func Time2Sec(result)
result=Time2HHMMSS(result)
&nbsp;&nbsp;&nbsp;result=SUBSTR(result,0,2)*3600+SUBSTR(result,2,2)*60+SUBSTR(result,4,2)
end func

'ПАУЗА В СЕКУНДАХ
'DOUBLE Sleep(DOUBLE Value)
'Для работы нужны функции: никаких
func Sleep(result)
&nbsp;&nbsp;&nbsp;time_begin = get_value(GET_DATETIME(), "HOUR")*3600+get_value(GET_DATETIME(), "HOUR")*60+get_value(GET_DATETIME(), "SEC")
&nbsp;&nbsp;&nbsp;for i_ from 0 to 2
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (get_value(GET_DATETIME(), "HOUR")*3600+get_value(GET_DATETIME(), "HOUR")*60+get_value(GET_DATETIME(), "SEC") - time_begin) &#62;= result
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BREAK
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i_=i_-1
&nbsp;&nbsp;&nbsp;end for
end func

'ПЕРЕВОДИМ СЕКУНДЫ В НОРМАЛЬНОЕ ВРЕМЯ HH:MM:SS
'STRING Sec2Time(DOUBLE Value)
'Для работы нужны функции: FTEXT, HHMMSS2Time
func Sec2Time(result)
result=FTEXT(floor(result/3600))&#38; _
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FTEXT(floor((result-(floor(result/3600))*3600)/60))&#38; _
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FTEXT((result-(floor(result/3600))*3600)-(floor((result-(floor(result/3600))*3600)/60)) * 60)
result=HHMMSS2Time(result)
end func 

'ПЕРЕВОДИТ ДАТУ В ФОРМАТЕ YYYYMMDD или DD.MM.YYYY В КОЛИЧЕСТВО ДНЕЙ НАЧИНАЯ С 1970.01.01
'DOUBLE date2day(STRING Value)
'Для работы нужны функции: никаких
func date2day(YYYYMMDD_)
&nbsp;&nbsp;&nbsp;if (SUBSTR (YYYYMMDD_, 2, 1)=",") or (SUBSTR (YYYYMMDD_, 2, 1)=".")
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YYYYMMDD_=SUBSTR(YYYYMMDD_,6,4)&#38;SUBSTR(YYYYMMDD_,3,2)&#38;SUBSTR(YYYYMMDD_,0,2)
&nbsp;&nbsp;&nbsp;end if
&nbsp;&nbsp;&nbsp;result=SUBSTR(YYYYMMDD_,0,4)*365+floor((SUBSTR(YYYYMMDD_,0,4)-1)/4)-719542
&nbsp;&nbsp;&nbsp;result=result+substr("031059090120151181212243273304334365",SUBSTR(YYYYMMDD_,4,2)*3-6,3)
&nbsp;&nbsp;&nbsp;if (SUBSTR(YYYYMMDD_,0,4)-floor(SUBSTR(YYYYMMDD_,0,4)/4)*4=0) AND (SUBSTR(YYYYMMDD_,4,2)+0&#62;2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result=result+1
&nbsp;&nbsp;&nbsp;end if
result=(result+SUBSTR(YYYYMMDD_,6,2)-1)
end func

'ПЕРЕВОДИМ МАССИВ get_datetime() В НОРМАЛЬНОЕ ВРЕМЯ HHMMSS
'STRING Map2HHMMSS(MAP&nbsp;&nbsp;Name)
'Для работы нужны функции: FTEXT 
FUNC Map2HHMMSS(result)
result=FTEXT(get_value(result, "HOUR"))&#38; _
&nbsp;&nbsp;&nbsp;FTEXT(get_value(result, "MIN"))&#38; _
&nbsp;&nbsp;&nbsp;FTEXT(get_value(result, "SEC"))
END FUNC

'ВЫВОДИТ ИЗ МАССИВА get_datetime() ИЛИ get_trade_date() ДАТУ В ФОРМАТЕ YYYYMMDD
'STRING Map2YYYYMMDD(MAP&nbsp;&nbsp;Name)
'Для работы нужны функции: FTEXT 
FUNC Map2YYYYMMDD(result)
result=FTEXT(get_value(result, "YEAR"))&#38; _
&nbsp;&nbsp;&nbsp;FTEXT(get_value(result, "MONTH"))&#38; _
&nbsp;&nbsp;&nbsp;FTEXT(get_value(result, "DAY"))
END FUNC

'ПЕРЕВОДИТ ДАТУ В ФОРМАТЕ YYYYMMDD В ФОРМАТ DD.MM.YYYY
'STRING Map2YYYYMMDD(STRING Value)
'Для работы нужны функции: FTEXT 
FUNC YYYYMMDD2Date(result)
&nbsp;&nbsp;&nbsp;result=SUBSTR(result,6,2)&#38;"."&#38;SUBSTR(result,4,2)&#38;"."&#38;SUBSTR(result,0,4)
END FUNC

'УСТРАНЯЕТ В get_datetime() РАЗНИЦУ ВО ВРЕМЕНИ
'MAP Fix_get_datetime(MAP&nbsp;&nbsp;Name, DOUBLE Value)
'Для работы нужны функции: FTEXT
FUNC Fix_get_datetime(result, time_zone)
if get_value(result, "HOUR")+0&#62;=time_zone+0
&nbsp;&nbsp;&nbsp;result=SET_VALUE(result, "HOUR",(get_value(result, "HOUR")-time_zone))
&nbsp;&nbsp;&nbsp;result=SET_VALUE(result, "DATETIME",SUBSTR(get_value(result, "DATETIME"),0,11)&#38; _
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FTEXT(SUBSTR(get_value(result, "DATETIME"),11,2)-time_zone)&#38; _
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SUBSTR(get_value(result, "DATETIME"),13,10))&nbsp;&nbsp;&nbsp;
end if
END FUNC

'ЗАМЕНА РАЗДЕЛИТЕЛЯ ДРОБНОЙ ЧАСТИ
'STRING replace_decimal_symbol(STRING Value, STRING Value)
'Для работы нужны функции: никаких
func replace_decimal_symbol(string, dchar)
&nbsp;&nbsp;&nbsp;result=""
&nbsp;&nbsp;&nbsp;string=""&#38;string
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for rdc_x from 0 to len(string)-1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (substr(string, rdc_x, 1) = ".") OR (substr(string, rdc_x, 1)=",")
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result=result &#38; dchar
&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;result=result &#38; substr(string, rdc_x, 1)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end for
end func

'ЗАМЕНА В СТРОКЕ string ОДНОГО СИМВОЛА dchar_in ДРУГИМ dchar_out
'STRING replace_symbol(STRING Value, STRING Value, STRING Value)
'Для работы нужны функции: никаких 
func replace_symbol(string, dchar_in, dchar_out)
&nbsp;&nbsp;&nbsp;result=""
&nbsp;&nbsp;&nbsp;string=""&#38;string
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for rdc_x from 0 to len(string)-1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if substr(string, rdc_x, 1) = dchar_in
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;result=result &#38; dchar_out
&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;result=result &#38; substr(string, rdc_x, 1)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end for
end func

'=============================ФУНКЦИИ===============================

NEW_GLOBAL("Counter", 1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' счетчик записей в массив выходных данных (таблицы)
NEW_GLOBAL("Date", "0")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' дата текущей торговой сессии QUIK
NEW_GLOBAL("CommonTime", time2sec(start_time)) &nbsp;&nbsp;&nbsp;
NEW_GLOBAL("OutFile", "")

if Date = "0"
&nbsp;&nbsp;&nbsp;Date = Map2YYYYMMDD(GET_TRADE_DATE())&nbsp;&nbsp;&nbsp;' Преобразовали текущую дату в принятый для вызова GET_CANDLE формат
&nbsp;&nbsp;&nbsp;&nbsp;OutFile = OutPath &#38; YYYYMMDD2Date(Date) &#38; ".txt" ' Сформировали имя файла данных со свечами
&nbsp;&nbsp;&nbsp;&nbsp;CLEAR_FILE(OutFile) 'Очистили файл 
&nbsp;&nbsp;&nbsp;WRITELN(OutFile, "&#60;TICKER&#62;,&#60;PER&#62;,&#60;DATE&#62;,&#60;TIME&#62;,&#60;OPEN&#62;,&#60;HIGH&#62;,&#60;LOW&#62;,&#60;CLOSE&#62;,&#60;VOL&#62;") ' Вывели заголовок
&nbsp;&nbsp;&nbsp;DELETE_ALL_ITEMS()
&nbsp;&nbsp;&nbsp;CurIntervals = CREATE_MAP() ' Создаем массив счетчиков интервалов
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "1", 1)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "2", 0)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "3", 0)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "4", 0)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "5", 0)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "6", 0)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "10", 0)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "15", 0)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "20", 0)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "30", 0)
&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, "60", 0)
end if

CurTime = Fix_get_datetime(GET_DATETIME(),razn)
CurTimeInSec = time2sec(Map2HHMMSS(CurTime)) ' Преобразовали текущее время в количество секунд
'CurTimeInSec = time2sec(GET_INFO_PARAM("SERVERTIME"))

if (CurTimeInSec - CommonTime) &#62;= 60 ' Текущее время более 10.00 (время московское) и с момента последнего опроса данных прошло не менее минуты
&nbsp;&nbsp;&nbsp;for i from 0 to floor((CurTimeInSec - CommonTime)/ 60)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for Interval in Intervals
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CurInterval = GET_VALUE(CurIntervals, Interval)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (0 + CurInterval) = (0 + Interval)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (0 + Interval) &#60;&#62; 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CurTime = sec2time(CommonTime - CurInterval * 60)
&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;CurTime = sec2time(CommonTime)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ClassCode in ClassCodeList
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for SecCode in SecCodeList
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if LEN(Params)=0
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Params=" "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;END IF
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for Param in Params
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Candle = GET_CANDLE(ClassCode, SecCode, Param, Interval, GraphType, Date, Time2HHMMSS(CurTime))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Open = replace_decimal_symbol(GET_VALUE(Candle, "OPEN"),Separator)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if Open+0 &#60;&#62; 0 ' Если цена открытия интервала равна нулю, свечу не выводим
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Close = replace_decimal_symbol(GET_VALUE(Candle, "Close"),Separator)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;High = replace_decimal_symbol(GET_VALUE(Candle, "High"),Separator)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Low = replace_decimal_symbol(GET_VALUE(Candle, "Low"),Separator)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Volume = replace_decimal_symbol(GET_VALUE(Candle, "Volume"),Separator)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Candle = SET_VALUE(Candle, "Security", 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;Candle = SET_VALUE(Candle, "ClassCode", ClassCode)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Candle = SET_VALUE(Candle, "Param", Param)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Candle = SET_VALUE(Candle, "Date", YYYYMMDD2Date(Date))
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Candle = SET_VALUE(Candle, "Time", CurTime)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Candle = SET_VALUE(Candle, "Interval", Interval)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADD_ITEM(Counter, Candle)
&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;WRITELN(OutFile, SecCode&nbsp;&nbsp;&#38; " &#91;" &#38; ClassCode &#38; "&#93;," &#38; Interval &#38; "," &#38; Date&nbsp;&nbsp;&#38; "," &#38; Time2HHMMSS(CurTime) &#38; "," &#38; Open &#38; "," &#38; High &#38; "," &#38; Low &#38; "," &#38; Close &#38; "," &#38; Volume)&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;&nbsp;&nbsp;&nbsp;'Counter = Counter + 1
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end for
&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;&nbsp;&nbsp;&nbsp;end for
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end for
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, Interval, 1) ' скинули интервальный счетчик
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CurIntervals = SET_VALUE(CurIntervals, Interval, (CurInterval + 1)) ' накинули интервальный счетчик
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end for
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CommonTime = CommonTime + 60 ' накинули время
&nbsp;&nbsp;&nbsp;end for
end if

END_PROGRAM

PARAMETER Security;
PARAMETER_TITLE Код инструмента;
PARAMETER_DESCRIPTION Код инструмента;
PARAMETER_TYPE String(12);
END

PARAMETER ClassCode;
PARAMETER_TITLE Код класса;
PARAMETER_DESCRIPTION Код класса;
PARAMETER_TYPE String(12);
END

PARAMETER Param;
PARAMETER_TITLE Параметр;
PARAMETER_DESCRIPTION Параметр;
PARAMETER_TYPE String(12);
END

PARAMETER Date;
PARAMETER_TITLE Дата;
PARAMETER_DESCRIPTION Дата интервала;
PARAMETER_TYPE String(10);
END

PARAMETER Time;
PARAMETER_TITLE Время;
PARAMETER_DESCRIPTION Время интервала;
PARAMETER_TYPE String(10);
END

PARAMETER Interval;
PARAMETER_TITLE Интервал;
PARAMETER_DESCRIPTION Интервал;
PARAMETER_TYPE String(2);
END

PARAMETER Open;
PARAMETER_TITLE Открытие;
PARAMETER_DESCRIPTION Цена открытия интервала;
PARAMETER_TYPE Numeric(20,4);
END

PARAMETER Close;
PARAMETER_TITLE Закрытие;
PARAMETER_DESCRIPTION Цена закрытия интервала;
PARAMETER_TYPE Numeric(20,4);
END

PARAMETER High;
PARAMETER_TITLE Максимум;
PARAMETER_DESCRIPTION Максимальная цена интервала;
PARAMETER_TYPE Numeric(20,4);
END

PARAMETER Low;
PARAMETER_TITLE Минимум;
PARAMETER_DESCRIPTION Минимальная цена интервала;
PARAMETER_TYPE Numeric(20,4);
END

PARAMETER Volume;
PARAMETER_TITLE Объем;
PARAMETER_DESCRIPTION Суммарный объем сделок в интервале;
PARAMETER_TYPE Numeric(20,4);
END

END_PORTFOLIO_EX
</pre>
=============
</td></tr></tbody></table> <br />
			<i>04.10.2018 05:47:54, Sergey Gorokhov.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum9/message34196/topic3989/</link>
			<guid>http://forum.quik.ru/messages/forum9/message34196/topic3989/</guid>
			<pubDate>Thu, 04 Oct 2018 05:47:54 +0300</pubDate>
			<category>Программирование на языке QPILE</category>
		</item>
		<item>
			<title>Есть функция OHLC для прошлых свечей - помогите разобраться</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum9/message34178/topic3989/">Есть функция OHLC для прошлых свечей - помогите разобраться</a></b> <i>как вытащить из нее OHLC дневных свечей по номеру свечи</i> в форуме <a href="http://forum.quik.ru/forum9/">Программирование на языке QPILE</a>. <br />
			Все остальное &nbsp;- все таймфреймы работают, значения свечей вытаскиваются так:<br /> close1=get_collection_item(close_col,1)+0<br /> high1=get_collection_item(high_col,1)+0<br /> low1=get_collection_item(low_col,1)+0<br /> open1=get_collection_item(open_col,1)+0<br /><br />1 - предыдущая от текущей, 2 - пред-предыдущая и т.д.<br /><br />А ДНЕВНЫЕ НЕ ТАЩИТ - как вытащить их? HELP!!!!!<br /><br /><br />Вот сама функция:<br /><br /><br />FUNC get_prices(id,market)<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 /> time=get_datetime()<br /> servertime=GET_INFO_PARAM(&quot;SERVERTIME&quot;)<br /> 'hour=get_value(time,&quot;HOUR&quot;)<br /> 'min=get_value(time,&quot;MIN&quot;)<br /> hour=SUBSTR(servertime,0,2)<br /> min=SUBSTR(servertime,3,2)<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 /> sdelka=get_info_param(&quot;USERID&quot;)-48<br /> for i from 0 to 100000<br /> &nbsp;candle=get_candle(id,cur_date,183000,0)<br /> &nbsp;if (get_value(candle,&quot;open&quot;)+0)=0 &nbsp; <br /> &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; end if<br /> &nbsp; day=day-1<br /> &nbsp; cur_date=year*10000+month*100+day<br /> &nbsp;else <br /> &nbsp; true_date=cur_date<br /> &nbsp; break<br /> &nbsp;end if &nbsp; <br /> end for<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 /> for i from 0 to 1000<br /> &nbsp;candle=get_candle(id,true_date,time,0)<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;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;if min=0<br /> &nbsp; hour=hour-1<br /> &nbsp; min=59<br /> &nbsp;else<br /> &nbsp; min=min-1<br /> &nbsp;end if<br /> &nbsp;time=hour*10000+min*100<br /> &nbsp;if (get_collection_count(timeframe_collection)+0)&gt;1<br /> &nbsp; break<br /> &nbsp;end if<br /> end for<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; candle=get_candle(id,cur_date,150000,0) <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;if (get_value(candle,&quot;close&quot;)+0)!=0<br /> &nbsp; &nbsp; dateframe_collection=INSERT_COLLECTION_ITEM(dateframe_collection,counter,cur_date) &nbsp; &nbsp; <br /> &nbsp; &nbsp; pred_open=get_value(candle,&quot;open&quot;)<br /> &nbsp; &nbsp; pred_high=get_value(candle,&quot;high&quot;)<br /> &nbsp; &nbsp; pred_close=get_value(candle,&quot;close&quot;)<br /> &nbsp; &nbsp; pred_low=get_value(candle,&quot;low&quot;)<br /> &nbsp; &nbsp; counter=counter+1<br /> &nbsp; &nbsp;end if<br /> &nbsp; end if<br /> &nbsp; if (day+0)=1<br /> &nbsp; &nbsp;month=month-1<br /> &nbsp; &nbsp;day=32<br /> &nbsp; &nbsp;if (month+0)=0<br /> &nbsp; &nbsp; month=12<br /> &nbsp; &nbsp; year=year-1<br /> &nbsp; &nbsp;end if<br /> &nbsp; end if<br /> &nbsp; day=day-1 &nbsp;<br /> &nbsp; if get_collection_count(dateframe_collection)&gt;20<br /> &nbsp; &nbsp;break &nbsp; &nbsp; <br /> &nbsp; end if<br /> &nbsp; cur_date=year*10000+month*100+day<br /> &nbsp;end for<br /> end if<br /> hour1=SUBSTR (get_collection_item(timeframe_collection,0), 0, 2) +0<br /> min1=SUBSTR (get_collection_item(timeframe_collection,0), 2, 2) +0<br /> hour2=SUBSTR (get_collection_item(timeframe_collection,1), 0, 2)+0<br /> min2=SUBSTR (get_collection_item(timeframe_collection,1), 2, 2) +0<br /> chislo=0<br /> tt53 = timeframe&amp;&quot;&quot;<br /> if tt53&lt;&gt;&quot;&quot; or tt53&lt;&gt;&quot;day&quot;<br /> &nbsp;if hour1==hour2<br /> &nbsp; if (min1-min2)=1<br /> &nbsp; &nbsp;timeframe=1<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (min1-min2)=2<br /> &nbsp; &nbsp;timeframe=2<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (min1-min2)=3<br /> &nbsp; &nbsp;timeframe=3<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (min1-min2)=4<br /> &nbsp; &nbsp;timeframe=4<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (min1-min2)=5<br /> &nbsp; &nbsp;timeframe=5<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (min1-min2)=6<br /> &nbsp; &nbsp;timeframe=6<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (min1-min2)=10<br /> &nbsp; &nbsp;timeframe=10<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (min1-min2)=15<br /> &nbsp; &nbsp;timeframe=15<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (min1-min2)=20<br /> &nbsp; &nbsp;timeframe=20<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (min1-min2)=30<br /> &nbsp; &nbsp;timeframe=30<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp;end if<br /> &nbsp;if hour1&lt;&gt;hour2<br /> &nbsp; if (hour1-hour2)=1<br /> &nbsp; &nbsp;timeframe=60<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (hour1-hour2)=2<br /> &nbsp; &nbsp;timeframe=120<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp; if (hour1-hour2)=4<br /> &nbsp; &nbsp;timeframe=240<br /> &nbsp; &nbsp;chislo=1<br /> &nbsp; end if<br /> &nbsp;end if<br /> end if<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 /> time=get_datetime()<br /> servertime=GET_INFO_PARAM(&quot;SERVERTIME&quot;)<br /> hour=SUBSTR(servertime,0,2)<br /> min=SUBSTR(servertime,3,2)<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 /> 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 /> if (cur_time_bar&amp;&quot;&quot;)!=&quot;&quot;<br /> &nbsp;cur_time_bar_pred=cur_time_bar<br /> else<br /> &nbsp;cur_time_bar=cur_time_bar_pred<br /> end if<br /> low_col=INSERT_COLLECTION_ITEM(low_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),&quot;low&quot;))<br /> high_col=INSERT_COLLECTION_ITEM(high_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),&quot;high&quot;))<br /> open_col=INSERT_COLLECTION_ITEM(open_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),&quot;open&quot;))<br /> close_col=INSERT_COLLECTION_ITEM(close_col,0,get_value(get_candle(id,cur_date,cur_time_bar,0),&quot;close&quot;))<br /> time_col=INSERT_COLLECTION_ITEM(time_col,0,cur_time_bar)<br /> date_col=INSERT_COLLECTION_ITEM(date_col,0,cur_date)<br /> f=1<br /> find_date=cur_date<br /> point=0<br /> if (chislo+0)==1<br /> &nbsp;for i from 1 to 2000<br /> &nbsp; temp3=ceil(cur_time_bar/10000)<br /> &nbsp; temp4=cur_time_bar/10000<br /> &nbsp; if temp3=temp4<br /> &nbsp; &nbsp;if floor(cur_time_bar/10000)=cur_time_bar/10000<br /> &nbsp; &nbsp; if timeframe=1<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5900<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=2<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5800<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=3<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5700<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=4<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5600<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=5<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5500<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=6<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+4800<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=10<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+5000<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=15<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+4500<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=20<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+4000<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=30<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000+3000<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=60<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-1)*10000<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=120<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-2)*10000<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=240<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=ceil(cur_time_bar/10000-4)*10000<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp;end if<br /> &nbsp; else<br /> &nbsp; &nbsp;cur_time_bar=cur_time_bar-timeframe*100<br /> &nbsp; end if<br /> &nbsp; if timeframe&lt;60<br /> &nbsp; &nbsp;if cur_time_bar&lt;100000<br /> &nbsp; &nbsp; if (market&amp;&quot;&quot;)=&quot;micex&quot;<br /> &nbsp; &nbsp; &nbsp;if timeframe=1<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=184400<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=2<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=184400<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=3<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=184200<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=4<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=184400<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=5<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=184000<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=6<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=184200<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=10<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=184000<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=15<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=183000<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=20<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=184000<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=30<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=183000<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if (market&amp;&quot;&quot;)=&quot;forts&quot;<br /> &nbsp; &nbsp; &nbsp;if timeframe=1<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=234900<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=2<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=234800<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=3<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=234800<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=4<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=234800<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=5<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=234500<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=6<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=234800<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=10<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=234000<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=15<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=234500<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=20<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=234000<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if timeframe=30<br /> &nbsp; &nbsp; &nbsp; cur_time_bar=233000<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe&gt;50<br /> &nbsp; &nbsp; &nbsp;if cur_time_bar=100000<br /> &nbsp; &nbsp; &nbsp; break<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;if cur_time_bar&lt;100000<br /> &nbsp; &nbsp; &nbsp; if timeframe=60<br /> &nbsp; &nbsp; &nbsp; &nbsp;cur_time_bar=230000<br /> &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; if timeframe=120<br /> &nbsp; &nbsp; &nbsp; &nbsp;cur_time_bar=220000<br /> &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp; if timeframe=240<br /> &nbsp; &nbsp; &nbsp; &nbsp;cur_time_bar=200000<br /> &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; usl=0<br /> &nbsp; &nbsp; for j from 1 to 15<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; &nbsp;month=12<br /> &nbsp; &nbsp; &nbsp; &nbsp;year=year-1<br /> &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;day=day-1<br /> &nbsp; &nbsp; &nbsp;cur_date=year*10000+month*100+day<br /> &nbsp; &nbsp; &nbsp;slice_day = Get_Candle_Ex(id, cur_date, 103000) <br /> &nbsp; &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; &nbsp;find_date=cur_date<br /> &nbsp; &nbsp; &nbsp; &nbsp;usl=1<br /> &nbsp; &nbsp; &nbsp; &nbsp;break<br /> &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; end for<br /> &nbsp; &nbsp;end if<br /> &nbsp; end if<br /> &nbsp; if timeframe&gt;59<br /> &nbsp; &nbsp;if cur_time_bar&lt;80000<br /> &nbsp; &nbsp; if timeframe=60<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=230000<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=120<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=220000<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; if timeframe=240<br /> &nbsp; &nbsp; &nbsp;cur_time_bar=200000<br /> &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; usl=0<br /> &nbsp; &nbsp; for j from 1 to 15<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; &nbsp;month=12<br /> &nbsp; &nbsp; &nbsp; &nbsp;year=year-1<br /> &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; &nbsp;day=day-1<br /> &nbsp; &nbsp; &nbsp;curdate=year*10000+month*100+day<br /> &nbsp; &nbsp; &nbsp;slice_day = Get_Candle_Ex(id, cur_date, 103000) <br /> &nbsp; &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; &nbsp;find_date=curdate<br /> &nbsp; &nbsp; &nbsp; &nbsp;usl=1<br /> &nbsp; &nbsp; &nbsp; &nbsp;break<br /> &nbsp; &nbsp; &nbsp; end if<br /> &nbsp; &nbsp; &nbsp;end if<br /> &nbsp; &nbsp; end for<br /> &nbsp; &nbsp;end if<br /> &nbsp; end if<br /> &nbsp; slice = Get_Candle_Ex(id, find_date,cur_time_bar) <br /> &nbsp; LineCount=Get_Value(slice,&quot;COUNT&quot;) +0<br /> &nbsp; time=Get_Value(slice,&quot;TIME&quot;) <br /> &nbsp; lines=Get_Value(slice,&quot;LINES&quot;)<br /> &nbsp; if f&lt;=20<br /> &nbsp; &nbsp;if LineCount&gt;0<br /> &nbsp; &nbsp; LineCount=Get_Value(slice,&quot;COUNT&quot;) <br /> &nbsp; &nbsp; time=Get_Value(slice,&quot;TIME&quot;) <br /> &nbsp; &nbsp; lines=Get_Value(slice,&quot;LINES&quot;)<br /> &nbsp; &nbsp; line=Get_Collection_Item(lines, 0)<br /> &nbsp; &nbsp; low=Get_Value(line,&quot;LOW&quot;)<br /> &nbsp; &nbsp; high=Get_Value(line,&quot;HIGH&quot;)<br /> &nbsp; &nbsp; open=Get_Value(line,&quot;OPEN&quot;)<br /> &nbsp; &nbsp; close=Get_Value(line,&quot;CLOSE&quot;)<br /> &nbsp; &nbsp; line_name =Get_Value(line,&quot;NAME&quot;) <br /> &nbsp; &nbsp; volume=Get_Value(line,&quot;VOLUME&quot;)<br /> &nbsp; &nbsp; low_col=INSERT_COLLECTION_ITEM(low_col,f,low)<br /> &nbsp; &nbsp; high_col=INSERT_COLLECTION_ITEM(high_col,f,high)<br /> &nbsp; &nbsp; open_col=INSERT_COLLECTION_ITEM(open_col,f,open)<br /> &nbsp; &nbsp; close_col=INSERT_COLLECTION_ITEM(close_col,f,close)<br /> &nbsp; &nbsp; time_col=INSERT_COLLECTION_ITEM(time_col,f,cur_time_bar)<br /> &nbsp; &nbsp; date_col=INSERT_COLLECTION_ITEM(date_col,f,find_date)<br /> &nbsp; &nbsp; f=f+1<br /> &nbsp; &nbsp;end if<br /> &nbsp; else<br /> &nbsp; &nbsp;break<br /> &nbsp; end if<br /> &nbsp;end for<br /> end if<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 />end func <br />
			<i>03.10.2018 15:34:52, Евгений.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum9/message34178/topic3989/</link>
			<guid>http://forum.quik.ru/messages/forum9/message34178/topic3989/</guid>
			<pubDate>Wed, 03 Oct 2018 15:34:52 +0300</pubDate>
			<category>Программирование на языке QPILE</category>
		</item>
	</channel>
</rss>
