Поведение крипторынка очень эмоциональное. Люди склонны становиться жадными, когда рынок растет, что приводит к FOMO (страх упустить). Кроме того, люди часто продают свои монеты из-за иррациональной реакции на красные числа. С помощью нашего Индекса страха и жадности мы пытаемся уберечь вас от вашей собственной эмоциональной реакции. Есть два простых предположения:
--[[ индикатор отрисовки наклонных уровней Параметры: delta - чувствиельность индикатора на волатильность в % rep - количество повторений поиска конечного уровня shif - сдвиг влево конечного бара wt - признак наличия весового коэффициента =0 - без весового =1,2.. - свосовыми коф. чем ближе к концу тем больше show=1, --]] Settings= { Name = "AT-obl_can", -- название индикатора delta=2.0, -- параметр индикатора rep=10, shif=0, wt=1, --hl=1, show=1, line= { { Name = "ln1", Type =TYPE_LINE, Width = 2, Color = RGB(255, 0, 0) }, { Name = "ln2", Type =TYPE_LINE, Width = 2, Color = RGB(255, 0, 0) } } } function Init() vMin = 0 vMax = 0 vMinindex = 0 vMaxindex = 0 voldMinindex = 0 voldMaxindex = 0 return 2 end function OnCalculate(index) rep = Settings.rep shif = Settings.shif wt = Settings.wt --hl = Settings.hl sz = Size()-shif if Settings.show == 1 then if index <= sz then if index <= 1 then vMin = C(index) vMax = C(index) vMinindex = index vMaxindex = index voldMinindex = index voldMaxindex = index v = C(index) else if voldMaxindex >= voldMinindex then if vMin~=nil and C(index)~=nil then if C(index) > (1 + Settings.delta/100)*vMin then vMin = C(index) vMax = C(index) vMaxindex = index voldMinindex = vMinindex vFrom = vMinindex else if vMin > C(index) then vMin = C(index) vMinindex = index vFrom = voldMaxindex else vFrom = vMinindex end end end else if voldMaxindex <= voldMinindex then if vMax~=nil and C(index)~=nil then if C(index) < (1 - Settings.delta/100)*vMax then vMax = C(index) vMin = C(index) vMinindex = index voldMaxindex = vMaxindex vFrom = vMaxindex else if vMax < C(index) then vMax = C(index) vMaxindex = index vFrom = voldMinindex else vFrom = vMaxindex end end end end end --if vFrom~=nil then --[[ for i = vFrom, index do k = (C(index)- C(vFrom))/(index- vFrom); v = i*k + C(index) - index*k SetValue(i, 1, v) end --]] --end if index == sz then for k = 1, 2 do vf = 1 vs = 0 if k == 1 then if vMinindex < vMaxindex then vf = vMinindex vs = vMaxindex up = 0 elseif vMinindex > vMaxindex then vs = vMinindex vf = vMaxindex up = 1 end elseif k == 2 then if voldMinindex < voldMaxindex then vf = voldMinindex vs = voldMaxindex up = 0 elseif voldMinindex > voldMaxindex then vs = voldMinindex vf = voldMaxindex up = 1 end end n = 0 xy = 0 x = 0 y = 0 xx = 0 m = 0 for i = vf, vs do if C(i) ~= nil then m = m +1 n = n + 1*(1+wt*m) xy = xy + i*C(i)*(1+wt*m) x = x + i*(1+wt*m) y = y + C(i)*(1+wt*m) xx = xx + i*i*(1+wt*m) end end if (n*xx - x*x) ~= 0 and n ~= 0 then a = (n*xy - x*y)/(n*xx - x*x) b = (y - a*x)/n for j = 1, rep do n = 0 xy = 0 x = 0 y = 0 xx = 0 m = 0 for i = vf, vs do if C(i) ~= nil then v = a*i + b clc = 0 if up == 1 and C(i) >= v then clc = 1 end if up == 0 and C(i) <= v then clc = 1 end if clc == 1 then m = m + 1 n = n + 1*(1+wt*m) --[[ if up == 1 and hl == 1 then xy = xy + i*H(i)*(1+wt*m) elseif up == 0 and hl == 1 then xy = xy + i*L(i)*(1+wt*m) else --]] xy = xy + i*C(i)*(1+wt*m) -- end x = x + i*(1+wt*m) --[[ if up == 1 and hl == 1 then y = y + H(i)*(1+wt*m) elseif up == 0 and hl == 1 then y = y + L(i)*(1+wt*m) else --]] y = y + C(i)*(1+wt*m) -- end xx = xx + i*i*(1+wt*m) end end end --[[--]] if (n*xx - x*x) ~= 0 and n ~= 0 and n >= 2 then a = (n*xy - x*y)/(n*xx - x*x) b = (y - a*x)/n --[[ --]] end end for i = vf, sz do v = a*i + b if up == 1 and v >= C(vs) or up == 0 and v <= C(vs) then SetValue(i, k, v) end end end end end end end end end
--[[ параметры: Procent - процент зигзага --]] Settings={ Name="ZIGZAGLEVELS", Procent=5.0, levels=6, delta=0.2, line= { { Name = "cur1", Type =TYPE_LINE, Width = 2, Color = RGB(0,0, 255) }, { Name = "cur2", Type =TYPE_LINE, Width = 2, Color = RGB(0,0, 255) }, { Name = "cur3", Type =TYPE_LINE, Width = 2, Color = RGB(0,0, 255) }, { Name = "cur4", Type =TYPE_LINE, Width = 2, Color = RGB(0,0, 255) }, { Name = "cur5", Type =TYPE_LINE, Width = 2, Color = RGB(0,0, 255) }, { Name = "cur6", Type =TYPE_LINE, Width = 2, Color = RGB(0,0, 255) } } } function Init() y1 = nil y2 = nil x1 = 1 x2 = 1 levelsy={} levelsx={} cntlevels=0 return 6 end function OnCalculate(index) de = Settings.Procent levels = Settings.levels delta = Settings.delta sz = Size() vl = C(index) if index <= 1 then y1 = vl y2 = vl cntlevels=0 else if C(index) > y1*(1+de/100) and y1 < y2 then x2 = x1 y2 = y1 x1 = index y1 = C(index) cntlevels = cntlevels + 1 levelsx[cntlevels]=x2 levelsy[cntlevels]=y2 end if C(index) > y1 and C(index) > y2 then x1 = index y1 = C(index) end if C(index) < y1*(1-de/100) and y1 > y2 then x2 = x1 y2 = y1 x1 = index y1 = C(index) cntlevels = cntlevels + 1 levelsx[cntlevels]=x2 levelsy[cntlevels]=y2 end if C(index) < y1 and C(index) < y2 then x1 = index y1 = C(index) end end if x1 ~= index then curfrom = x1 curto = index else curfrom = x2 curto = x1 end if sz == index then cnt = levels for k = 1, cnt do for i = 1, index do SetValue(i, k, nil) end end -- cnt = 3 k = 0 for j = cntlevels, 1, -1 do d = 0 if levelsy[j] > C(index) then d = levelsy[j] - C(index) end if levelsy[j] < C(index) then d = C(index) - levelsy[j] end if d < delta*C(index) and d > 0 then k = k + 1 if k <= cnt then y = levelsy[j] for i = levelsx[j], index do SetValue(i, k, y) end end end end --[[ k = 0 for j = cntlevels, 1, -1 do d = 0 if levelsy[j] < C(index) then d = C(index) - levelsy[j] end if d < 0.2*C(index) and d > 0 then if k <= cnt then k = k + 1 y = levelsy[j] for i = levelsx[j], index do SetValue(i, k+3, y) end end end end --]] end end
Settings= { Name = "AT-obl_can", -- название индикатора delta=2.0, -- параметр индикатора rep=5, shif=0, wt=1, line= { { Name = "ln1", Type =TYPE_LINE, Width = 2, Color = RGB(255, 0, 0) }, { Name = "ln2", Type =TYPE_LINE, Width = 2, Color = RGB(255, 0, 0) } } } function Init() vMin = 0 vMax = 0 vMinindex = 0 vMaxindex = 0 voldMinindex = 0 voldMaxindex = 0 return 2 end function OnCalculate(index) rep = Settings.rep shif = Settings.shif wt = Settings.wt sz = Size()-shif if index <= sz then if index <= 1 then vMin = C(index) vMax = C(index) vMinindex = index vMaxindex = index voldMinindex = index voldMaxindex = index v = C(index) else if voldMaxindex >= voldMinindex then --if vMin~=nil then if C(index) > (1 + Settings.delta/100)*vMin then vMin = C(index) vMax = C(index) vMaxindex = index voldMinindex = vMinindex vFrom = vMinindex else if vMin > C(index) then vMin = C(index) vMinindex = index vFrom = voldMaxindex else vFrom = vMinindex end end --end else if voldMaxindex <= voldMinindex then --if vMax~=nil then if C(index) < (1 - Settings.delta/100)*vMax then vMax = C(index) vMin = C(index) vMinindex = index voldMaxindex = vMaxindex vFrom = vMaxindex else if vMax < C(index) then vMax = C(index) vMaxindex = index vFrom = voldMinindex else vFrom = vMaxindex end end --end end end --if vFrom~=nil then --[[ for i = vFrom, index do k = (C(index)- C(vFrom))/(index- vFrom); v = i*k + C(index) - index*k SetValue(i, 1, v) end --]] --end if index == sz then for k = 1, 2 do vf = 1 vs = 0 if k == 1 then if vMinindex < vMaxindex then vf = vMinindex vs = vMaxindex up = 0 elseif vMinindex > vMaxindex then vs = vMinindex vf = vMaxindex up = 1 end elseif k == 2 then if voldMinindex < voldMaxindex then vf = voldMinindex vs = voldMaxindex up = 0 elseif voldMinindex > voldMaxindex then vs = voldMinindex vf = voldMaxindex up = 1 end end n = 0 xy = 0 x = 0 y = 0 xx = 0 m = 0 for i = vf, vs do m = m +1 n = n + 1*(1+wt*m) xy = xy + i*C(i)*(1+wt*m) x = x + i*(1+wt*m) y = y + C(i)*(1+wt*m) xx = xx + i*i*(1+wt*m) end if (n*xx - x*x) ~= 0 and n ~= 0 then a = (n*xy - x*y)/(n*xx - x*x) b = (y - a*x)/n for j = 1, rep do n = 0 xy = 0 x = 0 y = 0 xx = 0 m = 0 for i = vf, vs do v = a*i + b clc = 0 if up == 1 and C(i) > v then clc = 1 end if up == 0 and C(i) < v then clc = 1 end if clc == 1 then m = m + 1 n = n + 1*(1+wt*m) xy = xy + i*C(i)*(1+wt*m) x = x + i*(1+wt*m) y = y + C(i)*(1+wt*m) xx = xx + i*i*(1+wt*m) end end --[[--]] if (n*xx - x*x) ~= 0 and n ~= 0 and n > 2 then a = (n*xy - x*y)/(n*xx - x*x) b = (y - a*x)/n --[[ --]] end end for i = vf, sz do v = a*i + b if up == 1 and v >= C(vs) or up == 0 and v <= C(vs) then SetValue(i, k, v) end end end end end end end end