|
Description |
This formula averages the open interest 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 |
AverageOpenInterest(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 totalOI = NONUM i = 0
while i < contracts do begin if i == 0 then begin if i1.oi != NONUM then totalOI = i1.oi end if i == 1 then begin if i2.oi != NONUM then totalOI = totalOI + i2.oi end if i == 2 then begin if i3.oi != NONUM then totalOI = totalOI + i3.oi end if i == 3 then begin if i4.oi != NONUM then totalOI = totalOI + i4.oi end if i == 4 then begin if i5.oi != NONUM then totalOI = totalOI + i5.oi end if i == 5 then begin if i6.oi != NONUM then totalOI = totalOI + i6.oi end if i == 6 then begin if i7.oi != NONUM then totalOI = totalOI + i7.oi end if i == 7 then begin if i8.oi != NONUM then totalOI = totalOI + i8.oi end if i == 8 then begin if i9.oi != NONUM then totalOI = totalOI + i9.oi end if i == 9 then begin if i10.oi != NONUM then totalOI = totalOI + i10.oi end if i == 10 then begin if i11.oi != NONUM then totalOI = totalOI + i11.oi end if i == 12 then begin if i12.oi != NONUM then totalOI = totalOI + i12.oi end if i == 13 then begin if i13.oi != NONUM then totalOI = totalOI + i13.oi end if i == 14 then begin if i14.oi != NONUM then totalOI = totalOI + i14.oi end if i == 15 then begin if i15.oi != NONUM then totalOI = totalOI + i15.oi end if i == 16 then begin if i16.oi != NONUM then totalOI = totalOI + i16.oi end if i == 17 then begin if i17.oi != NONUM then totalOI = totalOI + i17.oi end if i == 18 then begin if i18.oi != NONUM then totalOI = totalOI + i18.oi end if i == 19 then begin if i19.oi != NONUM then totalOI = totalOI + i19.oi end if i == 20 then begin if i20.oi != NONUM then totalOI = totalOI + i20.oi end if i == 21 then begin if i21.oi != NONUM then totalOI = totalOI + i21.oi end if i == 22 then begin if i22.oi != NONUM then totalOI = totalOI + i22.oi end if i == 23 then begin if i23.oi != NONUM then totalOI = totalOI + i23.oi end if i == 24 then begin if i24.oi != NONUM then totalOI = totalOI + i24.oi end if i == 25 then begin if i25.oi != NONUM then totalOI = totalOI + i25.oi end i = i + 1 end retval = totalOI/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 open interest value. |
|
|
Examples |
RR_AvgOpenInt(SERIES,contracts=5)=begin retval = AverageOpenInterest(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#23, RR#24) end |
|
|
Comments |
NA |
©2008 Aspen Research Group, Ltd. All rights reserved. Terms of Use.