Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

tahistory

Return historical technical analysis from Bloomberg connection V3

Syntax

  • d = tahistory(c)
    example
  • d = tahistory(c,s,startdate,enddate,study,period,Name,Value)
    example

Description

example

d = tahistory(c) returns the Bloomberg® V3 session technical analysis data study and element definitions.

example

d = tahistory(c,s,startdate,enddate,study,period,Name,Value) returns the Bloomberg V3 session technical analysis data study and element definitions with additional options specified by one or more Name,Value pair arguments.

Examples

collapse all

Return all available Bloomberg studies and use the DMI study to run a technical analysis for a security.

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE® using bpipe.

List the available Bloomberg studies.

d = tahistory(c)
d =

         dmiStudyAttributes: [1x1 struct]
       smavgStudyAttributes: [1x1 struct]
        bollStudyAttributes: [1x1 struct]
         maoStudyAttributes: [1x1 struct]
          fgStudyAttributes: [1x1 struct]
         rsiStudyAttributes: [1x1 struct]
        macdStudyAttributes: [1x1 struct]
         tasStudyAttributes: [1x1 struct]
       emavgStudyAttributes: [1x1 struct]
      maxminStudyAttributes: [1x1 struct]
        ptpsStudyAttributes: [1x1 struct]
        cmciStudyAttributes: [1x1 struct]
        wlprStudyAttributes: [1x1 struct]
       wmavgStudyAttributes: [1x1 struct]
     trenderStudyAttributes: [1x1 struct]
         gocStudyAttributes: [1x1 struct]
        kltnStudyAttributes: [1x1 struct]
    momentumStudyAttributes: [1x1 struct]
         rocStudyAttributes: [1x1 struct]
         maeStudyAttributes: [1x1 struct]
       hurstStudyAttributes: [1x1 struct]
        chkoStudyAttributes: [1x1 struct]
          teStudyAttributes: [1x1 struct]
       vmavgStudyAttributes: [1x1 struct]
       tmavgStudyAttributes: [1x1 struct]
         atrStudyAttributes: [1x1 struct]
         rexStudyAttributes: [1x1 struct]
         adoStudyAttributes: [1x1 struct]
          alStudyAttributes: [1x1 struct]
         etdStudyAttributes: [1x1 struct]
         vatStudyAttributes: [1x1 struct]
        tvatStudyAttributes: [1x1 struct]
          pdStudyAttributes: [1x1 struct]
          rvStudyAttributes: [1x1 struct]
      ipmavgStudyAttributes: [1x1 struct]
       pivotStudyAttributes: [1x1 struct]
          orStudyAttributes: [1x1 struct]
         pcrStudyAttributes: [1x1 struct]
          bsStudyAttributes: [1x1 struct]

d contains structures pertaining to each available Bloomberg study.

Display the name-value pairs for the DMI study.

d.dmiStudyAttributes
ans = 

              period: [1x104 char]
     priceSourceHigh: [1x123 char]
      priceSourceLow: [1x121 char]
    priceSourceClose: [1x125 char]

Obtain more information about the period property.

d.dmiStudyAttributes.period
ans =

DEFINITION period {

    Min Value = 1

    Max Value = 1

    TYPE Int64

} // End Definition: period

Run the DMI study for the IBM® security for the last month with period equal to 14, the high price, the low price, and the closing price.

d = tahistory(c,'IBM US Equity',floor(now)-30,floor(now),'dmi',...
             'all_calendar_days','period',14,...
             'priceSourceHigh','PX_HIGH',...
             'priceSourceLow','PX_LOW','priceSourceClose','PX_LAST')
d = 

         date: [31x1 double]
     DMI_PLUS: [31x1 double]
    DMI_MINUS: [31x1 double]
          ADX: [31x1 double]
         ADXR: [31x1 double]

d contains a studyDataTable with one studyDataRow for each interval returned.

Display the first five dates in the returned data.

d.date(1:5,1)
ans =

     735507.00
     735508.00
     735509.00
     735510.00
     735511.00

Display the first five prices in the plus DI line.

d.DMI_PLUS(1:5,1)
ans =

         18.92
         17.84
         16.83
         15.86
         15.63

Display the first five prices in the minus DI line.

d.DMI_MINUS(1:5,1)
ans =

         30.88
         29.12
         28.16
         30.67
         29.24

Display the first five values of the Average Directional Index.

d.ADX(1:5,1)
ans =

         22.15
         22.28
         22.49
         23.15
         23.67

Display the first five values of the Average Directional Movement Index Rating.

d.ADXR(1:5,1)
ans =

         25.20
         25.06
         25.05
         25.60
         26.30

Close the Bloomberg connection.

close(c)

Run a technical analysis to return the DMI study for a security with a pricing source.

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

Run the DMI study for the Microsoft® security with pricing source ETPX for the last month with period equal to 14, the high price, the low price, and the closing price.

d = tahistory(c,'MSFT@ETPX US Equity',floor(now)-30,floor(now),...
             'dmi','all_calendar_days','period',14,...
             'priceSourceHigh','PX_HIGH','priceSourceLow','PX_LOW',...
             'priceSourceClose','PX_LAST')
d = 

         date: [31x1 double]
     DMI_PLUS: [31x1 double]
    DMI_MINUS: [31x1 double]
          ADX: [31x1 double]
         ADXR: [31x1 double]

d contains a studyDataTable with one studyDataRow for each interval returned.

Display the first five dates in the returned data.

d.date(1:5,1)
ans =

     735507.00
     735508.00
     735509.00
     735510.00
     735511.00

Display the first five prices in the plus DI line.

d.DMI_PLUS(1:5,1)
ans =

         28.37
         30.63
         32.72
         30.65
         29.37

Display the first five prices in the minus DI line.

d.DMI_MINUS(1:5,1)
ans =

         21.97
         21.17
         19.47
         18.24
         17.48

Display the first values of the Average Directional Index.

d.ADX(1:5,1)
ans =

         13.53
         13.86
         14.69
         15.45
         16.16

Display the first five values of the Average Directional Movement Index Rating.

d.ADXR(1:5,1)
ans =

         15.45
         15.36
         15.53
         15.85
         16.37

Close the Bloomberg connection.

close(c)

Related Examples

Input Arguments

collapse all

Bloomberg connection, specified as a connection object created using blp, blpsrv, or bpipe.

Security, specified as a character vector for a single Bloomberg security.

Data Types: char

Start date, specified as a numeric scalar or character vector to denote the start date of the date range for the returned tick data.

Example: floor(now-1)

Data Types: double | char

End date, specified as a scalar or character vector to denote the end date of the date range for the returned tick data.

Example: floor(now)

Data Types: double | char

Study type, specified as a character vector to denote the study to use for historical analysis.

Data Types: char

Periodicity, specified as one of these values to denote the data to return. For specifying multiple values, use a cell array. For example, when period is set to {'daily','all_calendar_days'}, tahistory returns daily data for all calendar days, and reports missing data as NaNs. When period is set to 'active_days_only', tahistory returns data using the default periodicity for active trading days only. The default periodicity depends on the security. If a security is reported on a monthly basis, the default periodicity is monthly. These tables show the values for period.

To specify the periodicity of the return data, see this table.

ValueDescription
'daily'

Return data for each day.

'weekly'

Return data for each week.

'monthly'

Return data for each month.

'quarterly'

Return data for each quarter.

'semi_annually'

Return data semiannually.

'yearly'

Return data for each year.

The anchor date is the date to which all other reported dates are related. To specify the anchor date, see this table.

ValueDescription
'actual'

Anchor date specification for an actual date. For this function, for periodicities other than daily, enddate is the anchor date.

If the period is weekly and the enddate is a Thursday, every data point is a Thursday, or the nearest prior business day to Thursday. If the period is monthly and the enddate is the 20th of a month, every data point is the 20th of each month in the date range.

'calendar'

Anchor date specification for a calendar year.

'fiscal'

Anchor date specification for a fiscal year.

To specify returning data for particular days, see this table.

ValueDescription
'non_trading_weekdays'Return data for all weekdays.
'all_calendar_days'Return data for all calendar days.
'active_days_only'Return data for only active trading days.

To specify how to fill missing values, see this table.

ValueDescription
'previous_value'Fill missing values with previous values for dates without trading activity for the security.
'nil_value'Fill missing values with a NaN for dates without trading activity for the security.

Data Types: char | cell

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'period',14, 'priceSourceHigh','PX_HIGH', 'priceSourceLow','PX_LOW', 'priceSourceClose','PX_LAST'

    Note   For details about the full list of name-value pair arguments, see the Bloomberg tool located at C:\blp\API\APIv3\bin\BBAPIDemo.exe.

collapse all

Period, specified as a scalar. For details about the period, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Data Types: double

High price, specified as a character vector. For details about the high price, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Data Types: char

Low price, specified as a character vector. For details about the low price, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Data Types: char

Closing price, specified as a character vector. For details about the closing price, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Data Types: char

Output Arguments

collapse all

Technical analysis return data, returned as a structure. For details about the possible returned data, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Introduced in R2012b

Was this topic helpful?