Блог им. autotrade
--[[ вопросы к автору: https://smart-lab.ru/profile/autotrade/ Индикатор: Кривая/прямая параметры: Procent - процент зигзага --]] Settings={ Name="CURV_Templ", day=1, month=1, year=2022, day2=1, month2=12, year2=2022, a=0.0, b=0.0, c=0.0, d=0.0, line= { { Name = "cur1", Type =TYPE_LINE, Width = 2, Color = RGB(0,0, 0) } } } function Init() clc = {}; vl = {}; return 1 end function OnCalculate(index) v = nil d = Settings.day m = Settings.month y = Settings.year d2 = Settings.day2 m2 = Settings.month2 y2 = Settings.year2 a = Settings.a b = Settings.b c = Settings.c dd = Settings.d vl[index]=nil if T(index).day >= d and T(index).month >= m and T(index).year >= y then clc[index]=1 else clc[index]=0 end if index-1 > 0 then if clc[index-1]~=nil then if clc[index-1]~=0 then clc[index] = clc[index-1]+1 end end end if T(index).day >= d2 and T(index).month >= m2 and T(index).year >= y2 then clc[index]=0 end if clc[index] ~= 0 then if index-1 > 0 then if vl[index-1] == nil then vl[index-1] = C(index-1) end if vl[index-1] ~= nil then vl[index] = a*clc[index]^3+b*clc[index]^2+c*clc[index]+dd end end end return vl[index] end