WiseTrader Toolbox

SineWaveDC

Background

SineWaveDC is the dominant-cycle variant of the SineWave indicator from John Ehlers' Rocket Science for Traders. It plots the same pair of cycle-phase sine waves, but it derives the phase from the dominant-cycle reading rather than the homodyne reconstruction. In practice it gives the same kind of turning-point signals — the lead sine crossing the main sine marks the cycle's turns, and the two lines running parallel signals a trend.

Note

In the current toolbox this behaviour is provided through the unified SineWave function and its Engine argument rather than a separate SineWaveDC call. Selecting a cycle engine on SineWave is how you choose how the dominant cycle that drives the phase is measured — see Cycle Engines.

Included formula

The toolbox ships a ready-made Sine Wave DC indicator, so you can use it without writing any code. In AmiBroker open the Charts window, expand the WiseTraderToolbox group and drag Sine Wave DC onto a chart. It plots the same pair of sine and lead-sine lines as the Sine Wave indicator, but driven from the dominant-cycle reading.

The exported function

SineWave(Price, Engine, Alpha = 0.07)

To reproduce the dominant-cycle Sine Wave, call SineWave with the Ehlers alpha dominant-cycle engine (engine 1), or pick one of the spectral engines (2–5) for a different dominant-cycle measurement.

ParameterDescription
Price The price array the cycle phase is calculated on. It must not contain empty/null values at the left edge of the data.
Engine The cycle estimator that supplies the dominant cycle. Use 1 for the Ehlers alpha dominant-cycle reading, or 25 for a spectral estimator. See Cycle Engines.
Alpha Optional. Smoothing constant used only by engine 1. Must be greater than 0. Defaults to 0.07; ignored by other engines.
Note

Like SineWave, this writes two AFL variables rather than returning an array: Sine_Array (the main sine) and LeadSine_Array (the lead sine, advanced 45°).

Usage

// Dominant-cycle Sine Wave via the Ehlers alpha engine (engine 1)
SineWave( Close, 1, 0.07 );
sine     = Sine_Array;
leadSine = LeadSine_Array;

Plot( sine,     "Sine",      colorRed );
Plot( leadSine, "Lead Sine", colorBlue );

Buy  = Cross( leadSine, sine );
Sell = Cross( sine, leadSine );
Tip

For the classic low-lag homodyne Sine Wave, use the default engine — SineWave( Close ). Reach for engine 1 (or a spectral engine) only when you specifically want the dominant-cycle version described here.