CMP[n]

Top  Previous  Next

Keyword Description

Companion file

Class

Expression

Where Legal

Resources

Entry Logic

Exit Logic

Initial Size

Resize

(Pre-Category)

Resize

(Category-Level)

l

l

l

 

 

 

Syntax

CMP[n]

Where n is an integer 1-32

Example

Sample code

CMP[12] = CLOSE  ' populate .CMP file field 12

 

Sample code

COL1 = CMP[12] ' reference the value previously stored in a CMP file 

 

ThumbTack white

CMP[1 to 32] can hold numerical data from any source you choose.

Allows your programs to reference any external data previously saved while processing the same market or stock issue. For instance you may want to rank all markets based on some criteria then save the rank for each market (for each day) to a CMP[n] field. Then later you could reference the ranks previously saved to CMP[n] and re-rank, say, the top 20 percentile of those based on some different criteria. This type of 'chain' ranking can be repeated as many times as you like using CMP file to save the intermediate ranking results.

It may be convenient to think of CMP[n] as just another column.  The only difference is that CMP[1 to 32] can hold numerical data from any source you choose, not just the standard price, volume, or open interest data.

When your program  references CMP[n] Mechanica expects to find a file with the extension .CMP in the same sub-directory as the one that holds the price data your program is using.  So, for instance if your program is processing BP and it references CMP[1] Mechanica knows to look in  BP.CMP, field 1 for the currently processing date.

CMP files are also used to hold conversion data for bringing foreign denominated price data to the base currency.

See also:

GBL[n], Forex Conversion