AverageFuturesVolume

See Also...

Related Topics

 

 

Description

This formula averages the volume of contracts of a given future. This formula is equipped with a parameter that enables you to adjust the number of out-month contracts averaged.

 

 

Formula

AverageFuturesVolume(contracts, i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, i22, i23, i24, i25)=begin

  if contracts > 25 then contracts = 25

  if contracts < 2 then contracts = 2

  totalVol = 0

  i = 0

  while i < contracts do begin

    if i == 0 then totalVol = i1.volume

    if i == 1 then totalVol = totalVol + i2.volume

    if i == 2 then totalVol = totalVol + i3.volume

    if i == 3 then totalVol = totalVol + i4.volume

    if i == 4 then totalVol = totalVol + i5.volume

    if i == 5 then totalVol = totalVol + i6.volume

    if i == 6 then totalVol = totalVol + i7.volume

    if i == 7 then totalVol = totalVol + i8.volume

    if i == 8 then totalVol = totalVol + i9.volume

    if i == 9 then totalVol = totalVol + i10.volume

    if i == 10 then totalVol = totalVol + i11.volume

    if i == 12 then totalVol = totalVol + i12.volume

    if i == 13 then totalVol = totalVol + i13.volume

    if i == 14 then totalVol = totalVol + i14.volume

    if i == 15 then totalVol = totalVol + i15.volume

    if i == 16 then totalVol = totalVol + i16.volume

    if i == 17 then totalVol = totalVol + i17.volume

    if i == 18 then totalVol = totalVol + i18.volume

    if i == 19 then totalVol = totalVol + i19.volume

    if i == 20 then totalVol = totalVol + i20.volume

    if i == 21 then totalVol = totalVol + i21.volume

    if i == 22 then totalVol = totalVol + i22.volume

    if i == 23 then totalVol = totalVol + i23.volume

    if i == 24 then totalVol = totalVol + i24.volume

    if i == 25 then totalVol = totalVol + i25.volume

    i = i + 1

  end

  retval = totalVol / contracts

end

 

 

Parameters

contracts

This parameter can be any number from 2 to 25. If the parameter given is greater than 25 or less than 2, this formula sets the number to 25 or 2, respectively. This parameter specifies the number of contracts averaged.

 

i1 - i25

Parameters i1 through i25 are instrument symbols. The symbols should be a the contracts for a given future passed sequentially by expiration.

 

 

Return Value

An averaged volume.

 

 

Examples

RR_AvgVolume(SERIES,contracts=5)=begin

   retval = AverageFuturesVolume(contracts, RR#, RR#1, RR#2, RR#3, RR#4, RR#5, RR#6, RR#7, RR#8, RR#9, RR#10, RR#11, RR#12, RR#13, RR#14, RR#15, RR#16, RR#17, RR#18, RR#19, RR#20, RR#21, RR#22, RR#24, RR#25)

end

 

 

Comments

NA

 

©2008 Aspen Research Group, Ltd. All rights reserved. Terms of Use.