We are happy to announce the MultiCharts Easter Sale! Learn more
+1 888 340 6572

BarsToEndOfMonth

Article/Author: Omega Research Inc., 1996

Download: FUNCTION-BARSTOENDOFMONTH.ELA

File Includes: Function - BarsToEndOfMonth

EasyLanguage Code:
VALUE1 = 0; VALUE2 = 0; VALUE3 = 0; VALUE7 = 0;


VALUE1 = DATETOJULIAN(DATE);
VALUE10 = DATETOJULIAN(DATE);

FOR VALUE2 = 0 TO 32 BEGIN
VALUE1 = VALUE1 + 1;
VALUE4 = JULIANTODATE(VALUE1);
IF DAYOFMONTH(VALUE4) CROSSES UNDER DAYOFMONTH(DATE) AND
MONTH(VALUE4) <> MONTH(DATE) THEN BEGIN
VALUE5 = VALUE1 - 1;
VALUE6 = JULIANTODATE(VALUE5);
VALUE2 = 32;
END;
END;

FOR VALUE11 = VALUE5 DOWNTO VALUE10 BEGIN
VALUE6 = JULIANTODATE(VALUE11);
IF DAYOFWEEK(VALUE6) > 0 AND
DAYOFWEEK(VALUE6) < 6 THEN
BEGIN
VALUE7 = VALUE7 + 1;
END;
END;

BARSTOENDOFMONTH = VALUE7;