Black Friday great discounts start today Learn more
+1 888 340 6572

RainbowBW

Article/Author: Stocks&Commodities Magazine, Traders Tips, 07/1997

Download: FUNCTION-RAINBOWBW.ELA

File Includes: Function - RainbowBW

Category: Function > RainbowBW

Description:

Inputs:
Price - цена по которой строится Moving Average
Length - период, за который строится Moving Average
Level -

EasyLanguage Code:
INPUTS: PRICE(NUMERIC), LENGTH(NUMERIC), LEVEL(NUMERIC);

VARS: LVLAVG(0), HIPRICE(0), LOPRICE(0), HIAVG(0), LOAVG(0);
ARRAY: AVG[10](0);

AVG[1] = AVERAGE(PRICE, LENGTH);
AVG[2] = AVERAGE(AVG[1], LENGTH);
AVG[3] = AVERAGE(AVG[2], LENGTH);
AVG[4] = AVERAGE(AVG[3], LENGTH);
AVG[5] = AVERAGE(AVG[4], LENGTH);
AVG[6] = AVERAGE(AVG[5], LENGTH);
AVG[7] = AVERAGE(AVG[6], LENGTH);
AVG[8] = AVERAGE(AVG[7], LENGTH);
AVG[9] = AVERAGE(AVG[8], LENGTH);
AVG[10] = AVERAGE(AVG[9], LENGTH);

HIPRICE = HIGHEST(PRICE, LEVEL);
LOPRICE = LOWEST(PRICE, LEVEL);

HIAVG = AVG[1];
LOAVG = AVG[1];
FOR VALUE1 = 2 TO LEVEL BEGIN
IF AVG[VALUE1] > HIAVG THEN
HIAVG = AVG[VALUE1];
IF AVG[VALUE1] < LOAVG THEN
LOAVG = AVG[VALUE1];
END;

IF HIPRICE - LOPRICE <> 0 THEN BEGIN
IF PRICE > HIAVG THEN
HIAVG = PRICE;
IF PRICE < LOAVG THEN
LOAVG = PRICE;
RAINBOWBW = 100 * ((HIAVG - LOAVG) / (HIPRICE - LOPRICE));
END;