﻿ FiniteImpulseResponse(Series,ElementValue,Double[]) Method
 Collapse All Expand All Language Filter: All Language Filter: Multiple Language Filter: Visual Basic (Declaration) Language Filter: Visual Basic (Usage) Language Filter: C#
 dotnetCHARTING Namespace > FinancialEngine Class > FiniteImpulseResponse Method : FiniteImpulseResponse(Series,ElementValue,Double[]) Method

s
The financial series where the first element is the traded price on the most recent period, the second element is the traded price of the previous periods and so on, for the asset under consideration.
elementValue
Specifies the particular element value (for example High, Low, Close or Open of the financial time series) which will be considered within this indicator evaluation. In particular, if you wish to use the element value high then you should pass the parameter High. In a similarly fashion if you wish to use the low, close or open, then you should pass the parameter Low, Close, Open, respectively.
weights
A double array which represent the different weights associated with the given prices.
Calculates a Finite Impulse Response Filter.

# Syntax

Visual Basic (Declaration)
```Public Overloads Shared Function FiniteImpulseResponse( _
ByVal s As Series, _
ByVal elementValue As ElementValue, _
ByVal weights() As Double _
) As Series```
Visual Basic (Usage)Copy Code
``````Dim s As Series
Dim elementValue As ElementValue
Dim weights() As Double
Dim value As Series

value = FinancialEngine.FiniteImpulseResponse(s, elementValue, weights)``````
C#
```public static Series FiniteImpulseResponse(
Series s,
ElementValue elementValue,
double[] weights
)```

#### Parameters

s
The financial series where the first element is the traded price on the most recent period, the second element is the traded price of the previous periods and so on, for the asset under consideration.
elementValue
Specifies the particular element value (for example High, Low, Close or Open of the financial time series) which will be considered within this indicator evaluation. In particular, if you wish to use the element value high then you should pass the parameter High. In a similarly fashion if you wish to use the low, close or open, then you should pass the parameter Low, Close, Open, respectively.
weights
A double array which represent the different weights associated with the given prices.

#### Return Value

A series where the first element is the FIR of the asset on the most recent period considered, the second term is the FIR on the period before that and so on.

# Exceptions

ExceptionDescription
ArgumentExceptionThrown if the length of the given series, s, is less than the length of weights double array or if any elements of the s is strictly negative.

# Remarks

This is a type of smoothing filter that assigns different weights to prices from the past.

### Evaluation

The FIR indicator is evaluated by the following formula:
`FIR = ((historicalValues[i]*weights[0]) + historicalValues[i-1]*wights[1] + ...)/(Sum of weights)`