**Syntax**

public HTDCPhase(DataSeries ds, string description)
public static HTDCPhase(DataSeries ds)

**Parameter Description**

*ds* |
The source DataSeries, usually AverageSeries |

**Description**

The Hilbert Transform is a technique used to generate inphase and quadrature components of a de-trended real-valued "analytic-like" signal (such as a Price Series) in order to analyze variations of the instantaneous phase and amplitude.. HTDCPhase returns the Hilbert Transform Phase of the Dominant Cycle. The Dominant Cycle Phase lies in the range of 0 to 360 degrees.

The following indicator was implemented after

*fundtimer's* calculation for WL4 but this implementation results is a somewhat different calculation than in Wealth-Lab 4.

### Interpretation

The DC Phase at a specific bar gives the phase position from 0 to 360 degrees within the current Hilbert Transform Period instantaneously measured at that bar. It is meaningful only during a cyclic period of the analytic signal waveform (price series) being measured. Its transition from 360 degrees to 0 degrees can be used to designate the start of a new cycle. It can also be utilized to signal the start or end of trending or cyclic periods. Departure from a constant rate change of phase is a sensitive way to detect the end of a cycle mode. See the examples.

### Calculation

More detailed information concerning the calculation of the Hilbert Transform related functions can be found on the

Mesa Software site.

The basic flow and simplified pseudo code for the computation for the Dominant Cycle Period is:

Compute the Hilbert Transform
{Detrend Price}
{Compute InPhase and Quadrature components}
Compute the Period of the Dominant Cycle
{Use ArcTangent to compute the current phase}
{Resolve the ArcTangent ambiguity}
{Compute a differential phase, resolve phase wraparound, and limit delta phase errors}
{Sum DeltaPhases to reach 360 degrees. The sum is the instantaneous period.}
{Resolve Instantaneous Period errors and smooth}
Compute Dominant Cycle Phase
Return the Dominant Cycle Phase at the current bar of the Hilbert Transform Period measured at that bar

**Example**

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators;

namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
// Example - Plot the phase of the Dominant Cycle
HTDCPhase htdc = HTDCPhase.Series( AveragePrice.Series( Bars ) );
ChartPane PhasePane = CreatePane( 50, true, true );
PlotSeries( PhasePane, htdc, Color.Blue, LineStyle.Solid, 1 );
}
}
}