Избранное трейдера meland
Последнее движение — самое сильное
Settings = { Name = "xPc5", period = 24, line= { { Name = "xPc5", Color = RGB(0, 128, 0), Type = TYPE_LINE, Width = 2 }, { Name = "xPc5", Color = RGB(255, 64, 64), Type = TYPET_BAR, Width = 3 }, { Name = "xPc5", Color = RGB(64, 64, 255), Type = TYPET_BAR, Width = 3 } } } ---------------------------------------------------------- function c_FF() return function(ind, _p) local period = _p local index = ind local MAX_ = 0 local MIN_ = 0 local MAX2_ = 0 local MIN2_ = 0 if index == 1 then MAX_ = C(index) MIN_ = C(index) MAX2_ = C(index) MIN2_ = C(index) return nil end ---------------------------------------------------------------------- period = _p if index < period then period = index end MAX_ = H(index) MIN_ = L(index) MAX2_ = 0 MIN2_ = 0 for i = 0, (period-1) do if MAX_ < H(index-i) then MAX_ = H(index-i) end if MIN_ > L(index-i) then MIN_ = L(index-i) end MAX2_ = MAX2_ + MAX_ MIN2_ = MIN2_ + MIN_ end MAX2_ = MAX2_/(period) MIN2_ = MIN2_/(period) return (MAX2_+MIN2_)/2, MAX2_, MIN2_ end end function Init() myFF = c_FF() return 3 end function OnCalculate(index) return myFF(index, Settings.period) end