+1 888 340 6572

AnyEntryPrice

Article/Author: Emmanuel Lavelanet for Omega Research Inc., 1995

Download: FUNCTION-ANYENTRYPRICE.ELA

File Includes: Function - AnyEntryPrice

Description: Allows you to refer to any pyramided entry price within a position as opposed to the
just the first entry price when using the function EntryPrice. You call the entry by passing a number or
a variable through the GOGRABIT input. If you want the third entry then you pass a 3.
If you want the last, you can pass CurrentEntries.

EasyLanguage Code:
INPUT:GOGRABIT(NUMERICSERIES);

ARRAY:ENTERING[50](0);
VARS:PROFMARK(0),CMARK(0);

IF MARKETPOSITION <> MARKETPOSITION(1) THEN BEGIN

VALUE1 = CURRENTCONTRACTS;
VALUE5 = CURRENTENTRIES;
IF VALUE5 = 1 THEN BEGIN
ENTERING[1] = ENTRYPRICE;
END;
IF VALUE5 > VALUE5[1] THEN BEGIN
VALUE13 = 0;
PROFMARK = ((POSITIONPROFIT / VALUE1) * VALUE5) / BIGPOINTVALUE;
CMARK = C;
IF VALUE5 = 1 THEN BEGIN
ENTERING[VALUE5] = ENTRYPRICE;
END;
IF VALUE5 = 2 AND MARKETPOSITION = 1 THEN BEGIN
VALUE8 = CMARK - ENTERING[1];
VALUE9 = PROFMARK - VALUE8;
ENTERING[2] = CMARK - VALUE9;
END;

{ *************}

IF VALUE5 = 2 AND MARKETPOSITION = -1 THEN BEGIN
VALUE8 = ENTERING[1] - CMARK;
VALUE9 = PROFMARK - VALUE8;
ENTERING[2] = CMARK + VALUE9;
END;
IF VALUE5 > 2 AND MARKETPOSITION = 1 THEN BEGIN
FOR VALUE12 = 1 TO VALUE5 - 1 BEGIN
VALUE13 = VALUE13 + (CMARK - ENTERING[VALUE12]);
END;
VALUE9 = PROFMARK - VALUE13;
ENTERING[VALUE5] = CMARK - VALUE9;
END;
IF VALUE5 > 2 AND MARKETPOSITION = -1 THEN BEGIN
FOR VALUE12 = 1 TO VALUE5 - 1 BEGIN
VALUE13 = VALUE13 + (CMARK - ENTERING[VALUE12]);
END;
VALUE9 = PROFMARK + VALUE13;

ENTERING[VALUE5] = CMARK + VALUE9;
END;
END;

ANYENTRYPRICE = ENTERING[GOGRABIT];

END;