+1 888 340 6572

PDF

Article/Author: “Guaging Mobility With Price Distributions”, Mel Widner, Stocks&Commodities Magazine, Traders Tips, 02/1996

Download: FUNCTION-PDF.ELA

File Includes:
Function - PDF

Category: Function > PDF

Description:

Inputs:
Interval
M
LookBack

EasyLanguage Code:
INPUTS: INTERVAL(NUMERIC), M(NUMERIC), LOOKBACK(NUMERIC);

VARS: HMAX(0), LMIN(0), BL(0), BU(0), RX(0), PDFVAR(0);

{COMPUTE THE MAXIMUM HIGH & MINIMUM LOW}
HMAX=HIGHEST(HIGH,LOOKBACK);
LMIN=LOWEST(LOW,LOOKBACK);

{BOUNDRIES BL(LOWER) & BU(UPPER)}
RX=(HMAX-LMIN)/M;
BL=LMIN+(INTERVAL-1)*RX;
BU=LMIN+INTERVAL*RX;

{COMPUTE DISTRIBUTION FUNCTION PDF}
PDFVAR=0;
FOR VALUE1=0 TO LOOKBACK-1 BEGIN
IF HIGH[VALUE1] <= BU THEN PDFVAR=PDFVAR+1;
IF HIGH[VALUE1] <= BU OR LOW[VALUE1]>=BU THEN VALUE99=1
ELSE PDFVAR=PDFVAR+(BU-LOW[VALUE1])/(HIGH[VALUE1]-LOW[VALUE1]);
IF HIGH[VALUE1]<= BL THEN PDFVAR=PDFVAR-1;
IF HIGH[VALUE1]<= BL OR LOW[VALUE1]>= BL THEN VALUE99=1
ELSE PDFVAR=PDFVAR-(BL-LOW[VALUE1])/(HIGH[VALUE1]-LOW[VALUE1]);
END;
PDF=PDFVAR/LOOKBACK;