Using Functions to Calculate Values

 

Values in TradingSolutions data series are stored in fields. When you want to take the values in those fields to calculate new values, you create new fields in which to hold those values. For example, if you want to subtract the low price for the day from the high price for the day, you would create a new field to hold the difference between those two values. That new field can be displayed in a chart or used to create other fields.

 

When you create calculated field, you select a function from within TradingSolutions to perform a calculation. Functions take the values from one or more fields, apply some math to them, and produce a new value. Functions can be simple or complex and, as you will see in later sections, new functions can be created easily by combining existing functions.

 

&  For a step-by-step introduction to this topic, see the tutorial called Calculate a Financial Indicator.

Creating a New Calculated Field

To create a new calculated field, open the Create a Field Wizard and select to create a new field to Calculate an indicator or value. This will begin the Calculate a Value Wizard.

 

The Calculate a Value Wizard begins with the Select Alert page, which allows you to select which alert definition to use for this alert. The alert definitions are broken into groups. A brief description of each alert group and definition is displayed when they are selected, helping you to understand what the selection includes.

 

The wizard continues with the Select Inputs page, which allows you to select which inputs to provide to the selected function. Inputs to functions are typically data fields from the data series to which the field is being added; however, they can also be numbers (constant values) or data fields from other data series in the portfolio.

Ä    Note: If a data field is selected from a data series that does not have the same dates or periodicity as the target data series, TradingSolutions will use the last known value as the input. For example, if quarterly data is used for a calculation in a daily data series, the value from the preceding quarter will be used until a new quarter is reached. This holding of values can also be seen when charting values from different data series.

&  For more information on working with multiple periodicities, see Understanding Periodicity.

Ä    Note: If you have selected a function that does not take any inputs, such as date functions, the Select Inputs page will not be displayed.

 

The final page of the Calculate a Value Wizard is the Select Name page. TradingSolutions provides several suggestions for names for the new field based on the function and inputs selected. Any of these names can be used directly from the combo box, or you can enter your own. The name of a field should be something meaningful so that you know what the values in the field are without having to see how they are calculated.

 

&  For more help calculating a value, see the help for the Calculate a Value Wizard.

&  For more help with functions, see Calculating Values and Financial Indicators.