1 # Created by Octave 3.6.1, Sat Apr 28 20:53:21 2012 UTC <root@brouzouf>
13 # name: <cell-element>
17 -- Function File: bolling (ASSET, SAMPLES)
18 -- Function File: bolling (ASSET, SAMPLES, ALPHA)
19 -- Function File: bolling (ASSET, SAMPLES, ALPHA, WIDTH)
20 -- Function File: [MOVAVG, UPPERBAND, LOWERBAND] = bolling (ASSET,
22 If no output is requested, plot the bollinger bands of the ASSET.
23 If output is requested, return the values for the bollinger bands.
24 If given, ALPHA is the weighting power of the moving average; 0
25 (default) is the simple moving average, see `movavg' for the full
26 definition. WIDTH is the number of standard deviations to plot
27 above and below the moving average (default: 2).
29 See also: movavg, candle, dateaxis, highlow, pointfig
35 # name: <cell-element>
39 If no output is requested, plot the bollinger bands of the ASSET.
43 # name: <cell-element>
50 # name: <cell-element>
54 -- Function File: b = busdate (refdate)
55 -- Function File: b = busdate (refdate, direction)
56 -- Function File: b = busdate (refdate, direction, holiday)
57 -- Function File: b = busdate (refdate, direction, holiday, weekend)
58 Return the datenum of the next or previous business day from
59 REFDATE. DIRECTION indicates the next day (default) if 1 and the
60 previous day if -1. HOLIDAY is a vector of datenums that defines
61 the holidays observed (the holidays function is used if not
62 given). WEEKEND defines the days of the week that should be
63 considered weekends; [1 0 0 0 0 0 1] (default) indicates that
64 Sunday and Saturday are holidays.
66 If any of the optional inputs (DIRECTION, HOLIDAY, WEEKEND) are
67 empty, then the default is used.
69 See also: holidays, lbusdate, isbusday, fbusdate
75 # name: <cell-element>
79 Return the datenum of the next or previous business day from REFDATE.
83 # name: <cell-element>
90 # name: <cell-element>
94 -- Function File: BDATES = busdays (SDATE, EDATE)
95 -- Function File: BDATES = busdays (SDATE, EDATE, BDMODE)
96 -- Function File: BDATES = busdays (SDATE, EDATE, BDMODE, HOLVEC)
97 Generate a list of business dates at the end of the periods defined
98 between (including) SDATE and EDATE.
100 SDATE is the starting date, EDATE is the ending date, both are in
101 serial date format (see datenum). BDMODE is the business day
102 frequency ("daily", "weekly", "monthly", "quarterly",
103 "semiannual", or "annual"); these can be abbreviated by the first
104 letter and they may also use an integer corresponding to the order
105 in the above list (i.e. "daily" = 1). HOLVEC is an optional list
106 of holidays. If the holidays are not given, then the holidays
109 See also: holidays, busdate, lbusdate, isbusday, fbusdate, datenum
115 # name: <cell-element>
119 Generate a list of business dates at the end of the periods defined
124 # name: <cell-element>
131 # name: <cell-element>
135 -- Function File: CFCONV = cfconv (CF, YIELD)
136 Calculate convexity CFCONV from given fixed-paid cash flow CF and
141 [1] http://thismatter.com/money/bonds/duration-convexity.htm
143 [2] http://en.wikipedia.org/wiki/Bond_convexity
151 # name: <cell-element>
155 Calculate convexity CFCONV from given fixed-paid cash flow CF and
160 # name: <cell-element>
167 # name: <cell-element>
171 -- Function File: [DUR, MOD_DUR] = cfdur (CF, YIELD)
172 Calculate duration DUR and modified duration MOD_DUR, from given
173 fixed-paid cash flow CF and period yield YIELD.
175 Reference: http://en.wikipedia.org/wiki/Bond_duration Using
176 periodic compounding instead of continuous compounding.
184 # name: <cell-element>
188 Calculate duration DUR and modified duration MOD_DUR, from given
193 # name: <cell-element>
200 # name: <cell-element>
204 -- Function File: COV = corr2cov (SIGMA, CORR)
205 Convert standard deviation SIGMA and correlation coefficients CORR
208 Note that the rate R is specified as a fraction (i.e., 0.05, not 5
211 See also: corrcoef, cov, cov2corr, std
217 # name: <cell-element>
221 Convert standard deviation SIGMA and correlation coefficients CORR to
226 # name: <cell-element>
233 # name: <cell-element>
237 -- Function File: [SIGMA, CORR] = cov2corr (COV)
238 Convert covariance COV from input to standard deviation SIGMA and
239 correlation coefficients CORR.
241 See also: corr2cov, corrcoef, cov, std
247 # name: <cell-element>
251 Convert covariance COV from input to standard deviation SIGMA and
256 # name: <cell-element>
263 # name: <cell-element>
267 -- Function File: dateaxis ()
268 -- Function File: dateaxis (AX)
269 -- Function File: dateaxis (AX, DATEFORM)
270 -- Function File: dateaxis (AX, DATEFORM, STARTDATE)
271 -- Function File: dateaxis (H, ...)
272 Convert the current axis tick labels (or the axis handle H) to a
273 date format. The axis given by AX ("x", "y", or "z") will be
274 changed; the default is "x". The date format, DATEFORM, used will
275 be either auto-determined or an integer corresponding to the date
276 formats in datestr. If STARTDATE is given, then the first tick
277 value on the given axis is assumed to be that date.
279 See also: bolling, candle, highlow, movavg, pointfig
285 # name: <cell-element>
289 Convert the current axis tick labels (or the axis handle H) to a date
294 # name: <cell-element>
301 # name: <cell-element>
305 -- Function File: indices = datefind (subset, superset, tol)
306 Find any instances of the `subset' in the `superset' with the
307 `tol'erance. `tol' is 0 by default.
309 See also: date, datenum
315 # name: <cell-element>
319 Find any instances of the `subset' in the `superset' with the
324 # name: <cell-element>
331 # name: <cell-element>
335 -- Function File: Y = datesplit(date, P)
336 -- Function File: [Y,M,D,h,m,s] = datesplit(date, P)
337 Split a date string into the Year, Month, Day, hour, minute, and
338 second. This routine tries to be as forgiving as possible to the
339 date input while requiring that the date is not ambiguous.
341 Anywhere possible where it would not be ambiguous, efforts were
342 made to make times possible with seconds and AM/PM as optional.
343 Also, along the same lines, where possible, commas were allowed
344 with spaces, and the year/month/day separators were allowed as
345 period (.), slash (/), and dash (-). Not all format possibilities
346 are shown in the following table, but a date like `dd-mmm-yyyy
347 HH:MM:SS' is parsed just as well as `d/mmm.yyyy, ,H:MM, AM'.
349 Supported `date' formats include (the same as datestr):
350 *Code* *Format* *Example*
351 0 dd-mmm-yyyy HH:MM:SS 07-Sep-2000 15:38:09
352 1 dd-mmm-yyyy 07-Sep-2000
359 14 HH:MM:SS PM 03:38:09 PM
365 21 mmm.dd.yyyy HH:MM:SS Mar.03.1962 13:53:06
366 22 mmm.dd.yyyy Mar.03.1962
367 23 mm/dd/yyyy 03/13/1962
368 24 dd/mm/yyyy 12/03/1962
370 26 yyyy/mm/dd 1995/03/13
374 30 yyyymmddTHHMMSS 20470313T132603
375 31 yyyy-mm-dd HH:MM:SS 1047-03-13 13:26:03
377 The parameter `P' is needed to convert date strings with 2 digit
378 years into dates with 4 digit years. 2 digit years are assumed to
379 be between `P' and `P+99'. If `P' is not given then the current
380 year - 50 is used, so that dates are centered on the present. For
381 birthdates, you would want `P' to be current year - 99. For
382 appointments, you would want `P' to be current year.
384 This function makes no strong attempt to verify the accuracy of the
385 numbers that it returns in that it doesn't (currently) check to see
386 that you're not trying to use the date Feb 30. When applicable, it
387 tries to make your input work, though. It will try to determine if
388 you're using the date "03/13/95" that the date is "March 13, 1995",
389 but if there is doubt, datesplit will return an error instead of
390 trying to guess the wrong value.
392 See also: date, clock, now, datestr, datenum, calendar, weekday
398 # name: <cell-element>
402 Split a date string into the Year, Month, Day, hour, minute, and
407 # name: <cell-element>
414 # name: <cell-element>
418 -- Function File: dom = day (Date)
419 Returns the day of the month from a serial date number or a date
422 See also: date, datevec, now, month, year
428 # name: <cell-element>
432 Returns the day of the month from a serial date number or a date string.
436 # name: <cell-element>
443 # name: <cell-element>
447 -- Function File: daysact (D1)
448 -- Function File: daysact (D1, D2)
449 Calculates the number of days between two dates. If the second
450 date is not given, calculate the number of days since 1-Jan-0000.
451 The variables D1 and D2 can either be strings or an N-row string
452 matrix. If both D1 and D2 are string matrices, then the number of
453 rows must match. An example of the use of `daysact' is
455 daysact ("01-Jan-2007", ["10-Jan-2007"; "23-Feb-2007"; "23-Jul-2007"])
466 # name: <cell-element>
470 Calculates the number of days between two dates.
474 # name: <cell-element>
481 # name: <cell-element>
485 -- Function File: [m, d] = easter (y)
486 -- Function File: datenum = easter (y)
487 Return the month (M) and day (D) of Easter in the Gregorial
488 calendar on a given year or years.
496 # name: <cell-element>
500 Return the month (M) and day (D) of Easter in the Gregorial calendar on
505 # name: <cell-element>
512 # name: <cell-element>
516 -- Function File: RETURN = effrr (RATE, NUMPERIODS)
517 Compute the effective rate of return based on a nominal RATE over
518 a number of periods, NUMPERIODS.
526 # name: <cell-element>
530 Compute the effective rate of return based on a nominal RATE over a
535 # name: <cell-element>
542 # name: <cell-element>
546 -- Function File: E = eomdate (Y, M)
547 Return the last day of the month M for the year Y in datenum
550 See also: datenum, datevec, weekday, eomday
556 # name: <cell-element>
560 Return the last day of the month M for the year Y in datenum format.
564 # name: <cell-element>
571 # name: <cell-element>
575 -- Function File: b = fbusdate (year, month)
576 -- Function File: b = fbusdate (year, month, holiday)
577 -- Function File: b = fbusdate (year, month, holiday, weekend)
578 Return the datenum of the first business day of the YEAR and
579 MONTH. HOLIDAY is a vector of datenums that defines the holidays
580 observed (the holidays function is used if not given). WEEKEND
581 defines the days of the week that should be considered weekends;
582 [1 0 0 0 0 0 1] (default) indicates that Sunday and Saturday are
585 If any of the optional inputs (HOLIDAY, WEEKEND) are empty, then
588 See also: holidays, lbusdate, isbusday, busdate
594 # name: <cell-element>
598 Return the datenum of the first business day of the YEAR and MONTH.
602 # name: <cell-element>
609 # name: <cell-element>
613 -- DATA =: fetch (CONN, SYMBOL)
614 -- DATA =: fetch (..., FIELDS)
615 -- DATA =: fetch (..., DATE)
616 -- DATA =: fetch (..., FROMDATE, TODATE)
617 -- DATA =: fetch (..., PERIOD)
618 -- [DATA, FIELDS] =: fetch (...)
619 Download stock data from a connection.
621 FIELDS are the data fields to download and must come from the set
640 As an output, FIELDS may be different than your request. This is
641 because there is mapping of field names from the data source to
642 the output, and what is returned is the source mapping to allow
645 DATE is the date string or datenum for the requested data. If you
646 enter today's date, you will get yesterday's data. FROMDATE and
647 TODATE allow you to specify a date range for the data.
649 PERIOD (default: "d") allows you to select the period for the data
650 which can be any of the below as long as they are supported by the
656 * 'm': monthly (Yahoo only)
658 * 'v': dividends (Yahoo only)
660 See also: yahoo, google
666 # name: <cell-element>
670 Download stock data from a connection.
674 # name: <cell-element>
681 # name: <cell-element>
685 -- Function File: fv (R, N, P, L, METHOD)
686 Return the future value at the end of period N of an investment
687 which consists of N payments of P in each period, assuming an
690 The optional argument L may be used to specify an additional
693 The optional argument METHOD may be used to specify whether the
694 payments are made at the end (`"e"', default) or at the beginning
695 (`"b"') of each period.
697 Note that the rate R is specified as a fraction (i.e., 0.05, not 5
703 # name: <cell-element>
707 Return the future value at the end of period N of an investment which
712 # name: <cell-element>
719 # name: <cell-element>
723 -- Function File: fvl (R, N, L)
724 Return the future value at the end of N periods of an initial lump
725 sum investment L, given a per-period interest rate R.
727 Note that the rate R is specified as a fraction (i.e., 0.05, not 5
733 # name: <cell-element>
737 Return the future value at the end of N periods of an initial lump sum
742 # name: <cell-element>
749 # name: <cell-element>
753 -- Function File: CONN = google ()
754 -- Function File: CONN = google (URL, IPADDRESS, PORT)
755 Prepare a Google connection for the fetch command to get Google
756 historical quote data.
758 If given, the URL must be "http://finance.google.com". The
759 IPADDRESS and PORT is the proxy ipaddress and port. These
760 parameters are currently ignored (with a warning if given).
762 See also: fetch, yahoo
768 # name: <cell-element>
772 Prepare a Google connection for the fetch command to get Google
777 # name: <cell-element>
784 # name: <cell-element>
788 -- Function File: HHV = hhigh (DATA)
789 -- Function File: HHV = hhigh (DATA, NPERIODS)
790 -- Function File: HHV = hhigh (DATA, NPERIODS, DIM)
791 Compute the highest high value of DATA for the past NPERIODS
792 (default: 14) across the dimension, DIM (default: 1).
800 # name: <cell-element>
804 Compute the highest high value of DATA for the past NPERIODS (default:
809 # name: <cell-element>
816 # name: <cell-element>
820 -- Function File: H = highlow (HIGH, LOW, CLOSE)
821 -- Function File: H = highlow (HIGH, LOW, CLOSE, OPEN)
822 -- Function File: H = highlow (HIGH, LOW, CLOSE, OPEN, COLOR)
823 Plot the HIGH, LOW, and CLOSE of a security. The CLOSE is plotted
824 as a tick to the right, and if OPEN is given and non-empty, it is
825 plotted as a tick to the left. The color can override the default
828 See also: bolling, candle, dateaxis, movavg, pointfig
834 # name: <cell-element>
838 Plot the HIGH, LOW, and CLOSE of a security.
842 # name: <cell-element>
849 # name: <cell-element>
853 -- Function File: h = holidays (startdate, enddate)
854 Return a vector of datenums that were holidays between STARTDATE
855 and ENDDATE, inclusive. These holidays are trading holidays
856 observed by the NYSE according to its rule 51.10. It does not take
857 into account the exceptions for "unusual business conditions" or
858 for additional days that have been called as holidays for one-time
861 The complete list can be found at
862 http://www.chronos-st.org/NYSE_Observed_Holidays-1885-Present.html
864 See also: busdate, lbusdate, isbusday, fbusdate
870 # name: <cell-element>
874 Return a vector of datenums that were holidays between STARTDATE and
879 # name: <cell-element>
886 # name: <cell-element>
890 -- Function File: h = hour (Date)
891 Returns the hour from a serial date number or a date string.
893 See also: date, datevec, now, minute, second
899 # name: <cell-element>
903 Returns the hour from a serial date number or a date string.
907 # name: <cell-element>
914 # name: <cell-element>
918 -- Function File: irr (P, I)
919 Return the internal rate of return of a series of payments P from
920 an initial investment I (i.e., the solution of `npv (r, p) = i'.
921 If the second argument is omitted, a value of 0 is used.
923 See also: npv, pv, rate
929 # name: <cell-element>
933 Return the internal rate of return of a series of payments P from an
938 # name: <cell-element>
945 # name: <cell-element>
949 -- Function File: r = isbusday (refdate)
950 -- Function File: r = isbusday (refdate, holiday)
951 -- Function File: r = isbusday (refdate, holiday, weekend)
952 Return true if the REFDATE is a business date REFDATE. HOLIDAY is
953 a vector of datenums that defines the holidays observed (the
954 holidays function is used if not given). WEEKEND defines the days
955 of the week that should be considered weekends; [1 0 0 0 0 0 1]
956 (default) indicates that Sunday and Saturday are weekends.
958 See also: holidays, lbusdate, busdate, fbusdate
964 # name: <cell-element>
968 Return true if the REFDATE is a business date REFDATE.
972 # name: <cell-element>
979 # name: <cell-element>
983 -- Function File: b = lbusdate (year, month)
984 -- Function File: b = lbusdate (year, month, holiday)
985 -- Function File: b = lbusdate (year, month, holiday, weekend)
986 Return the datenum of the last business day of the YEAR and MONTH.
987 HOLIDAY is a vector of datenums that defines the holidays observed
988 (the holidays function is used if not given). WEEKEND defines the
989 days of the week that should be considered weekends; [1 0 0 0 0 0
990 1] (default) indicates that Sunday and Saturday are holidays.
992 If any of the optional inputs (HOLIDAY, WEEKEND) are empty, then
995 See also: holidays, fbusdate, isbusday, busdate
1001 # name: <cell-element>
1005 Return the datenum of the last business day of the YEAR and MONTH.
1009 # name: <cell-element>
1016 # name: <cell-element>
1020 -- Function File: LLV = llow (DATA)
1021 -- Function File: LLV = llow (DATA, NPERIODS)
1022 -- Function File: LLV = llow (DATA, NPERIODS, DIM)
1023 Compute the lowest low value of DATA for the past NPERIODS
1024 (default: 14) across the dimension, DIM (default: 1).
1032 # name: <cell-element>
1036 Compute the lowest low value of DATA for the past NPERIODS (default:
1041 # name: <cell-element>
1048 # name: <cell-element>
1052 -- Function File: last = lweekdate (weekday, year, month, nextday)
1053 Returns the last occurrence of WEEKDAY from the MONTH and YEAR.
1054 If the optional NEXTDAY argument is given, then the week must also
1057 See also: eomdate, nweekdate, weekday
1063 # name: <cell-element>
1067 Returns the last occurrence of WEEKDAY from the MONTH and YEAR.
1071 # name: <cell-element>
1078 # name: <cell-element>
1082 -- Function File: exceldatenums = m2xdate (datenums)
1083 -- Function File: exceldatenums = m2xdate (datenums, convention)
1084 -- Function File: exceldatenums = m2xdate (datenums, convention,
1086 Convert DATENUMS from the internal date format to the format used
1087 by Microsoft Excel. If set to 0 (default, Excel for Windows),
1088 CONVENTION specifies to use the Excel 1900 convention where Jan 1,
1089 1900 corresponds to Excel serial date number 1. If set to 1
1090 (Excel for Mac), CONVENTION specifies to use the Excel 1904
1091 convention where Jan 1, 1904 corresponds to Excel serial date
1094 Note that this does not take into account the Excel bug where 1900
1095 is considered to be a leap year unless you give the "ExcelBug"
1098 Excel does not represent dates prior to 1 January 1900 using this
1099 format, so a warning will be issued if any dates preceed this date.
1101 See also: datenum, x2mdate
1107 # name: <cell-element>
1111 Convert DATENUMS from the internal date format to the format used by
1116 # name: <cell-element>
1123 # name: <cell-element>
1127 -- Function File: m = minute (Date)
1128 Returns the minute from a serial date number or a date string.
1130 See also: date, datevec, now, hour, second
1136 # name: <cell-element>
1140 Returns the minute from a serial date number or a date string.
1144 # name: <cell-element>
1151 # name: <cell-element>
1155 -- Function File: RETURN = mirr (CASHFLOW, FINRATE, REINVESTRATE)
1156 Compute the modified internal rate of return. Take periodic
1157 CASHFLOWs as a vector and the finance rate, FINRATE, for negative
1158 cash flows and a reinvestment rate, REINVESTRATE, for positive
1161 See also: irr, effrr, nomrr, pvvar, xirr
1167 # name: <cell-element>
1171 Compute the modified internal rate of return.
1175 # name: <cell-element>
1182 # name: <cell-element>
1186 -- Function File: mon = month (Date)
1187 Returns the day of the month from a serial date number or a date
1190 See also: date, datevec, now, day, year
1196 # name: <cell-element>
1200 Returns the day of the month from a serial date number or a date string.
1204 # name: <cell-element>
1211 # name: <cell-element>
1215 -- Function File: mos = months (startdate, enddate)
1216 -- Function File: mos = months (startdate, enddate, endmonthflag)
1217 Return the number of whole months between STARTDATE and ENDDATE.
1218 ENDMONTHFLAG defaults to 1.
1220 If ENDMONTHFLAG is true, then if both the STARTDATE and the
1221 ENDDATE are end of month dates and ENDDATE has fewer days in the
1222 month than STARTDATE, ENDMONTHFLAG = 1 treats ENDDATE as the end
1223 of a month, but ENDMONTHFLAG = 0 does not.
1225 See also: yeardays, yearfrac
1231 # name: <cell-element>
1235 Return the number of whole months between STARTDATE and ENDDATE.
1239 # name: <cell-element>
1246 # name: <cell-element>
1250 -- Function File: movavg (ASSET, LEAD, LAG)
1251 -- Function File: movavg (ASSET, LEAD, LAG, ALPHA)
1252 -- Function File: [SHORT, LONG] = movavg (ASSET, LEAD, LAG, ALPHA)
1253 Calculate the LEADing and LAGging moving average of an ASSET. If
1254 given, ALPHA is the weighting power of the delay; 0 (default) is
1255 the simple moving average, 0.5 would be the square root weighted
1256 moving average, 1 would be linear, 2 would be squared, ..., and
1257 'e' is the exponential moving average.
1259 If no output is requested the data is plotted. The plots are drawn
1260 in the following order: asset, lag, lead. If output is requested,
1261 no plot is generated.
1263 See also: bolling, candle, dateaxis, highlow, pointfig
1269 # name: <cell-element>
1273 Calculate the LEADing and LAGging moving average of an ASSET.
1277 # name: <cell-element>
1284 # name: <cell-element>
1288 -- Function File: NVI = negvolidx (CLOSEPRICE, VOL)
1289 -- Function File: NVI = negvolidx ([CLOSEPRICE VOL])
1290 -- Function File: NVI = negvolidx (CLOSEPRICE, VOL, INITNVI)
1291 -- Function File: NVI = negvolidx ([CLOSEPRICE VOL], INITNVI)
1292 Compute the negative volume index of a security based on its
1293 closing price (CLOSEPRICE) and VOLume. They may be given as
1294 separate arguments or as an nx2 matrix. If given, the INITNVI is
1295 the starting value of the nvi (default: 100).
1297 The NVI will always be a column vector.
1299 See also: onbalvol, posvolidx
1305 # name: <cell-element>
1309 Compute the negative volume index of a security based on its closing
1314 # name: <cell-element>
1321 # name: <cell-element>
1325 -- Function File: RETURN = nomrr (RATE, NUMPERIODS)
1326 Compute the nominal rate of return based on a effective RATE over
1327 a number of periods, NUMPERIODS.
1329 See also: irr, effrr
1335 # name: <cell-element>
1339 Compute the nominal rate of return based on a effective RATE over a
1344 # name: <cell-element>
1351 # name: <cell-element>
1355 -- Function File: nper (R, P, A, L, METHOD)
1356 Return the number of regular payments of P necessary to amortize A
1357 loan of amount A and interest R.
1359 The optional argument L may be used to specify an additional
1360 lump-sum payment of L made at the end of the amortization time.
1362 The optional argument METHOD may be used to specify whether
1363 payments are made at the end ("E", default) or at the beginning
1364 ("B") of each period.
1366 Note that the rate R is specified as a fraction (i.e., 0.05, not 5
1369 See also: pv, pmt, rate, npv
1375 # name: <cell-element>
1379 Return the number of regular payments of P necessary to amortize A loan
1384 # name: <cell-element>
1391 # name: <cell-element>
1395 -- Function File: npv (R, P, I)
1396 Net present value of a series of payments.
1398 Returns the net present value of a series of irregular (i.e., not
1399 necessarily identical) payments P which occur at the ends of N
1400 consecutive periods. R specifies the one-period interest rates and
1401 can either be a scalar (constant rates) or a vector of the same
1404 The optional argument I may be used to specify an initial
1407 Note that the rate R is specified as a fraction (i.e., 0.05, not 5
1416 # name: <cell-element>
1420 Net present value of a series of payments.
1424 # name: <cell-element>
1431 # name: <cell-element>
1435 -- Function File: last = nweekdate (n, weekday, year, month, nextday)
1436 Returns the Nth occurrence of WEEKDAY from the MONTH and YEAR. If
1437 the optional NEXTDAY argument is given, then the week must also
1438 contain NEXTDAY. If N is greater than the number of occurrences
1439 of that day in the month, 0 is returned.
1441 See also: eomdate, lweekdate, weekday
1447 # name: <cell-element>
1451 Returns the Nth occurrence of WEEKDAY from the MONTH and YEAR.
1455 # name: <cell-element>
1462 # name: <cell-element>
1466 -- Function File: OBV = onbalvol (CLOSEPRICE, VOL)
1467 -- Function File: OBV = onbalvol ([CLOSEPRICE VOL])
1468 Compute the on balance volume of a security based on its closing
1469 price (CLOSEPRICE) and VOLume. They may be given as separate
1470 arguments or as an nx2 matrix.
1472 The output will be a column vector, and the first number in the
1475 See also: negvolidx, posvolidx
1481 # name: <cell-element>
1485 Compute the on balance volume of a security based on its closing price
1490 # name: <cell-element>
1497 # name: <cell-element>
1501 -- Function File: pmt (R, N, A, L, METHOD)
1502 Return the amount of periodic payment necessary to amortize a loan
1503 of amount a with interest rate R in N periods.
1505 The optional argument L may be used to specify a terminal lump-sum
1508 The optional argument METHOD may be used to specify whether
1509 payments are made at the end ("E", default) or at the beginning
1510 ("B") of each period.
1512 See also: pv, nper, rate
1518 # name: <cell-element>
1522 Return the amount of periodic payment necessary to amortize a loan of
1527 # name: <cell-element>
1534 # name: <cell-element>
1538 -- Function File: pointfig (ASSET)
1539 Plot the point figure chart of an ASSET. Upward price movements
1540 are plotted as Xs and downward movements are plotted as Os.
1542 See also: bolling, candle, dateaxis, highlow, movavg
1548 # name: <cell-element>
1552 Plot the point figure chart of an ASSET.
1556 # name: <cell-element>
1563 # name: <cell-element>
1567 -- Function File: PVI = posvolidx (CLOSEPRICE, VOL)
1568 -- Function File: PVI = posvolidx ([CLOSEPRICE VOL])
1569 -- Function File: PVI = posvolidx (CLOSEPRICE, VOL, INITPVI)
1570 -- Function File: PVI = posvolidx ([CLOSEPRICE VOL], INITPVI)
1571 Compute the positive volume index of a security based on its
1572 closing price (CLOSEPRICE) and VOLume. They may be given as
1573 separate arguments or as an nx2 matrix. If given, the INITPVI is
1574 the starting value of the pvi (default: 100).
1576 The PVI will always be a column vector.
1578 See also: onbalvol, negvolidx
1584 # name: <cell-element>
1588 Compute the positive volume index of a security based on its closing
1593 # name: <cell-element>
1600 # name: <cell-element>
1604 -- Function File: pv (R, N, P, L, METHOD)
1605 Returns the present value of an investment that will pay off P for
1606 N consecutive periods, assuming an interest R.
1608 The optional argument L may be used to specify an additional
1609 lump-sum payment made at the end of N periods.
1611 The optional argument METHOD may be used to specify whether
1612 payments are made at the end (`"e"', default) or at the beginning
1613 (`"b"') of each period.
1615 Note that the rate R is specified as a fraction (i.e., 0.05, not 5
1618 See also: pmt, nper, rate, npv
1624 # name: <cell-element>
1628 Returns the present value of an investment that will pay off P for N
1633 # name: <cell-element>
1640 # name: <cell-element>
1644 -- Function File: V = pvl (R, N, P)
1645 Return the present value V of an investment that will pay off P in
1646 one lump sum at the end of N periods, given the interest rate R.
1648 Note that the rate R is specified as a fraction (i.e., 0.05, not 5
1654 # name: <cell-element>
1658 Return the present value V of an investment that will pay off P in one
1663 # name: <cell-element>
1670 # name: <cell-element>
1674 -- Function File: R = rate (N, P, V)
1675 -- Function File: R = rate (N, P, V, L)
1676 -- Function File: R = rate (N, P, V, L, METHOD)
1677 -- Function File: R = rate (N, P, V, METHOD)
1678 Return the rate of return R on an investment of present value V
1679 which pays P in N consecutive periods.
1681 The optional argument L may be used to specify an additional
1682 lump-sum payment made at the end of N periods.
1684 The optional string argument METHOD may be used to specify whether
1685 payments are made at the end (`"e"', default) or at the beginning
1686 (`"b"') of each period.
1688 See also: pv, pmt, nper, npv
1694 # name: <cell-element>
1698 Return the rate of return R on an investment of present value V which
1703 # name: <cell-element>
1710 # name: <cell-element>
1714 -- Function File: RSI = rsindex (CLOSEPRICE)
1715 -- Function File: RSI = rsindex (CLOSEPRICE, NPERIODS)
1716 Compute the relative strength index (RSI) of an asset from the
1717 vector of closing prices (CLOSEPRICE). NPERIODS defines the
1718 number of periods that the rsi should be calculated for (default:
1721 The beginning of the RSI is padded with nans to match the size of
1728 # name: <cell-element>
1732 Compute the relative strength index (RSI) of an asset from the vector
1737 # name: <cell-element>
1744 # name: <cell-element>
1748 -- Function File: s = second (Date)
1749 Returns the second from a serial date number or a date string.
1751 See also: date, datevec, now, hour, minute
1757 # name: <cell-element>
1761 Returns the second from a serial date number or a date string.
1765 # name: <cell-element>
1772 # name: <cell-element>
1776 -- Function File: RETURN = taxedrr (PRETAXRETURN, TAXRATE)
1777 Compute the taxed rate of RETURN based on a PRETAXRETURN rate and
1780 See also: irr, effrr, nomrr, pvvar, xirr
1786 # name: <cell-element>
1790 Compute the taxed rate of RETURN based on a PRETAXRETURN rate and a
1795 # name: <cell-element>
1802 # name: <cell-element>
1806 -- Function File: [begindate, enddate] = thirdwednesday (month, year)
1807 Find the third Wednesday of the month specified by the MONTH and
1808 YEAR. The BEGINDATE is the third Wednesday of the month, and the
1809 ENDDATE is three months after that. Outputs are in the form of
1812 The third Wednesday is used for Eurodollar futures.
1814 See also: nweekdate, datenum
1820 # name: <cell-element>
1824 Find the third Wednesday of the month specified by the MONTH and YEAR.
1828 # name: <cell-element>
1835 # name: <cell-element>
1839 -- Function File: datenum = today ()
1840 Returns the current local date as the number of days since Jan 1,
1841 0000. By this reckoning, Jan 1, 1970 is day number 719529.
1843 The returned number corresponds to 00:00:00 today.
1845 The returned value is also called a "serial date number" (see
1848 See also: clock, date, datenum, now
1854 # name: <cell-element>
1858 Returns the current local date as the number of days since Jan 1, 0000.
1862 # name: <cell-element>
1869 # name: <cell-element>
1873 -- Function File: VOLAT = vol (X, M, N)
1874 Return the volatility VOLAT of each column of the input matrix X.
1876 The number of data sets per period is given by M (e.g. the number
1877 of data per year if you want to compute the volatility per year).
1878 The optional parameter N gives the number of past periods used for
1879 computation, if it is omitted, a value of 1 is used.
1881 If T is the number of rows of X, `vol' returns the volatility from
1888 # name: <cell-element>
1892 Return the volatility VOLAT of each column of the input matrix X.
1896 # name: <cell-element>
1903 # name: <cell-element>
1907 -- Function File: datenums = x2mdate (exceldatenums)
1908 -- Function File: datenums = x2mdate (exceldatenums, convention)
1909 -- Function File: datenums = x2mdate (exceldatenums, convention,
1911 Convert DATENUMS from the Microsoft Excel date format to the
1912 format used by `datenum'. If set to 0 (default, Excel for
1913 Windows), CONVENTION specifies to use the Excel 1900 convention
1914 where Jan 1, 1900 corresponds to Excel serial date number 1. If
1915 set to 1 (Excel for Mac), CONVENTION specifies to use the Excel
1916 1904 convention where Jan 1, 1904 corresponds to Excel serial date
1919 Note that this does not take into account the Excel bug where 1900
1920 is considered to be a leap year unless you give the "ExcelBug"
1923 Excel does not represent dates prior to 1 January 1900 using this
1924 format, so a warning will be issued if any dates preceed this date.
1926 See also: datenum, x2mdate
1932 # name: <cell-element>
1936 Convert DATENUMS from the Microsoft Excel date format to the format
1941 # name: <cell-element>
1948 # name: <cell-element>
1952 -- Function File: CONN = yahoo ()
1953 -- Function File: CONN = yahoo (URL, IPADDRESS, PORT)
1954 Prepare a Yahoo connection for the fetch command to get Yahoo
1955 historical quote data.
1957 If given, the URL must be "http://quote.yahoo.com". The IPADDRESS
1958 and PORT is the proxy ipaddress and port. These parameters are
1959 currently ignored (with a warning if given).
1961 See also: fetch, google
1967 # name: <cell-element>
1971 Prepare a Yahoo connection for the fetch command to get Yahoo
1976 # name: <cell-element>
1983 # name: <cell-element>
1987 -- Function File: y = year (Date)
1988 Returns the year from a serial date number or a date string.
1990 See also: date, datevec, now, day, month
1996 # name: <cell-element>
2000 Returns the year from a serial date number or a date string.
2004 # name: <cell-element>
2011 # name: <cell-element>
2015 -- Function File: D = yeardays (Y)
2016 -- Function File: D = yeardays (Y, B)
2017 Return the number of days in the year Y with an optional basis B.
2020 * 0 actual/actual (default)
2032 * 6 30/360 (European)
2034 * 7 actual/365 (Japanese)
2036 * 8 actual/actual (ISMA)
2038 * 9 actual/360 (ISMA)
2040 * 10 actual/365 (ISMA)
2044 See also: days365, days360, daysact, daysdif
2050 # name: <cell-element>
2054 Return the number of days in the year Y with an optional basis B.