System Settings and Output Options

The Options menu contains commands which let you control the default behavior of XMIM. The Option functions allow you to set your preferences and customize many features of the XMIM system for your own environment. Each set of preferences is grouped together according to the area of the program affected by its settings.

System Setting Options

Execution Units

XMIM's execution units controls the execution of your query. When you execute a query, XMIM tests the WHEN-condition statement for every unit of time specified in the Execution Units window. If it finds a match, the data specified in the SHOW-Attribute statement is displayed.

XMIM defaults to a 1 Day or daily execution setting unless otherwise reset within this window. The default setting works well when you are looking at daily, weekly, monthly or quarterly data series; however, if you are interested in examining intraday price patterns, it is better to set the Execution Units to an intraday frequency.

To change the execution units, simply select Options > Execution Units from the menu bar or select the Execution Units button from the toolbar. Within the Execution Units window change the default settings, 1 Day, to any period of your choosing by typing your number in the text field and selecting the associated period from the pull down menu. XMIM will check the units set locally in the query. If it has not changed, the system then checks the global attribute units (global attribute units are set from Attribute Units window by selecting Options>Attribute Units from the menu bar). Again, if not set explicitly, XMIM will take the units specified in the Execution Units window. If this option has not been changed, the system default of Daily units will be the time period in which the query will be executed. In the following example, if Execution Units are set to Daily (the system default), we will not receive any answers. This is because XMIM is testing the condition's daily high and daily low of SP. However, if we set Execution Units to 15 minutes, the query is executed in tick mode such that the highs and lows are tick highs and lows, not daily highs and lows. The database is then tested every 15 minutes to see if both the WHEN conditions are true. Therefore, we will receive one graph for every 15 minutes when the condition is met.

Example:

   SHOW 
     1: The 15 minute BAR of SP 
        repeated from 2 days ago  to 2 days later  
   WHEN 
       High of SP is at least 365 
     AND 
       Low of SP is at most 360 once later in the day 

The same bar chart will be displayed for the same day regardless of the time; hence, the four identical graphs for October 10 in the example above.

Example:

In the next example, we wish to see the spread of Live Hogs to Pork Bellies from November through February for every year. For this example, set your Execution Units to 1 Year or yearly. When graphed, the following query will display one graph per year as opposed to the one graph per day if we defaulted to daily execution.

   SHOW 
     1: Close of LH - Close of PG 
        repeated from November to February 

Attribute Units

When selected from the Options menu, Attribute Units sets the time period units which will be used for all query statements within your query (SHOW attribute as well as WHEN condition left and right attribute statements). If you wish to execute the query with the default time periods and/or use the same time period for all or most attributes and wish to avoid setting the time period for each attribute this option is quite useful.

To change the attribute units, simple select Options> Attribute Units from the menu bar. Within the Attribute Units window change the default settings, 1 Day, to any period of your choosing by typing your number in the text field and selecting the associated period from the pull-down menu.

Example:

   SHOW 
     1: Close of US - Open of US 
   WHEN 
       Date is after 5/15/98 
     AND 
       Close of US is more than Open of US   

If you wanted to see the spread between hourly close and open of the 30-year US Treasury Bond Futures contract whenever the hourly bar of the contract closes up, we would change the Attribute Units under the Options menu of the menu bar to 1 Hour. In addition, because one of our attribute statements is located within the WHEN condition, in order to have XMIM check the condition hourly it is also necessary to change the Execution Units to 1 Hour. If the execution units are not changed to 1 Hour, the query only checks the last hourly bar of the day.

Execution verses Attribute Units

Attribute units are used to specify the frequency of an attribute, for example Close of IBM. The attribute units can be set directly on the attribute (enter a symbol name then select the Attribute Unit icon), resulting in an attribute such as the 10 minute Close of IBM. It can also be set globally in the Attribute Units window (select Options>Attribute Units from the menu bar). The global setting will be used for any attribute that does not set its units directly.

Execution units are used to specify the frequency at which the query conditions are tested. In a simple SHOW-WHEN query, this means how often the condition in the WHEN is tested. The execution units are set in the Execution Units window (select Options>Execution Units from the menu bar).

Confusion often arises when the attribute units and execution units are set to different values. To understand what is happening, consider testing a market condition by hand. You have a charting service, and on a regular basis, you check for a certain pattern.

Suppose you subscribe to a weekly charting service. That is, every Friday you get a new chart, and the chart has one bar per week. Clearly, it is silly to look for your pattern every day, since the chart changes only on Fridays. This is a good rule of thumb: Do not use attribute units that are larger than the execution units (larger as in weekly is larger than daily).

Now, suppose your charting service is daily, but you only look at the chart once a week, say Friday. In this case, it's possible that the condition you are looking for (say an island reversal) does not occur on the Friday, but it did occur on the Tuesday of the week. Unfortunately, since you only checked on Friday, you missed a trading opportunity. This suggests another rule of thumb: Do not use attribute units that are smaller than the execution units.

Combined, our rules of thumb mean this: Always use the same value for attribute units and execution units. This is sound advice. But, you may ask, why have attribute units at all? It turns out that it is sometimes useful to mix units, but advanced MIM users should only attempt this.

When would an advanced user wish to mix units? One place where this makes sense is when a low-frequency attribute (e.g., monthly) is used in a condition that also tests daily data. For example, consider this condition:

    WHEN
      DJIA crosses above monthly High of DJIA 1 month ago  

When this condition is tested in daily mode, each day the value of DJIA is tested against the previous month's high. An important feature of this query is that the monthly attribute is compared against a daily attribute; in effect, the condition itself is daily, even though part of it is monthly. In this way, our first rule of thumb is violated in letter but not in spirit.

Another place where mixing units makes sense can be seen in the following query:

    %exec.units: yearly
    SHOW
        1: The daily BAR of DJIA
    WHEN
        1 calendar year percent_move of Close of DJIA 1 year ago is more than
        1 calendar year percent_move of Close of DJIA
      AND
        Date is after 1980

This query executes in yearly mode. The condition is true in those rare years that the DJIA ends lower than the previous one. Each of those years, the query asks for that year's daily graph of the DJIA. This query violates the second rule of thumb, by using daily attribute units on a yearly query. Again, however, the violation is strictly to the letter of the rule, and not its spirit.

Changing units gives answers for the future

Consider the following query executed with the execution units set to weekly:

   SHOW 
     1: DJIA 
     2: percent_move from today to 1 week later  of DJIA  
   WHEN 
       Date is 5/_/98 

When this query is run on 5/13/98, a Wednesday, it gives the following answers:

      Date   Day               1                2        
 
05/01/1998   Fri         9147.07           -1.005 
05/08/1998   Fri         9055.15            1.177 
05/15/1998   Fri         9161.77              ??? 

This looks wrong, because there is a row for 05/15/1998, and it's only 5/13. So, how does the system get data for 5/15? Well, the answer is simple. We are executing in weekly mode. The MIM aggregates each week's worth of values into a single number. So, the values for the week 5/4/98-5/8/98 are grouped together into the single value 9055.15. Since the MIM uses the ending time of the period for time-stamping purposes, it prints this value with Friday's date. But notice it is really the value for the entire week. Similarly, the MIM lumps together all the data for the week 5/11/98-5/15/98 and gives it the 5/15/98 timestamp. As it turns out, there are only two values during that week, namely Monday's and Tuesday's. This is a partial week, but the MIM treats it like a regular week. Hence, the value of 9161.77.

Something else looks wrong, however. How about the second column? On 5/8/98, it says the percent move from 5/8 to a week later is 1.177. But, since a week later is 5/15/98, and today is only 5/13, how does it know? The answer is the same as in the previous paragraph. The MIM has a value for 5/15/98, because it is using weekly data, and there is data for that week, even if only partial data for the week. This is one place where it would be fruitful to use daily attribute units, so that the MIM can see the difference between Tuesday and Friday.

Execute Options

From the menu bar, select Options>Execute Options or select the Execute Options icon from the toolbar to open the Execute Options window. The primary function of the Execute Options window is to customize the execution of query answers.

It is possible to view the execute option settings in a query. To do this, select Options>User Preferences from the menu bar and check the box for Show Execute Options in Query Edit Window. With this box checked any Execute Options settings that are not the default will display in the Edit pane for the query.

There are two tabs in the Execute Options window: Report and Order. The options listed under the Report tab control how the output report will display. The options listed under the Order tab control the output for an Order query.

Execute Options Window Save Options

Most of the options in the Execute Options window are check boxes. Checking a box will select or activate an option. Unchecking a box will deactivate an option. Selecting OK will accept the changes and close the window. The following describes the buttons listed at the bottom of the Execute Options window.

OK Button

Selecting OK will accept any changes and close the window. These changes will be used for the current XMIM session. The changes will not be used the next time XMIM is restarted.

Cancel Button

Select the Cancel button to close the window. The changes will not be applied.

Save as Default Button

After changing any XMIM settings, select the Save as Default button. The selected settings will now be used. These settings will also be used the next time XMIM is restarted.

Restore User Default Button

Select the Restore User Default button to reset the settings to the Save as Default settings.

Restore Factory Default Options Button

Select the Restore Factory Default Options button to reset any changes in the Execute Options window back to the system defaults.

Report Tab

The following options control the appearance of the XMIM report.

Report Statistics Pane

The Report Statistics pane in the Execute Options window allows summary information (Sum, Average, Standard Deviation, Highest, Lowest, Count Occurrences, etc.) pertaining to your query answers to be displayed in the executed report.

Sum - The sum total of the values returned in the answers. This option is not checked by default (%exec.sum:NO).

Average - The average of all the values in the answers. This option is checked by default (%exec.average:YES).

Average Positive - The average of the positive values in all of the answers. This option is checked by default (%exec.averagepos:YES).

Average Negative - The average of the negative answers to the query. This option is checked by default (%exec.averageneg:YES).

Percent Positive - The number, as a percentage of the total number of occurrences, of positive answers to the query. This option is checked by default (%exec.percentpost:YES).

Percent Negative - The number, as a percentage of the total number of occurrences, of negative answers to the query. This option is checked by default (%exec.percentneg:YES).

Standard Deviation - This measures the mean deviation from the average of the answers. This can be a particularly valuable tool to interpret the answers to the query. For example, if the average return on a query is 3%, but the Standard Deviation on that is 10%, then it indicates a poor signal. It is best to have a standard deviation that is lower than the absolute value of the average value returned in the query. This option is checked by default (%exec.stddev:YES).

Highest - The highest of all the query answers. This option is checked by default (%exec.highest:YES).

Lowest - The lowest of all the query answers. This option is checked by default (%exec.lowest:YES).

Z Stat - The Z-score of the results. This measures the goodness of the average. This option is checked by default (%exec.zstat:YES).

Variance - This is related to the standard deviation calculation - which is actually the square root of the variance. This option is checked by default (%exec.variance:YES).

Count Occurrences - The total number of events which met the conditions found in the WHEN part of the query. This option is checked by default (%exec.count:YES).

Deselect Above Options - Select this check box to check or uncheck all the check boxes in the Report Statistics pane.

Report Format Pane

The Report Format pane of the Execute Options window shows options pertaining to all tabulated answers, such as Show Headings and Day Of Week:

Show LET Statement Declaration - When this option is checked (default) the Let statement displays at the top of the Report.

Show Headings and Day Of Week - These options allow you to specify whether or not you wish the dates and column labels (created by the system, but user modifiable) to display on your report. The Show Headings (%exec.headgings:YES) option and Day of Week (%exec.dayofweek:YES) option are both checked by default.

Number Each Result - Each answer is numbered from 1 to the total number of answers to the query. This option is unchecked by default (%exec.numberresults:NO).

Summary Report Only - When this option is selected (the box is checked) only the summary results from the query are reported, that is, none of the individual answers will be included in the report. This option is unchecked by default (%exec.summaryreportonly:NO).

Page Break - On the report, when the Page Break option is checked (activated) the report will have 66 lines per page. You can change how many lines display by changing the number in the Lines Per Page option field. The Page Break option is unchecked by default (%exec.pagebreaks:NO).

Lines per page - When the Page Break option is checked the report displays with the designated lines per page. The Lines Per Page option by default is set to 66 (%exec.linesperpage:66).

Precision - This option allows you to print up to 7 digits to the right of the decimal place in the output of the query. The default setting for the precision is 4.

The user may also control the precision of the query output by entering the following line at the top of a query: %exec.precision: number

where number is a number between 1 and 7.

Example: %exec.precision:7

Date Formats - There are 11 different date formats you can select for displaying the dates in your report. Select a date format from the pull-down list (all of which represent January 23, 1974). The default date format is 01/23/1974 (%exec.date.format:"mmddyyyy").

01/23/74(%exec.date.format:"mmddyy")
01/23/1974(%exec.date.format:"mmddyyyy")
740123(%exec.date.format:"yymmdd")
19740123(%exec.date.format:"yyyymmdd")
Jan 23, 1974(%exec.date.format: "MMdd_yyyy")
January 23, 1974(%exec.date.format: "MMMMdd_yyyy")
23/01/74(%exec.date.format: "ddsmmsyy")
23/01/1974(%exec.date.format: "ddsmmsyyyy")
23-Jan-74(%exec.date.format: "dd_MM_yy")
23-Jan-1974(%exec.date.format: "dd_MM_yyyy")
23-January-1974(%exec.date.format: "dd_MMMM_yyyy")

Time Formats - There are 6 different time formats you can select for displaying the time in your reports. The following time formats are available from the pull-down list (all of which represent 3:00 pm). The default time format is 03:00 pm (%exec.time.format: "hh_mm_am").

03:00 pm(%exec.time.format: "hh_mm_am")
03:00 PM(%exec.time.format: "hh_mm_AM")
0300 pm(%exec.time.format: "hhmm_am")
0300 PM(%exec.time.format: "hh_mm_AM")
15:00(%exec.time.format: "hh_mm")
1500(%exec.time.format: "hhmm")

Units Ending Date - This parameter lets you set the date on which the units end when referring to calendar units. This option is set to 12/31/2050 (%exec.unitsfrom.date: 12/31/2050) by default.

Units Ending Time - This parameter lets you set the time on which the units end when referring to calendar units. This option is set to 12:00 AM (%exec.unitsfrom.time: 12:00 am) by default.

Delimiters - This option lets you determine how the answers are formatted on a line. A delimiter is a character that separates different values on a line of text from one another. This option is set to Spaces (%exec.delimiters: space) by default.

The following describes the choices.

  • Spaces - puts one or more spaces between answers.

  • Commas - puts a comma between answers.

  • Tabs - uses the <Tab> character to separate answers.

Report Title - Enter a title for your report. As this is strictly a text field, you may use any of the characters on your keyboard, including spaces. The text you enter into this box will be printed at the top of each set of answers generated by your query. If you have multiple iterations using a LET statement, each new report will begin with this text.

Footer - Enter text that will display at the bottom of each page of the report.

Report Manipulation Pane

This pane of the Execute Options window allows manipulation of the report such as sorting, filling Holiday NaNs etc.

Sort Ascending Date - Sorts the answers in date order in ascending (earliest to latest) order. The default is to sort by ascending date (%exec.sortascending: YES). The %exec.sortascending option is only applicable to standard reporting. When using enhanced reporting, click the header to choose the direction of the sort for that particular column.

Sort Descending Date - Sorts the answers from latest to earliest order (%exec.sortascending: NO).

Process NaN Values - When the Process NaN Values option is checked (%exec.process_nan_values: YES) which is the default then a NaN value is processed by the query engine just as other values are. The option %exec.process_nan_values: NO is a performance option for offset type queries that eliminates some processing of NaN values. In a query where a user might want to, for example, count back a number of values it will make a difference whether the NaN value is processed or not.

The following query demonstrates how the Process NaN Values setting works:

   SHOW 
     1: Close of CL 3 values ago  
     2: Close of CL 
   WHEN 
       Date is from 8/25/2004 to 9/10/2004

Results with Process NaN Values turned off (unchecked):

Figure: Process NaN Values Turned Off


Results with Process NaN Values turned on (checked):

Figure: Process NaN Values Turned On


If Process NaN Values is activated (set to YES) in the query then the 9/6/2004 value is not NaN. If Process NaN Values is set to NO in the query then the 9/6/2004 value is NaN.

Missing Data NaNs - These options allow the same choices as Holiday NaNs. The difference between a Holiday NaN and a Missing Data NaN is that the Holiday NaNs are registered as holidays by dint of the holiday files included with the database. This option is set to Fill NaN by default. The following describes each option choice:

  • Fill NaN - Insert NaN values where there is no data. This is the default setting.

  • Fill Forward (%exec.missingdatananfill: Fill_Forward) - Takes the last valid value in the series and copies it forward, eliminating the NaNs until the next valid value occurs.

  • Fill Backward (%exec.missingdatananfill: Fill_Backward) - Takes the first valid value after a run of NaNs and fills the value back in time to the previous valid value. This is a potentially dangerous option to use, because it puts information into the "past" that wouldn't have been known until some time in the future.

  • Fill Interpolate Linear (%exec.missingdatananfill: Fill_Interpolate_Linear) - This command creates synthetic values for the span of NaN values based on the last known value and the next known value by creating linear interpolated values between them.

    Formula:

    where:

    • x1 = last known valuex2 = next known value

    • w1= the number of days from x1 to the missing date

    • w2 = the number of days from x2 to the missing date

    Example:

    Without Fill Interpolate Linear:

    Date        Day      1
    09/02/2001  Sun   11.7500
    09/03/2001  Mon     NaN
    09/04/2001  Tue     NaN
    09/05/2001  Wed     NaN
    09/06/2001  Thu     NaN
    09/07/2001  Fri   17.0000

    With Fill Interpolate Linear:

    Date       Day       1
    09/02/2001 Sun    11.7500 --- x1
    
    09/03/2001 Mon 12.8000
    09/04/2001 Tue 13.8500
    09/05/2001 Wed 14.9000
    09/06/2001 Thu 15.9500
    09/07/2001 Fri 17.0000 --- x2

    For 9/03/2001

    x1 = 11.75
    x2 = 17
    w1 = 1 (Number of days the missing date is from the first value)
    w2 = 4 (Number of days the missing date is from the second value)
    
    9/03/2001 = (11.75*4 + 17*1)/5 = 12.8
    9/04/2001 = (11.75*3 + 17*2)/5 = 13.85
  • Fill Interpolate Geometric (%exec.missingdatananfill: Fill_Interpolate_Geometric) - This command creates synthetic values for the span of NaN values based on the last known value and the next known value by creating geometric interpolated values between them.

    Formula:

  • Fill Interpolate Logarithmic (%exec.missingdatananfill: Fill_Interpolate_Logarithmic) - This command creates synthetic values for the span of NaN values based on the last known value and the next known value by creating logarithmic interpolated values between them.

    Formula:

  • Fill Nearest (%exec.missingdatananfill: Fill_Nearest) - This command fills Saturday with Friday and fills Sunday with Monday.

Holiday NaNs - XMIM uses a regular time calendar array organization scheme. This means that when there is a market holiday on a normal workday, or if the exchange closes trading early on the day before a holiday (or if there is simply no trading in a given minute on the floor) there are gaps in the data stream which are signified by a special value called a NaN. This acronym stands for "Not a Number" in the mathematics of computers. XMIM lets you decide how the system is to treat NaNs in the data series that are due to official exchange holidays.

  • Fill NaN - Insert NaN values where there is no data. This is the default setting.

  • Fill Forward (%exec.holidaynanfill: Fill_Forward) - Takes the last valid value in the series and copies it forward, eliminating the NaNs until the next valid value occurs.

  • Fill Backward (%exec.holidaynanfill: Fill_Backward) - Takes the first valid value after a run of NaNs and fills the value back in time to the previous valid value. This is a potentially dangerous option to use, because it puts information into the "past" that wouldn't have been known until some time in the future.

  • Fill Interpolate Linear (%exec.holidaynanfill: Fill_Interpolate_Linear) - This command creates synthetic values for the span of NaN values based on the last known value and the next known value by creating linear interpolated values between them.

    Formula:

    where:

    • x1 = last known valuex2 = next known value

    • w1= the number of days from x1 to the missing date

    • w2 = the number of days from x2 to the missing date

    Example:

    Without Fill Interpolate Linear:

    Date        Day      1
    09/02/2001  Sun   11.7500
    09/03/2001  Mon     NaN
    09/04/2001  Tue     NaN
    09/05/2001  Wed     NaN
    09/06/2001  Thu     NaN
    09/07/2001  Fri   17.0000

    With Fill Interpolate Linear:

    Date       Day       1
    09/02/2001 Sun    11.7500 --- x1
    
    09/03/2001 Mon 12.8000
    09/04/2001 Tue 13.8500
    09/05/2001 Wed 14.9000
    09/06/2001 Thu 15.9500
    09/07/2001 Fri 17.0000 --- x2

    For 9/03/2001

    x1 = 11.75
    x2 = 17
    w1 = 1 (Number of days the missing date is from the first value)
    w2 = 4 (Number of days the missing date is from the second value)
    
    9/03/2001 = (11.75*4 + 17*1)/5 = 12.8
    9/04/2001 = (11.75*3 + 17*2)/5 = 13.85
  • Fill Interpolate Geometric (%exec.holidaynanfill: Fill_Interpolate_Geometric) - This command creates synthetic values for the span of NaN values based on the last known value and the next known value by creating geometric interpolated values between them.

    Formula:

  • Fill Interpolate Logarithmic (%exec.holidaynanfill: Fill_Interpolate_Logarithmic) - This command creates synthetic values for the span of NaN values based on the last known value and the next known value by creating logarithmic interpolated values between them.

    Formula:

  • Fill Nearest (%exec.holidaynanfill: Fill_Nearest) - This command fills Saturday with Friday and fills Sunday with Monday.

Automatically Fill Sparse Data - By default this option is checked (%exec.auto.fill.sparse.data: YES). This option allows the user to turn off the forward fill that is automatically applied to symbols with sparse data. For example, if you have a symbol that only has one day of data per month then that symbol is referred to as having “sparse data”. Since the default is to fill forward on sparse data, typically you see the same number repeated everyday for the whole month. If you wish to only see data one day a month, then uncheck the check box.

Use Stream Semantics - This option is used with millisecond data. When this option is activated (box is checked) only the values entered into the MIM are used for query calculations. When working with millisecond data, checking the box for Use Stream Semantics (%exec.use.stream.semantics: YES) will speed processing time. This option is not checked (%exec.use.stream.semantics: NO) by default.

Force 7 Day Trading Pattern - When you have a query that contains a five day series along with a seven day series, this option allows the weekend value of the 5 day series to be filled either forward or backwards. This option is unchecked by default (%exec.force.trading.pattern: NO).

Number days per week - This changes the calendar of the data returned to either a 5 day or 7 day calendar. The “N/A” setting (default setting) uses the default calendar of the time series. The following shows the choices from the pull-down menu:

  • NA (default setting)

  • 5 (%exec.num_days_per_week: 5)

  • 7 (%exec.num_days_per_week: 7)

Union Date - When this option is turned on (box is checked), the union of two dates is applied. For example, consider the date range for A+B where: “A” ranges from January to June and “B” ranges from March to September. With the Union Date option turned on, the resulting range will be from January to September. The default is to have Union Date unchecked (%exec.uniondate: NO) and the intersection of the dates will be applied. The resulting intersection for this example would be March to June.

Union Time - When this option is activated, the union of two times is applied. For example, consider the date range for A+B where “A” ranges from 8:00 a.m. to 1:00 p.m. and “B” ranges for 10 a.m. to 3:00 p.m. With the Union Time option checked, the resulting range will be from 8:00 a.m. to 3:00 p.m. The default is to have Union Time option unchecked (%exec.uniontime: NO) and the intersection of the times will be applied. The resulting intersection for this example would be 10:00 a.m. to 1:00 p.m.

Strict Variable Names - This option provides a method for distinguishing between variable and relation names in SHOW statements. If this option is activated (box is checked) then the user can use either a $ or @ qualifier in front of a name to distinguish that it is a variable and not a relation name. This option is unchecked (%exec.strictvariablenames: NO) by default.

For Example:

   %exec.strictvariablenames: YES
   SHOW
     1: $NG_XYZ
   WHEN 
     Date is 3/15/2005

Undef Variable Value - This option sets the value for an undefined variable. The default value is set to 0.0 (%exec.undef_variable_value: 0.0).

For example:

   SHOW
     1: Xvar  

The Xvar value is “0.0”.

If the Undef Variable Value is changed to NaN:

   %exec.undef_variable_value: NaN
   SHOW
     1:Xvar  

The Xvar value is “NaN”.

Disable Backadjustment - If you use a future continuation series such as YP (US Dollar British Pound futures) in a query where the SHOW statement references values calculated over a period between two points in time and that period between two points crosses over the rollover data of the futures commodity, the MIM will always backward adjust the prices across the rollover unless you uncheck the Backward Adjustment option. This option is unchecked (%exec.disable_backadjustment: NO) by default.

Example:

   SHOW 
     1: 10 day move of YP  
   WHEN 
       Date is 2 days after  YP  expiration_day 
     AND 
       Date is within 5 years 

Figure: Disable Backadjustment Example


The difference between the 2 results on March 19, 2003 is 0.0287 – 0.0481 = -0.0194 (see above). This difference represents the adjustment for the rollover that occurred on March 17, 2003 (see below) when the prompt contract (March 2003) was 1.5808 and the next contract out (June 2003) was 1.5614. The adjustment process subtracts this rollover difference (1.5808 – 1.5614 = -0.0194) from the values prior to the rollover.

Figure: Back Adjustment Example Continued


For more information on how contracts are adjusted in futures rollovers, see .the Rollovers document.

Display - Display is a particularly useful function that will permit certain results to be dropped from display. For example, if first adjacent value were selected from the menu, only the first occurrence that meets the WHEN Condition criteria will be displayed. This is a useful method to isolate the move or percent move from certain dates identified for trade entry.

  • All Adjacent Values - Does not limit the answers - all occurrences are returned. This option is selected by default (%exec.skip:NO).

  • First Adjacent Value - If there are runs of answers in adjacent time periods, for example if the same condition is true for several days in a row, this option, if selected (%exec.skip:YES), will show only the first answer in the run.

  • Last Adjacent Value - If there are runs of answers in adjacent time periods, for example if the same condition is true for several days in a row, this option, if selected (%exec.skip: LAST), will show only the last answer in the run.

  • First Value In - This option (%exec.skip: FIRST <number> <time unit>) allows you to specify that only the first answer that has happened within some window of time. Specify the time in the two fields below First Value In (e.g., 1 Day, 2 Weeks, 3 Months etc.)

  • Last Value In - This option (%exec.skip: LAST <number> <time unit>) allows you to specify that only the last answer that has happened within some window of time. Specify the time in the two fields below First Value In (e.g., 1 Day, 2 Weeks, 3 Months etc.)

Execution Range Pane

Begin Date - The results that are posted will be limited by the date range entered in the Execution Range. Enter the date that you want the results to start from. Either enter a date in the format mm/dd/yyyy (%exec.start_date: "mm/dd/yyyy") or use the Calendar button to choose a date. This option is blank by default.

End Date - The results that are posted will be limited by the date range entered in the Execution Range. Enter the date that you want the results to end. Either enter a date in the format mm/dd/yyyy (%exec.start_date: "mm/dd/yyyy") or use the Calendar button to choose a date. This option is blank by default.

Order Tab

From the menu bar, select Options>Execute Options and select the Order tab. This window is used to set reporting and query calculation options for Order queries. This window, along with the Execution and Attribute Unit settings, controls how the query is calculated. The items listed under the Trade and Entry & Exit panes control query calculation. The Report Detail pane lists options for outputting reports (i.e., Select whether a summary, trade or equity report is printed). The Report Statistics pane has entries for controlling how the statistics are reported. See the Profit/Loss User Guide for examples on using the Profit-Loss option settings as well as definitions for the statistics listed under the Trade Statistics grouping.

Trade Pane

Commission - The commission option can be specified in two ways:

  • Dollar amount - (%execpl.commission: <number>) Use the $ symbol (e.g., $50.00). Per Trade is the default. You may also select Per Contract (%execpl.commission_category: PER_CONTRACT) or Per Share (%execpl.commission_category: PER_SHARE).

  • Percentage of price - (%execpl.commission: <number>) (%execpl.commission_pct: YES) Use the % symbol after the amount (e.g., 0.1%). You may also select Per Contract (%execpl.commission_category: PER_CONTRACT) or Per Share (%execpl.commission_category: PER_SHARE).

The total commission is reported in the Final Stats section of the Summary Report.

Slippage - The slippage can be specified in two ways:

  • Dollar amount- (%execpl.slippage: <number>) Use the $ symbol (e.g., $50.00).

  • Percentage of price - (%execpl.slippage: <number>) (%execpl.slippage_pct: YES) Use the % symbol after the amount (e.g., 0.1%).

Starting Equity - The starting equity option (%execpl.starting_equity: <number>) allows one to enter in numbers for the initial equity. These numbers will be used in the calculation of the average period statistics.

Margin Ratio - The margin ratio option (%execpl.margin_ratio: <number>:<number>) allows one to put in margin ratios, which may not have an affect on ones trades but will have a very large affect on statistics that are affected by return.

Entry & Exit Pane

Rollover - XMIM provides four options to deal with futures contract expiration and rollover:

  • None This option, the system default, treats each contract as a continuation of the previous contract. No adjustments are made to the trade or the data to address any premiums or discounts from contract to contract.

  • Exit If this option is selected (%execpl.rollover: EXIT_ROLL), XMIM exits all active trades and orders at the end of the contract.

  • Re-entry Number of Contracts With this option selected (%execpl.rollover: REENTRY_NUM_CONTRACTS), XMIM exits all active trades and orders at the end of the expiring contract and re-enters them for the nearest active contract. The rollover trades are treated as separate from the trades in the expiring contract and trigger their own commission and slippage.

  • Re-entry Dollar If this option is selected (%execpl.rollover: REENTRY_DOLLAR) and one is holding 2 contracts trading at $100, it exits those and buys $200 worth of the next contract (e.g. 2.1 contracts if the back is trading at $95).

Exit on Reverse Signal - This option, checked by default (%execpl.exit_on_reverse: YES), determines whether the system exits from all positions in a particular security when an opposite trade signal is generated. If this option is checked, a long signal will cause all shorts to be exited (and vice versa).

Compute Stop Loss/Profit on Entry - This option (checked by default) determines when stop losses and profit objectives are calculated: on order placement or trade execution. If this option is checked (%execpl.exit_on_reverse: YES), stop losses and profit objectives are calculated when the trade is actually executed. If this option is not checked (%execpl.exit_on_reverse: NO), these values are calculated when the order is placed.

Maintain Positions Overnight - If one is designing a strictly day trading system in which all trades are exited at the end of the day, this option conveniently handles the end-of-day exit. With this option unchecked (%execpl.keep_overnight: NO), one does not need to specify, in the query itself, rules to exit at the end of the day. On the other hand, for trades that do not necessarily exit at the end of the day, this option must be checked (%execpl.keep_overnight: YES) to allow overnight positions. This option is checked by default.

Blocks Active Only Once - This option determines how additional signals generated from an order block are treated. With this option checked (%execpl.block_active: YES), additional signals are ignored and no orders are generated. In fact, the block is not even evaluated until the trades generated from the block are exited. If, however, this option is unchecked (%execpl.block_active: NO), additional orders are generated every time the WHEN condition is satisfied. This option is unchecked by default.

Only One Block Active at a Time - This option determines how the system behaves when orders from more than one block are generated at the same time (i.e., WHEN conditions from more than one order block being satisfied in the same Exec unit). If this option is unchecked (%execpl.one_block: NO), XMIM checks each order block and places orders from all blocks that satisfy the conditions. If, on the other hand, this option is checked (%execpl.one_block: YES), then only one order will be placed from the entire query during the exec unit. The order placed will be from the first block that satisfies the WHEN conditions. This option is unchecked by default.

Compute Equity as NAV - The P/L equity statistics can be computed as Net Asset Value (NAV), by checking this option (%execpl.equity_nav: YES). This option is unchecked (%execpl.equity_nav: NO) by default. The formula for total NAV is given by:

Where the product is over all periods in the computation (e.g., months) and denotes the return over the period, given by:

where and denote the beginning and ending equity of the period. That is, is the value of all open shares at the start of the period plus any capital inflows into the portfolio, and is the value of the entire portfolio at the end of the period.

The closed and open NAV are approximations to the above formula, using only the corresponding positions in the portfolio. Open NAV uses the same formula as NAV; however, the compounding effect of closed trades that overlap the currently open trades is not completely eliminated, so this value is only an approximation to the true formula. The formula for closed NAV is given by:

In general there is no immediate relationship between the closed NAV, open NAV and total NAV.

Report Detail Pane

Report Title - Enter a title (%execpl.title: "user defined") for the report that displays at the top of each page of the report.

Report every - Use the pull-down menus to select the global unit settings for the report. The default setting is 1 Units. The following lists the time unit choices:

  • Units (This is the default.)

  • Milliseconds (%execpl.report_units: <number> millisecond)

  • Seconds (%execpl.report_units: <number> second)

  • Minutes (%execpl.report_units: <number> minute)

  • Hours (%execpl.report_units: <number> hour)

  • Days (%execpl.report_units: <number> day)

  • Weeks (%execpl.report_units: <number> week)

  • Months (%execpl.report_units: <number> month)

  • Quarters (%execpl.report_units: <number> quarter)

  • Years (%execpl.report_units: <number> year)

  • Calendar Days (%execpl.report_units: <number> calendar day)

  • Calendar Weeks (%execpl.report_units: <number> calendar week)

  • Calendar Months (%execpl.report_units: <number> calendar month)

  • Calendar Quarters (%execpl.report_units: <number> calendar quarter)

  • Calendar Years (%execpl.report_units: <number> calendar year)

Digits - The Digits option (%execpl.digits: <number>) determines how many digits the answers output to. The default is 7 digits.

Decimal Places - The Decimal Places option (%execpl.decimal: <number>) determines the decimal place setting. The default is 2 decimal places.

Print Summary Report - Check the Print Summary Report option to generate a summary report when the Report button is selected. The summary report presents most of the statistical calculations for the query. It covers simple calculations such as percentage of winning trades to complex statistics such as Sharpe ration and ZStat. All the statistics are computed in three ways: combined trades (longs and shorts), long trades, and short trades. See "P/L Report Options" chapter in the Profit-Loss User Guide for definitions for the report calculations. This option is checked (%execpl.print_summary: YES) by default.

Print Trade Report - Check the Print Trade Report option to generate a Trade Report that returns trade-by-trade information when the Report button is selected. This report gives a detailed account of each trade in the P/L execution including the security traded, entry and exit date/times and prices. It also presents the point and percent moves, as well as the profit in dollar amounts, and the cumulative profit. This option is checked (%execpl.print_trades: YES) by default.

Print Equity Report - By default this option is unchecked (%execpl.print_periods: NO). When this option is checked (%execpl.print_periods: YES) the equity report focuses on the equity curve of the query tested. It prints a period by period account of the equity growth. For each period, it prints the current open, closed, and combined equities, as well as the drawdown and maximum drawdown. The period used by the report can be adjusted in the settings listed under the Report Statistics pane (see below).

Print Reason for Trade - The Print Trade Report can be extended via the Print Reasons for Trade option to include the entry/exit reasons for each trade. This can be very useful when the query has multiple conditions that can trigger trading decisions. This option is unchecked (%execpl.print_reasons: NO) by default.

Skip Equity until First Trade - This option skips the equity until the first trade. This option is checked (%execpl.skip_first: YES) by default.

Report Statistics Pane

Trade Statistics - Many of the statistics depend on a specific time unit, for example Number of Periods, where the result depends on whether periods is weeks, months, etc. The time units to be used in computing the statistics can be set independently for each category, and also globally to affect all the statistics at once. Unless otherwise indicated, all statistics default to units set in Execution Units: i.e., the units used in evaluating the P/L query.

See the "P/L Report Options" chapter in the Profit-Loss User Guide for definitions and formulas of the various statistics calculated in the reports.

Activate Trade Statistics - Checks or unchecks all of the statistics for the designated statistic category.

User Preferences

The User Preferences window (select Options>User Preferences from the menu bar) has two tabs: General and Studies Config.

General Tab

The following panes are accessible from the General tab.

Query Editor Pane
OptionFunction
Use Colored SyntaxThe color red is used for SHOW, WHEN, and LET statements. The color green is used for columns. The color dark blue is used for symbol names. De-select the check box to turn off the colored syntax (the box is checked by default).
Use Line Numbered Query Editor Select the check the box for Use Line Numbered Query Editor to display line numbers in the Edit window for the query. This is useful with long queries when one needs to troubleshoot an error for a specific line number.
Show Execute Options in Query Edit Window With this option selected, the query language for the selected Execute Options will display in the Edit window. You can show the Report options, Order options and the Graphing options. For more information on Execute Options, see the section called “Execute Options”.
Excel Pane

For these options, Excel must be running with a workbook open to receive the data from the application. The following describes the three Excel options:

OptionFunction
Copy Table Results to Clipboard This option allows the user to put the Report results in another application. This option is checked (activated) by default.
Send Paste Command to Excel

This option will paste the results of a Report into an open Excel worksheet.

With only the Send Paste Command to Excel selected it is possible to overwrite content on the opened Excel worksheet. To prevent this, check the Send New Worksheet and Paste Command to Excel option.

Send New Worksheet and Paste Command to Excel Creates a new worksheet in Excel and pastes the results of a Report into the new worksheet.
Report Options Pane

The following Report Options are available:

OptionFunction
Show Query in Report WindowSelect the check box for Show Query in Report Window to have your query display in the Heading field for the report.
Show LET Statement Declaration

LET statement declaration displays in the Header field for the Report.

Substitute Variable Values in Column HeadersSelect the check box to use the variable name as a label and have the column header in the report show the variable name.
Use Enhanced ReportSelect the check box to turn on the Enhanced Reporting feature. Choose a Report Format from the pull-down menu. For more information on each report format, see Analyzing Your Research Results.
Local History Revisions Pane

Use the Local History Revisions setting to specify how large the local history directory can get before files are removed from the directory. You have the option of specifying 1 to 5 MB. For details on using Local History revisions, see the section called “Saving Temporary Revisions with Local History”.

Highlight Color Pane

Select the color you would like for the XMIM highlights. The default color is white. Use the swatch palette or pick a color using the HSB or RGB palettes.

Preview Pane

When you select a color in the Highlight Color pane the color displays in the Preview pane so you can see how the color will look against text.

Online Catalog Config Pane

Check the box if you want to include the Online Catalog in your browser window.

Studies Config Tab

Studies Config Pane

Change the default Time Period value for a study. To change the Time Period double-click in either the Study or Saved Values fields. This will open a Time Period window. In the Time Period window you may change the default value to a new number and the Period setting to a new entry (i.e., Values, Units, Milliseconds, Seconds, Minutes, Hours, Days, Weeks, Months, Quarters, Years, Calendar Days, Calendar Weeks, Calendar Months, Calendar Quarters and Calendar Years).