Hilbert Transform | HTQuadrature

Modified on 2015/11/13 12:52 by Eugene — Categorized as: Community Indicators

Syntax


public HTQuadrature(DataSeries ds, string description)
public static HTQuadrature Series(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. HTQuadrature returns the Hilbert Transform generated Quadrature component of the input Price Series.

Interpretation

The Quadrature component is used in conjunction with the InPhase component to generate the phase of the analytic signal (using the ArcTan function) at a specific bar or for the entire Price Series.

Calculation

More detailed information concerning the calculation of the Hilbert Transform related functions can be found on the Mesa Software site.

The basic flow for the computation for the InPhase component is:

Compute the Hilbert Transform
{Detrend Price}
{Compute InPhase and Quadrature components} 
Return the Quadrature component at the current bar of the Hilbert Transform computed 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() { // Color bars based on relative positions of Quadrature and In-Phase HTInPhase hti = HTInPhase.Series( AveragePrice.Series( Bars ) ); HTQuadrature htq = HTQuadrature.Series( AveragePrice.Series( Bars ) ); ChartPane HTQuadPane = CreatePane( 50, true, true ); PlotSeries( HTQuadPane, hti, Color.DarkBlue, LineStyle.Solid, 2 ); PlotSeries( HTQuadPane, htq, Color.LightBlue, LineStyle.Solid, 2 ); for(int bar = 0; bar < Bars.Count; bar++) { if( hti[bar] > htq[bar] ) SetBarColor( bar, Color.DarkBlue ); else if( hti[bar] < htq[bar] ) SetBarColor( bar, Color.LightBlue ); } } } }