Dundas Chart for Windows Forms
FormulaFinancial(FinancialFormula,String,Series,Series) Method
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > DataManipulator Class > FormulaFinancial Method : FormulaFinancial(FinancialFormula,String,Series,Series) 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
Series object that has the formula applied to it. The first Y-value of each data point will be used.
outputSeries
Series object that stores the formula data points. If it does not exist an exception will be thrown.

Applies a financial formula to the first Y-values of a 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 Series, _
   ByVal outputSeries As Series _
) 
Visual Basic (Usage) Copy Code
Dim instance As DataManipulator
Dim formulaName As FinancialFormula
Dim parameters As String
Dim inputSeries As Series
Dim outputSeries As Series
 
instance.FormulaFinancial(formulaName, parameters, inputSeries, outputSeries)
C#  
public void FormulaFinancial( 
   FinancialFormula formulaName,
   string parameters,
   Series inputSeries,
   Series 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
Series object that has the formula applied to it. The first Y-value of each data point will be used.
outputSeries
Series object that stores the formula data points. If it does not exist an exception will be thrown.

Example

This example demonstrates how to output 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 has been added at design-time.
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

    ' 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 input series that the formula uses to calculate output values.
    Dim inputSeries As Series = chart1.Series("Series1")

    ' The series that stores the output values.
    Dim outputSeries As Series = chart1.Series("Series2")

    ' Call the formula.
    chart1.DataManipulator.FormulaFinancial(FinancialFormula.ChaikinOscillator, parameters, inputSeries, outputSeries)

...
C# Copy Code
using Dundas.Charting.WinControl
...    
   
   
/*  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 input series that the formula uses to calculate output values.
   
Series inputSeries = chart1.Series["Series1"];
   
   
// The series that stores the output values.
   
Series outputSeries = chart1.Series["Series2"];

   
// Call the formula.
   
chart1.DataManipulator.FormulaFinancial(FinancialFormula.ChaikinOscillator, parameters, inputSeries, outputSeries);
   
...

Remarks

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

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

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.

If the specified output series has not been created and added to the SeriesCollection when this function call is made an exception will be thrown.

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.