+1 888 340 6572

Miscellaneous > CompressedChart

Article/Author: Emmanuel Lavelent for Omega Research, Inc., 1997

Download: COMPRESSEDCHART.ELA

File Includes: Indicator - WeeklyBarsAnyDay

Category: Indicator > Date & Time

Description:

This indicator allows you to have a clear picture of where current prices are compared to Historical Prices in your chart without scrolling back an forth.

Usage:

The input compress allows you to specify how many Bars in the chart should be compressed in to one.

Example: A compression of 4 will compress every 4 bars in to one. It Also allows you to see a MultiTick Tick Bar chart superimposing a 1 tick Tick Chart. The MaxBarsBack setting must be set to Auto-Detect MaxBarsBack.




Inputs:

Compress - the number of bars compressed into a single bar.

EasyLanguage Code:
INPUT:COMPRESS(4);

VARS:COMPH(H),COMPL(L),COMPO(O),COMPC(C),LENGTH(0);
ARRAY:CHART[4,1500](0);

LENGTH = INTPORTION(CURRENTBAR / COMPRESS);
IF LENGTH > 1500 THEN LENGTH = 1500;

IF LENGTH <=1500 THEN BEGIN

IF VALUE1 <= COMPRESS THEN BEGIN
VALUE1 = VALUE1 + 1;
IF VALUE1 = 1 THEN BEGIN
COMPO = O;
COMPH = H;
COMPL = L;
END;
IF H > COMPH THEN COMPH = H;
IF L < COMPL THEN COMPL = L;
END;

IF VALUE1 = COMPRESS THEN BEGIN
COMPC = C;
VALUE1 = 0;
FOR VALUE2 = LENGTH DOWNTO 1 BEGIN
CHART[1,VALUE2] = CHART[1,VALUE2 - 1];
CHART[2,VALUE2] = CHART[2,VALUE2 - 1];
CHART[3,VALUE2] = CHART[3,VALUE2 - 1];
CHART[4,VALUE2] = CHART[4,VALUE2 - 1];
END;
CHART[1,0] = COMPO;
CHART[2,0] = COMPH;
CHART[3,0] = COMPL;
CHART[4,0] = COMPC;
END;

IF (DATE = LASTCALCDATE AND DATACOMPRESSION = 2) OR
(DATACOMPRESSION < 2 AND DATE = LASTCALCDATE AND TIME = LASTCALCTIME) THEN
FOR VALUE2 = 0 TO LENGTH-1 BEGIN
IF CHART[1,VALUE2] > 0 THEN BEGIN
PLOT1[VALUE2](CHART[1,VALUE2],"O");
PLOT2[VALUE2](CHART[2,VALUE2],"H");
PLOT3[VALUE2](CHART[3,VALUE2],"L");
PLOT4[VALUE2](CHART[4,VALUE2],"C");
END;
END;

END;