+1 888 340 6572

FlexibleSpread

Function > FlexibleSpread



Article/Author: Omega Research Inc., 1995

Download: FUNCTION-FLEXIBLESPREAD.ELA

File Includes: Function - FlexibleSpread

EasyLanguage Code:
INPUT: PRICE1(NUMERICSERIES),PRICE2(NUMERICSERIES),TYPE(NUMERIC);

IF PRICE1 = 0 OR PRICE2 = 0 THEN FLEXIBLESPREAD = FLEXIBLESPREAD[1] ELSE
IF TYPE = 1 THEN FLEXIBLESPREAD = PRICE1 - PRICE2 ELSE
IF TYPE = 2 THEN FLEXIBLESPREAD = PRICE2 - PRICE1 ELSE
IF TYPE = 3 THEN FLEXIBLESPREAD = PRICE1 + PRICE2 ELSE
IF TYPE = 4 THEN FLEXIBLESPREAD = (PRICE1 + PRICE2) / 2 ELSE
IF TYPE = 5 THEN FLEXIBLESPREAD = PRICE1 / PRICE2 ELSE
IF TYPE = 6 THEN FLEXIBLESPREAD = PRICE2 / PRICE1 ELSE
IF TYPE = 7 THEN FLEXIBLESPREAD = PRICE1 * PRICE2 ELSE
IF TYPE = 8 THEN FLEXIBLESPREAD = (PRICE1 + PRICE2) / IFF(PRICE1 > 0,PRICE1,1) ELSE
IF TYPE = 9 THEN FLEXIBLESPREAD = (PRICE1 + PRICE2) / IFF(PRICE2 > 0,PRICE2,1