+1 888 340 6572 GET STARTED

Cycle Analysis > D_DSP (Detrended Synthetic Price)

Article/Author: Bill Mars, P.O. Box 231, St. Marys, OH 45885, FAX (419) 394-2165

Download: d_dsp.ela

File Includes: Indicator > D_DSP (Detrended Synthetic Price)

Category: Indicator > Cycle Analysis

Description:

TradeStation does not allow the user to make a Multi Data Chart with a Tick Bar Chart and any other type a chart. This Indicator plots a single Daily DSP (Detrended Synthetic Price).

Detrended Synthetic Price is a function that is in phase with the dominant cycle of real price data. This DSP is computed by subtracting a half-cycle exponential moving average (EMA) from the quarter cycle exponential moving average.

See "MESA and Trading Market Cycles" by John Ehlers pages 64 - 70.

Usage:

The most popular method of using a cycle is to accurately predict events in nature: bird migrations, the tides, planetary movements, etc. One can also use cycle analysis to predict changes in financial markets, although not always with the accuracy found in nature.

The prices of many commodities reflect seasonal cycles. Due to the agricultural nature of most commodities, these cycles are easily explained and understood. However, for some securities, the cyclical nature is more difficult to explain. Theories as to why certain securities exhibit cyclical patterns range from weather and sun spots, to planetary movement and basic human psychology.

Everybody knows that prices are a consensus of human expectations. These expectations are always changing, shifting the supply/demand lines, and causing prices to oscillate between overbought and oversold levels. Fluctuations in prices are a natural process of changing expectations and lead to cyclical patterns.




Inputs:

Length - specifies the number of trailing bars to consider

EasyLanguage Code:
INPUT: LENGTH(14);

VARS: PRICE(0), EMA1(0), EMA2(0), ALPHA(.25),
D_HIGH(0), D_LOW(0), FIRSTDAY(TRUE);

IF DATE <> DATE[1] AND DAYOFWEEK(DATE[1]) <> 0 THEN BEGIN
PRICE = (D_HIGH + D_LOW) /2;
IF FIRSTDAY = TRUE THEN BEGIN
IF LENGTH > 2 THEN ALPHA = 2 / (LENGTH + 1)
ELSE ALPHA = .67;
PRICE = (H[1]+L[1])/2;
EMA1 = PRICE;
EMA2 = PRICE;
VALUE2 = 0;
FIRSTDAY = FALSE;
END;
EMA1 = (ALPHA * PRICE) + ((1 - ALPHA) * EMA1);
EMA2 = ((ALPHA/2) * PRICE) + ((1 - (ALPHA/2)) * EMA2);
VALUE1 = (EMA1 - EMA2);
PLOT1[1](VALUE1,"D_DSP1");
PLOT3(0," ");
D_LOW = LOW;
D_HIGH = HIGH;
END;

IF HIGH > D_HIGH THEN D_HIGH = HIGH;
IF LOW < D_LOW THEN D_LOW = LOW;

{ALPHA IS THE CONSTANT FOR THE EMA FILTER.
WERE THE EMA RELATES TO THE SMA BY: ALPHA = 2 / (LENGTH + 1)
FOR AN EXAMPLE, SOME COMMON VALUES ARE:
ALPHA LENGTH
.50 3 DAYS
.40 4 DAYS
.25 7 DAYS
.20 9 DAYS
.182 10 DAYS
.133 14 DAYS
.118 16 DAYS
.095 20 DAYS
.069 28 DAYS}