+1 888 340 6572

PeakDivergence

Article/Author: “Quantifying Divergence With The Divergence Index”, Matt Storz, S&C Magazine, Traders Tips, 01/1996

Download: FUNCTION-PEAKDIV.ELA

File Includes: Function - PeakDivergence

Category: Function > PeakDivergence

Description:

Inputs:
Strength
OSC

EasyLanguage Code:
INPUTS: STRENGTH(NUMERICSIMPLE), OSC(NUMERICSERIES);

VARS: HC(0), HP(0), HH(0), HL(0), IC(0), IH(0), IP(0), IL(0);

VALUE1=SWINGHIGH(1,HIGH,STRENGTH,STRENGTH+1);

IF VALUE1<>-1 THEN BEGIN
HP=HC;
HC=VALUE1;
IP=IC;
IC=OSC[STRENGTH];
HH=VALUE2;
HL=VALUE3;
VALUE2=HIGHEST(HIGH,STRENGTH+1);
VALUE3=LOWEST(HIGH,STRENGTH+1);
IH=VALUE4;
IL=VALUE5;
VALUE4=HIGHEST(OSC,STRENGTH+1);
VALUE5=LOWEST(OSC,STRENGTH+1);
END;

IF HIGH>VALUE2 THEN VALUE2=HIGH;
IF HIGHTHEN VALUE3=HIGH;
IF OSC>VALUE4 THEN VALUE4=OSC;
IF OSCTHEN VALUE5=OSC;

IF (HH-HL)=0 OR (IH-IL)=0 THEN PEAKDIVERGENCE=PEAKDIVERGENCE[1]
ELSE
PEAKDIVERGENCE=50*(((HC-HP)/(HH-HL))-((IC-IP)/(IH-IL)));


{COPYRIGHT C 1997, TECHNICAL ANALYSIS, INC.}