Dundas Chart for Windows Forms
FormulaFinancial(FinancialFormula,String,String,String) Method
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > DataManipulator Class > FormulaFinancial Method : FormulaFinancial(FinancialFormula,String,String,String) Method


formulaName
A FinancialFormula enumeration value that determines the technical analysis or time series formula to be used.
parameters
String expression that is used for one or more formula-dependent parameters.
inputSeries
A string expression consisting of one or more series with optional data point values. Multiple "series:values" should be comma-separated (e.g. "Series1:Y,Series2:Y3"). If a Y-value is not specified the first value (Y) is used.
outputSeries
A string expression consisting of one or more series (with an optional value) that will be used to store the formula data (e.g. "Series1:Y,Series2:Y3"). If the output series does not exist at design-time it will be created at run-time, and use default series properties. If no value is specified along with the series (e.g. "Series1") than the first Y-value of the series will be used.

Applies a financial formula to Y-values of one or more series' data points, using the specified parameter(s).

Syntax

Visual Basic (Declaration)  
Public Overloads Sub FormulaFinancial( _
   ByVal formulaName As FinancialFormula, _
   ByVal parameters As String, _
   ByVal inputSeries As String, _
   ByVal outputSeries As String _
) 
Visual Basic (Usage) Copy Code
Dim instance As DataManipulator
Dim formulaName As FinancialFormula
Dim parameters As String
Dim inputSeries As String
Dim outputSeries As String
 
instance.FormulaFinancial(formulaName, parameters, inputSeries, outputSeries)
C#  
public void FormulaFinancial( 
   FinancialFormula formulaName,
   string parameters,
   string inputSeries,
   string outputSeries
)

Parameters

formulaName
A FinancialFormula enumeration value that determines the technical analysis or time series formula to be used.
parameters
String expression that is used for one or more formula-dependent parameters.
inputSeries
A string expression consisting of one or more series with optional data point values. Multiple "series:values" should be comma-separated (e.g. "Series1:Y,Series2:Y3"). If a Y-value is not specified the first value (Y) is used.
outputSeries
A string expression consisting of one or more series (with an optional value) that will be used to store the formula data (e.g. "Series1:Y,Series2:Y3"). If the output series does not exist at design-time it will be created at run-time, and use default series properties. If no value is specified along with the series (e.g. "Series1") than the first Y-value of the series will be used.

Example

This example demonstrates how to input the High and Low stock values and outputs the Chaikin Oscillator formula.  We make the following assumptions before executing the code sample:

  • Series1 is populated with stock data (High, Low, Open and Close values).
  • Series2 is populated with volume data.
  • Series3 has been added at design-time.
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

' We must create a String expression of comma-separated strings that
' represents input values to pass to the financial formula. In Me case:
'
' "Series1:Y" represents the high price.
' "Series1:Y2" represents the low price.
' "Series1:Y4" represents the close price.
' "Series2:Y" represents the volume.

Dim inputValues As String = "Series1:Y,Series1:Y2,Series1:Y4,Series2:Y"

' Some formulas have parameters that can be specified optionally. For
' example, we can create a String expression of comma-separated strings
' that represents the Short period and Long period of the Chaikin
' Oscillator formula.

String parameters = "5,12"

' The string that corresponds to the series that will be used to store the output values.
Dim outputValues As String = "Series3:Y"

' Call the formula.
chart1.DataManipulator.FormulaFinancial(FinancialFormula.ChaikinOscillator, parameters, inputValues, outputValues)

...
C# Copy Code
using Dundas.Charting.WinControl
...

/* We must create a string expression of comma-separated strings that
** represents input values to pass to the financial formula. In this case:
**
** "Series1:Y" represents the high price.
** "Series1:Y2" represents the low price.
** "Series1:Y4" represents the close price.
** "Series2:Y" represents the volume.
*/
string inputValues = "Series1:Y,Series1:Y2,Series1:Y4,Series2:Y";

/* Some formulas have parameters that can be specified optionally. For
** example, we can create a string expression of comma-separated strings
** that represents the short period and long period of the Chaikin
** Oscillator formula.
*/
string parameters = "5,12";

// The string that corresponds to the series that will be used to store the output values.
string outputValues = "Series3:Y";

// Call the formula.
chart1.DataManipulator.FormulaFinancial(FinancialFormula.ChaikinOscillator, parameters, inputValues, outputValues);

...

Remarks

This method applies a formula to the Y-values of one or more series' data points.

If a formula needs more than one input parameter (e.g. "10,20" for the short and long periods of a Chaikin Oscillator formula) the parameters should be comma-separated. Some parameters can be omitted (they have default values) while others must be set, depending on the formula. If a parameter is missing and is not optional an exception will be thrown.

Each particular formula has certain requirements, which are listed in the formula topics located in the "Formula Reference" folder.

If a specified output series has not been created and added to the SeriesCollection when this function call is made it will be created and added to the collection automatically, and have default Series properties (e.g. column chart type, etc.). In addition, the ChartArea property of the series is set to "Default", and if a chart area with the name "Default" exists in the ChartAreasCollection it will be used to draw the chart. If there is no chart area with this name the first ChartArea object in the collection will be used to display the series.

Note: If you are applying an averaging formula (e.g. Simple Moving Average) see the StartFromFirst property.

For an overview of how to apply a formula see the Using Financial Formulas  topic. For a detailed discussion on a particular formula see that formula's topic in the "Formula Reference" folder.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.