# NEOTICKER DATA BEGIN
ScriptType=Indicator
Description=Relative Vigor Index
Name=rvi
Language=VBScript
Links=1
MinBars=10
TimerInterval=100
EarlyBinding=0
MetaStyle=Normal
ValueRange=Same as Source
Placement=New Pane
Multiplot_num_plots=2
Multiplot_color_0=255
Multiplot_style_0=Line
Multiplot_width_0=1
Multiplot_enabled_0=1
Multiplot_name_0=RVI
Multiplot_breakstyle_0=0
Multiplot_color_1=8388736
Multiplot_style_1=Line
Multiplot_width_1=1
Multiplot_enabled_1=1
Multiplot_name_1=RVISig
Multiplot_breakstyle_1=0
UpdateByTick=1
FloatMarker=1
DepthData=0
TradingSystemUI=0
PrimaryLinkOnly=0
NotifyOnRemoval=0
Param_count=1
Param_name_0=Period
Param_inuse_0=1
Param_type_0=integer
Param_default_0=10
Explanation_Lines=1
Explanation0=Relative Vigor Index shows vigor or energy of a price movement
# NEOTICKER DATA END

function Value1 ( ByVal p1 )

   Value1 = ((Data1.Close (p1) - Data1.Open (p1)) + _
             2 * (Data1.Close(p1+1) - Data1.Open (p1+1)) + _
             2 * (Data1.Close(p1+2) - Data1.Open (p1+2)) + _
             (Data1.Close(p1+3) - Data1.Open (p1+3)))/6

end function

function Value2 ( ByVal p2 )

   Value2 = ((Data1.High (p2) - Data1.Low (p2)) + _
             2 * (Data1.High (p2+1) - Data1.Low (p2+1)) + _
             2 * (Data1.High (p2+2) - Data1.Low (p2+2)) + _
             (Data1.High (p2+3) - Data1.Low (p2+3)))/6

end function

function rvi()
   dim Num, Denom
   dim i

   if Data1.Valid (0) = false then
      Itself.SuccessEx[1] = false
      Itself.SuccessEx[2] = false
      exit function
   end if

   for i = 0 to Param1.int - 1
      Num = Num + Value1(i)
      Denom = Denom + Value2(i)
   next

   if Denom <> 0 then
      Itself.Plot (1) = Num/Denom
   end if

   itself.Plot (2) = (ItSelf.Value (0) + 2 * ItSelf.Value (1) + _
                     2 * ItSelf.Value (2) + ItSelf.Value (3))/6
end function

