ZenQuant.Fisher (zen_quant v0.4.0)

Copy Markdown View Source

Fisher Transform oscillator for chronologically ordered price series.

The defaults reproduce Figure 5 of John F. Ehlers, "Using The Fisher Transform," Technical Analysis of Stocks & Commodities 20:11 (November 2002), pp. 40–42: a 10-bar lookback, value EMA alpha of 0.33 (and therefore prior-value weight 0.67), prior-Fisher weight of 0.5, and bounds of ±0.999. The article uses median prices (high + low) / 2; callers can supply that series or any other numeric price series.

API Functions

FunctionArityDescriptionParam Kinds
transform2Calculate the Fisher Transform and its one-bar-delayed trigger line.prices: value

Summary

Types

A Fisher value and its one-bar-delayed trigger value

Functions

Calculate the Fisher Transform and its one-bar-delayed trigger line.

Types

point()

@type point() :: {float(), float()}

A Fisher value and its one-bar-delayed trigger value

Functions

transform(prices, opts \\ [])

@spec transform(
  [number()],
  keyword()
) :: [point()]

Calculate the Fisher Transform and its one-bar-delayed trigger line.

Parameters

  • prices - Numeric prices in chronological order (oldest first) (value)

Options

  • lookback - Rolling normalization window (default: 10)
  • value_alpha - Weight on the current normalized price; the prior-value weight is 1 - alpha (default: 0.33)
  • fisher_smoothing - Weight on the previous Fisher output (default: 0.5)

Returns

Chronological {fisher, trigger} pairs, or an empty list when fewer prices than the lookback (list)

Example

[{0.3428, 0.0}, {0.0621, 0.3428}]
# descripex:contract
%{
  opts: %{
    lookback: %{
      default: 10,
      type: :integer,
      description: "Rolling normalization window"
    },
    value_alpha: %{
      default: 0.33,
      type: :float,
      description: "Weight on the current normalized price; the prior-value weight is 1 - alpha"
    },
    fisher_smoothing: %{
      default: 0.5,
      type: :float,
      description: "Weight on the previous Fisher output"
    }
  },
  params: %{
    prices: %{
      description: "Numeric prices in chronological order (oldest first)",
      kind: :value
    }
  },
  returns: %{
    type: :list,
    description: "Chronological {fisher, trigger} pairs, or an empty list when fewer prices than the lookback"
  },
  returns_example: [{0.3428, 0.0}, {0.0621, 0.3428}]
}