WebCab Technical Analysis Web Services for Delphi v1.1

Filters.FiniteImpulseResponse Method 

Calculates a Finite Impulse Response Filter.

public double[] FiniteImpulseResponse(
   double[] historicalValues,
   double[] weights
);

Parameters

historicalValues
A double array where the first term is the traded price on the most recent period, the second terms is the traded price of the previous periods and so on, for the asset under consideration.
weights
A double array where the k-th elements is the weight associated with the asset price from the k-th previous period.

Return Value

A double array where the first term 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.

Remarks

This is a type of smoothing filter that assigns different weights to historical prices.

Evaluation

The FIR indicator is evaluated by the following formula:

FIR = ( (historicalValues[i] * weights[0]) + historicalValues[i-1] * weights[1] +...) / (Sum of weights)

where:

  1. historicalValues[i] is the most recent historical price, historicalValues[i-1] is the price in the previous period and so on...
  2. weights[0] is the weight associated with the most recent period, weights[1] is the weight associated with the previous periods assets price and so on...
  3. Sum of Weights = weights[0] + weights[1] +...

Exceptions

Exception TypeCondition
ArgumentExceptionThrown if the length of the array parameter historicalValues is less than the length of weights array or if any elements of this array is strictly negative.

See Also

Filters Class | Indicators Namespace