Attributes

Numbers used in a MIM query can be derived in two ways. As a simple time series which has been retrieved unaltered from the database or as a computed time series. Computed time series are created using arithmetic combinations of simple time series, functions, and constants. Both types are handled the same by the MIM, and are termed attributes.

An example of a simple time series is “Close of DJIA”. This data is retrieved from the MIM database unaltered, and will yield a single number for each date in the time series, which is the closing price of the Dow Jones Industrial Average. When shown in a report, the attribute will appear as a list of numbers, next to the appropriate date like this.

01/04/2000   10997.93 
01/05/2000   11122.65 
01/06/2000   11253.26 
01/07/2000   11522.56 
01/10/2000   11572.20

An example of a computed time series is “Close of DJIA / Close of SPX”. This attribute will yield a single number for each date both DJIA and SPX were active. Note that since this computed time series is composed of two attributes, it is implied that it could have been composed of two more complex attributes, such as the following. “(Close of DJIA / Close of SPX) * 100”. Here we are using an attribute derived from a constant (100), as well as the obvious simple attributes.

Additional simple attributes include:

Additional computed attributes include:

Where <attribute> is used, an attribute derived by any means can be substituted.

There are two other important methods of manipulating attributes, which are relevant to the fact that we are looking at time series data. Those are time offset, and time units, known here as attribute units.

<attribute><time offset>

Time offset refers to some point relative to the current observation time. Some examples are 1 day ago and 1 day later. These statements can be used to modify an attribute, yielding a statement such as “Close of DJIA 1 day ago”, or “Close of SPX 1 day later”. These time offsets are denoted <time offset>. So the general statement is <attribute> <time offset>. This combination of attribute and time offset resolves to an attribute. This capability allows the statement (Close of DJIA – Close of DJIA 1 day ago), returning the difference in the closing price of DJIA from yesterday to today.

Some examples of time offset attributes:

  • High of US 1 day ago

  • Volume of DELL 1 week ago

  • DistToEarth of MOON 1 month later

  • High of IBM 1 unit ago – Low of IBM 1 unit ago

  • Cash of GC 3 days ago – Close of GC 3 days ago

<attribute unit><attribute>

Attribute units refer to the time granularity of the attribute in question. Some examples are hourly, daily, weekly, monthly. This syntax yields statements such as “The hourly Close of DJIA”, and “The Weekly High of DJIA”. When used in complex attributes we see statements such as (The weekly High of DJIA – The Daily Close of DJIA). For further explanation of attribute units syntax see the XMIM User Guide .

Attributes with modified attribute units:

  • 10 minute High of US

  • 1 hour High of US

  • The daily High of US or 1 day High of US

  • The Weekly Volume of DELL or 1 week Volume of DELL

  • The Monthly High of IBM or 1 month High of IBM

The fully modified attribute can be generalized to yield the following form <attribute units> <attribute> <time offset>.

Complex attributes:

  • (The daily Close of US – The weekly Low of US 1 week ago) / ( The weekly High of US 1 week ago – The weekly Low of US 1 week ago)

    Which indicates where today’s close is in comparison to last weeks range.

  • 10 minute Close of US – The Daily 10 day average of Close of US

    Which compares the 10 minute close to the 10 day average of the daily bars.

Variables as Attributes

Variables as attributes deserve a special note. Variables can be assigned to and evaluated with the MIM language for use as counters and flags. Assignment will be handled in the section on conditions, but it should be noted here that while a variable can be manipulated like an attribute there are some special considerations to keep in mind. Primary is the fact that while you can offset a variable in time (mvVariable 1 day ago) the value returned will be whatever the value is currently. To understand this, assume that the value is stored in a single memory register, or one-dimensional array. No matter how the value is offset, it will always be the value that is currently in memory.

Repeating Attributes

Previous-Current-Next PeriodP
  • Repeated for the [previous n <condition>] to [next n <condition>]

  • Repeated for the previous 10 to next 10 days

  • Repeated for the previous 1 and current day

  • Repeated for the current and next 11 days

Period
  • Repeated for <condition>

  • Repeated for 1 week

  • Repeated for the entire week

  • Repeated for 1 == 1

Repeat From-To
  • Repeated from <time offset> to <time offset>

Repeat For...To...By...
  • Repeated for <variable> from w to x by y

In Date/Time Condition
  • Repeated <xx><date condition | time condition>

  • Xx = in, by, before, after, since

  • Subset of conditions = date & time conditions,