Hilbert Transform - Dominant Cycle Phase (HT_DCPHASE)
Summary
Hilbert Transform Dominant Cycle Phase: the instantaneous phase (in degrees) of the dominant market cycle, derived from a homodyne discriminator on a Hilbert-transformed, smoothed price. One real output per bar. Output is degrees, in the range −45 to 315 (a full 360° span).
Chart
Chart metadata i
Outputs
outReal:line·positive·negative
Interpretation
DCPhase is a rotating angle: it locates the current bar within the dominant price cycle the Hilbert-transform model has locked onto. 90° is the modeled cycle's high, 270° its low, and 0°/180° are the midpoints where the cycle is moving fastest. HT_SINE plots this angle as a sine wave, crossing its 45°-lead companion near those highs and lows. HT_TRENDMODE separately flags bars where the market isn't cycling at all.
Inputs
inReal— Price series to analyze
Outputs
outReal— Dominant cycle phase in degrees
Properties
Numerical Stability: Initial Unstable Period
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Display Shift |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
| ✅ Uses Transcendental i |
| ☐ Input Must Be Positive |
Example
#include <stdio.h>
#include <ta_libc.h>
int n = 252;
double series[252]; /* your data, oldest first */
double out[252];
int outBegIdx, outNBElement;
TA_Initialize();
TA_HT_DCPHASE( 0, n - 1, series, &outBegIdx, &outNBElement, out );
printf( "%d values from bar %d; last out = %f\n", outNBElement, outBegIdx, out[outNBElement - 1] );use ta_lib::Core;
let series = vec![0.0; 252]; // your data, oldest first
let mut out = vec![0.0; 252];
let core = Core::new();
let range = core.ht_dcphase(0, series.len() - 1, &series, &mut out)?;
println!("{} values from bar {}; last out = {}", range.count, range.beg_idx, out[range.count - 1]);import io.github.talib.Core;
import io.github.talib.OutRange;
double[] series = new double[252]; // your data, oldest first
double[] out = new double[252];
Core core = Core.DEFAULT;
OutRange r = core.htDcphase(0, series.length - 1, series, out);
System.out.println(r.count() + " values from bar " + r.begIdx() + "; last out = " + out[r.count() - 1]);using System;
using TALib;
var series = new double[252]; // your data, oldest first
var outReal = new double[252];
var core = Core.Default;
OutRange r = core.HtDcphase(0, series.Length - 1, series, outReal);
Console.WriteLine($"{r.Count} values from bar {r.BegIdx}; last outReal = {outReal[r.Count - 1]}");import { htDcphase } from 'ta-lib';
const series = new Float64Array(252); // your data, oldest first
const { begIdx, values } = htDcphase(series);
console.log(values.length + ' values from bar ' + begIdx + '; last values = ' + values[values.length - 1]);Implementation
Added in 0.4.0.
TA-Lib Definition: ht_dcphase.c · ht_dcphase.yaml
| Native | File |
|---|---|
| C | ta_HT_DCPHASE.c |
| Rust | ht_dcphase.rs |
| Java | Core_HT_DCPHASE.java |
| C# | Core_HT_DCPHASE.cs |
| TypeScript | htDcphase.ts |
Python: talib.HT_DCPHASE, see ta-lib-python.
TA-Lib is also available for R and more using a wrapper.
Aliases
Hilbert Transform Dominant Cycle Phase
See Also
HT_DCPERIOD · HT_PHASOR · HT_SINE · HT_TRENDLINE · HT_TRENDMODE · MAMA · WMA
References
- John F. Ehlers, Rocket Science for Traders: Digital Signal Processing Applications, John Wiley & Sons (ISBN 0471405671)