USDRUB ждем момента для покупки
Ждем движение к нижней границе канала
Авто-репост. Читать в блоге >>>
Settings={ Name="ZIGZAGPROF", line= { { Name = "cur1", Type =TYPE_LINE, Width = 2, Color = RGB(0,0, 0) } } } function Init() de = 1 y1 = nil y2 = nil x1 = 1 x2 = 1 return 1 end function OnCalculate(index) vl = C(index) if index == 1 then y1 = vl y2 = vl else if C(index) > y1*(1+de/100) and y1 < y2 then x2 = x1 y2 = y1 x1 = index y1 = C(index) 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) 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 curto ~= curfrom then k = (C(curto)- C(curfrom))/(curto- curfrom) for i = curfrom, index do curv = i*k + C(curto) - curto*k SetValue(i, 1, curv) end end return vl end