Dundas Chart for Windows Forms
FormulaFinancial(FinancialFormula,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) Method


formulaName
A FinancialFormula enumeration value that determines the technical analysis or time series formula to be used.
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.

Syntax

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

Parameters

formulaName
A FinancialFormula enumeration value that determines the technical analysis or time series formula to be used.
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 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.

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

' 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, 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";

// 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, inputValues, outputValues);

...

Remarks

This method applies a formula to Y-values of one or more series' data points, and stores the resulting formula data in the output series.

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.

This particular function definition cannot be used for those formulas that must have a parameter argument specified (use another definition that takes a parameters argument).

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.