<?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>Sat, 02 May 2026 14:29:05 +0300</pubDate>
		<item>
			<title>Как получить значение индикатора на предыдущей свече</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message63084/topic7281/">Как получить значение индикатора на предыдущей свече</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			<br />====quote====<br /><a class="blog-p-user-name" id="bp_KJkH4DfD" href="/user/62/" bx-tooltip-user-id="62">nikolz</a> написал:<br />пишите значения индикатора в массив и читайте со смещением<br />------------------<br />Пример:<br />local t={ }<br />-----<br />local x=indicator(i)<br />----------------------<br />if x then t<I>=x else if #t&gt;0 then t<I>=t&#91;i-1&#93; end end &nbsp; -- если значения нет, то пишем предыдущее значение<br />-------------------<br />local M=#t;<br />local x1; &nbsp;if M&gt;0 then x1=t&#91;M-1&#93; end &nbsp;--читаем &nbsp;предыдущее значение<br />-------------------<br />local x2; &nbsp;if M&gt;01 then x1=tM-2&#93; end &nbsp;--читаем &nbsp;предпредыдущее значение</I></I><br />=============<br />Спасибо за пример! <br />
			<i>28.04.2022 15:44:48, Евгений.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message63084/topic7281/</link>
			<guid>http://forum.quik.ru/messages/forum10/message63084/topic7281/</guid>
			<pubDate>Thu, 28 Apr 2022 15:44:48 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как получить значение индикатора на предыдущей свече</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message63024/topic7281/">Как получить значение индикатора на предыдущей свече</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			пишите значения индикатора в массив и читайте со смещением<br />------------------<br />Пример:<br />local t={ }<br />-----<br />local x=indicator(i)<br />----------------------<br />if x then t&#91;i&#93;=x else if #t&gt;0 then t&#91;i&#93;=t&#91;i-1&#93; end end &nbsp; -- если значения нет, то пишем предыдущее значение<br />-------------------<br />local M=#t;<br />local x1; &nbsp;if M&gt;0 then x1=t&#91;M-1&#93; end &nbsp;--читаем &nbsp;предыдущее значение<br />-------------------<br />local x2; &nbsp;if M&gt;01 then x1=tM-2&#93; end &nbsp;--читаем &nbsp;предпредыдущее значение <br />
			<i>25.04.2022 12:46:40, nikolz.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message63024/topic7281/</link>
			<guid>http://forum.quik.ru/messages/forum10/message63024/topic7281/</guid>
			<pubDate>Mon, 25 Apr 2022 12:46:40 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как получить значение индикатора на предыдущей свече</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message63022/topic7281/">Как получить значение индикатора на предыдущей свече</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Добрый день.<br /><br />&quot;Index-1&quot; будет работать, однако в случае появления дыр на графике, решение перестанет работать. <br />
			<i>25.04.2022 12:32:20, Alexey Danin.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message63022/topic7281/</link>
			<guid>http://forum.quik.ru/messages/forum10/message63022/topic7281/</guid>
			<pubDate>Mon, 25 Apr 2022 12:32:20 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как получить значение индикатора на предыдущей свече</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message62906/topic7281/">Как получить значение индикатора на предыдущей свече</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			сделать копию функции для Index-1 ? <br />
			<i>15.04.2022 10:51:39, Евгений.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message62906/topic7281/</link>
			<guid>http://forum.quik.ru/messages/forum10/message62906/topic7281/</guid>
			<pubDate>Fri, 15 Apr 2022 10:51:39 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
		<item>
			<title>Как получить значение индикатора на предыдущей свече</title>
			<description><![CDATA[<b><a href="http://forum.quik.ru/messages/forum10/message62905/topic7281/">Как получить значение индикатора на предыдущей свече</a></b> в форуме <a href="http://forum.quik.ru/forum10/">Программирование на языке Lua</a>. <br />
			Вот стандартный индикатор из квика, он выдает значение индикатора на текущей свече, а как получить значение на предыдущей свече?<br /><br /><br /><br /><br />function OnCalculate(Index) &nbsp; &nbsp;return tonumber(Settings.Horizontal_line),ConvertValue(Settings,func(Index, Settings))<br />end<br /><br />function MACD() --Moving Average Convergence/Divergence (&quot;MACD&quot;)<br /> &nbsp; &nbsp;local MACD_MA = MA()<br /> &nbsp; &nbsp;local Short_MA = MA()<br /> &nbsp; &nbsp;local Long_MA = MA()<br /> &nbsp; &nbsp;local it = {p=0, l=0}<br />return function (I, Fsettings, ds)<br />local Fsettings=(Fsettings or {})<br />local ShortP = (Fsettings.SHORT_Period or 12)<br />local LongP = (Fsettings.LONG_Period or 26)<br />local M = (Fsettings.Metod or EMA)<br />local VT = (Fsettings.VType or CLOSE)<br />local SM = (Fsettings.Signal_Metod or SMA)<br />local SP = (Fsettings.Signal_Period or 9)<br />local Percent = (Fsettings.Percent or 1)<br />if (ShortP&gt;0) and (LongP&gt;0) and (SP&gt;0) then <br /> &nbsp; &nbsp;if I == 1 then<br /> &nbsp; &nbsp; &nbsp; &nbsp;it = {p=0, l=0}<br /> &nbsp; &nbsp;end<br /> &nbsp; &nbsp;local So = Short_MA(I, {Period=ShortP, Metod = M, VType=VT}, ds)<br /> &nbsp; &nbsp;local Lo = Long_MA(I, {Period=LongP, Metod = M, VType=VT}, ds)<br /> &nbsp; &nbsp;if CandleExist(I,ds) then<br /> &nbsp; &nbsp; &nbsp; &nbsp;if I~=it.p then it={p=I, l=it.l+1} end<br /> &nbsp; &nbsp; &nbsp; &nbsp;local i = it.l - math.max(ShortP, LongP) + 1<br /> &nbsp; &nbsp; &nbsp; &nbsp;if (i&gt;0) then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if Percent==0 then<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;t_MACD=So - Lo<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;t_MACD=100*(So - Lo) / Lo<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (SM~=SMA) and (SM~=EMA) then SM=SMA end<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return t_MACD, MACD_MA(i, {Period=SP, Metod = SM, VType=ANY}, {&#91;i&#93; = t_MACD})<br /> &nbsp; &nbsp; &nbsp; &nbsp;end<br /> &nbsp; &nbsp;end<br />end<br />return nil, nil<br />end<br />end <br />
			<i>15.04.2022 10:42:35, Евгений.</i>]]></description>
			<link>http://forum.quik.ru/messages/forum10/message62905/topic7281/</link>
			<guid>http://forum.quik.ru/messages/forum10/message62905/topic7281/</guid>
			<pubDate>Fri, 15 Apr 2022 10:42:35 +0300</pubDate>
			<category>Программирование на языке Lua</category>
		</item>
	</channel>
</rss>
