<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[QUIK -> DDE &mdash; Индикатор экстремум]]></title>
	<link rel="self" href="https://quik2dde.ru/extern.php?action=feed&amp;tid=353&amp;type=atom" />
	<updated>2021-12-10T10:40:16Z</updated>
	<generator>PunBB</generator>
	<id>https://quik2dde.ru/viewtopic.php?id=353</id>
		<entry>
			<title type="html"><![CDATA[Re: Индикатор экстремум]]></title>
			<link rel="alternate" href="https://quik2dde.ru/viewtopic.php?pid=3387#p3387" />
			<content type="html"><![CDATA[<p><strong>kalikazandr</strong>, <span style="color: #ee5566">просьба:<br />Сделайте снова картинку и выложите где-то. А то текущая, увы, уже не отображается.</span></p>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>https://quik2dde.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-12-10T10:40:16Z</updated>
			<id>https://quik2dde.ru/viewtopic.php?pid=3387#p3387</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Индикатор экстремум]]></title>
			<link rel="alternate" href="https://quik2dde.ru/viewtopic.php?pid=3385#p3385" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>RRR пишет:</cite><blockquote><p>Два вопроса:<br />- Почему бы не запихнуть модуль в сам индикатор, будет одним файлом, это удобнее.<br />- Какие преимущества даёт индикатор, если экстремумы и так видны, если немного сжать график?</p></blockquote></div><p>-модуль практичнее и не виден загрузчику индикаторов, можно сделать несколько версий модулей, а несколько версий индикатора будут в списке доступных индикаторов;<br />-глазу видны все экстремумы, в т.ч. &quot;шум&quot;, который фильтруется минимальным движением цены nMinHL. Индикатор можно использовать в качестве советника или самостоятельного торгового алгоритма, а &quot;глаз&quot; - максимум полуавтомат.</p>]]></content>
			<author>
				<name><![CDATA[kalikazandr]]></name>
				<uri>https://quik2dde.ru/profile.php?id=208</uri>
			</author>
			<updated>2021-12-09T16:49:49Z</updated>
			<id>https://quik2dde.ru/viewtopic.php?pid=3385#p3385</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Индикатор экстремум]]></title>
			<link rel="alternate" href="https://quik2dde.ru/viewtopic.php?pid=3384#p3384" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>kalikazandr пишет:</cite><blockquote><p>Индикатор определяет локальные макс/мин цены на графике.</p></blockquote></div><p>Интересная штука.<br />Два вопроса:<br />- Почему бы не запихнуть модуль в сам индикатор, будет одним файлом, это удобнее.<br />- Какие преимущества даёт индикатор, если экстремумы и так видны, если немного сжать график?</p>]]></content>
			<author>
				<name><![CDATA[RRR]]></name>
				<uri>https://quik2dde.ru/profile.php?id=3102</uri>
			</author>
			<updated>2021-12-09T13:13:19Z</updated>
			<id>https://quik2dde.ru/viewtopic.php?pid=3384#p3384</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Индикатор экстремум]]></title>
			<link rel="alternate" href="https://quik2dde.ru/viewtopic.php?pid=3357#p3357" />
			<content type="html"><![CDATA[<p>Индикатор определяет локальные макс/мин цены на графике.<br /><span class="postimg"><img src="https://i.ibb.co/HKHjQPH/extr.png" alt="https://i.ibb.co/HKHjQPH/extr.png" /></span></p><br /><p>При добавлении индикатора снимаем галку<br /><span class="postimg"><img src="https://i.ibb.co/vjCK6LP/1.png" alt="https://i.ibb.co/vjCK6LP/1.png" /></span></p><div class="spoilerbox" style="padding: 0px;"><div onclick="var e,d,c=this.parentNode,a=c.getElementsByTagName('div')[1],b=this.getElementsByTagName('span')[0];if(a.style.display!=''){while(c.parentNode&&(!d||!e||d==e)){e=d;d=(window.getComputedStyle?getComputedStyle(c, null):c.currentStyle)['backgroundColor'];if(d=='transparent'||d=='rgba(0, 0, 0, 0)')d=e;c=c.parentNode;}a.style.display='';a.style.backgroundColor=d;b.innerHTML='[-]';}else{a.style.display='none';b.innerHTML='[+]';}" style="cursor: pointer;"><span style="padding: 0 5px;">[+]</span>Код индикатора extr.lua</div><div style="padding: 6px; margin: 0; display: none;"><div class="codebox"><pre><code>--C:/QUIK/LuaIndicators/extr.lua
dofile(getWorkingFolder() .. &quot;\\LuaIndicators\\Include\\myExtr.lua&quot;)
Settings = {}
Settings.Name = &quot;*extr&quot;
Settings.nDepth = 3000 --[[для определения стартового бара, если 0, то все]]
Settings.nMinHL = 0.0 --[[расстояние, кот. должна пройти цена, для определения H/L]]
Settings.line =
{
    {
        Name = &quot;TRIANGLE_UP&quot;,
        Type = TYPE_TRIANGLE_UP,
        Color = RGB(255, 0, 0),
        Width = 4
    },
    {
        Name = &quot;TRIANGLE_DOWN&quot;,
        Type = TYPE_TRIANGLE_DOWN,
        Color = RGB(0, 255, 0),
        Width = 4
    }
}

function Init()
    extr = myExtr()
    return 2
end

local oi, min_hl
function OnCalculate(index)
    
    if index == 1 then
        min_hl = tonumber(Settings.nMinHL)
        
        if min_hl and min_hl &lt;= 0 then min_hl = nil end
        if not min_hl then return message(&quot;Индикатору extr\nнужен параметр nMinHL &gt; 0&quot;,3) end
        
        local s = Size() - Settings.nDepth
        oi = (s &lt; 1 or Settings.nDepth == 0) and 1 or s
        extr(oi, min_hl, index)
    end
    --[[считает только что закрывшийся бар, в текущем активном не считает]]
    if not min_hl or index &lt;= oi then return end
    
    extr(oi, min_hl, index)
    oi = index
end</code></pre></div></div></div><div class="spoilerbox" style="padding: 0px;"><div onclick="var e,d,c=this.parentNode,a=c.getElementsByTagName('div')[1],b=this.getElementsByTagName('span')[0];if(a.style.display!=''){while(c.parentNode&&(!d||!e||d==e)){e=d;d=(window.getComputedStyle?getComputedStyle(c, null):c.currentStyle)['backgroundColor'];if(d=='transparent'||d=='rgba(0, 0, 0, 0)')d=e;c=c.parentNode;}a.style.display='';a.style.backgroundColor=d;b.innerHTML='[-]';}else{a.style.display='none';b.innerHTML='[+]';}" style="cursor: pointer;"><span style="padding: 0 5px;">[+]</span>Код модуля myExtr.lua</div><div style="padding: 6px; margin: 0; display: none;"><div class="codebox"><pre><code>--C:/QUIK/LuaIndicators/Include/myExtr.lua
function myExtr()
    local HH, LL, mH, mL, imH, imL 
    local function SetL(oH, oL, oi, min_hl)
        if oH &gt; mH then
            mH, imH = oH, oi
            if not LL then
                if oH - mL &gt;= min_hl then
                    LL = mL
                    SetValue(imL, 1, LL)
                    mL, imL = oL, oi
                    HH = nil
                end
            else
                mL, imL = oL, oi
            end
            if HH and oH &gt;= HH then HH = nil end
        end
    end
    local function SetH(oH, oL, oi, min_hl)
        if oL &lt; mL then
            mL, imL = oL, oi
            if not HH then
                if mH - oL &gt;= min_hl then
                    HH = mH
                    SetValue(imH, 2, HH)
                    mH, imH = oH, oi
                    LL = nil
                end
            else
                mH, imH = oH, oi
            end
            if LL and oL &lt;= LL then LL = nil end
        end
    end
    return function (oi, min_hl, i)
        if i &lt;= oi then
            mH, mL = H(oi), L(oi)
            imH, imL = oi, oi
            HH, LL = nil, nil
            return
        end
        
        local oH, oL = H(oi), L(oi)
        if imL &lt; imH then
            SetL(oH, oL, oi, min_hl)
            SetH(oH, oL, oi, min_hl)
        else
            SetH(oH, oL, oi, min_hl)
            SetL(oH, oL, oi, min_hl)
        end
    end
end</code></pre></div></div></div>]]></content>
			<author>
				<name><![CDATA[kalikazandr]]></name>
				<uri>https://quik2dde.ru/profile.php?id=208</uri>
			</author>
			<updated>2021-10-13T17:07:47Z</updated>
			<id>https://quik2dde.ru/viewtopic.php?pid=3357#p3357</id>
		</entry>
</feed>
