MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

Chandelier Exit - Improved
A few weeks ago when the Chandelier Exit was posted to on our board board, I asked
if there was a faster version of it. On my (slowpoke) 200 Mhz PC at home, it took about
1 to 2 minutes to calculatethe formula on a single stock.

Anyway, I did not hear of any feasible solutions. Last night, upon reading about the 25X25 system on this site , it struck me that the original Chandelier Exit (see below) had a whole bunch of PREV statements in it. I'm
sure everyone knows where I'm going with this by now.

Anyway, here is how the code (at least this iteration) should be modified to speed up the calculation by a factor of 5. Basically, we move PREV into a variable vPREV prior to using it (so that it is only calculate once) in the
long and short exits. Here is the code for the long exit. I tested it with the sample Entry Rule and receive the same results in 1/5th the time. Just modify the SHORT exit in the same way. Hope this helps everyone using it.

Chandelier Exit - Improved

{DEFINE ENTRY PRICE, WITH EXIT BEING -- ENTRY PRICE AND NO TRADE BEING 0}
{Move PREV into a variable to speed things up - DB 2/17/00}
vPREV:=PREV;
EntryPrice:= If(vPREV <= 0,
If(LongEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(LOW <= vPREV - MoneyMgmtStop, -vPREV,
If(LOW <= HighestSince(1,vPREV=0, HIGH) - 3 * ATR(10), -vPREV,
If(LOW <= HighestSince(1,vPREV=0, CLOSE) - 2.5 * ATR(10), -vPREV, vPREV))));

David Bozkurtian 2/17/00

Work as:

Chandelier Exit - Improved

LongEntry:={Tu wstaw kryterium otwarcia pozycji};
MoneyMgmtStop:=(Tu wstaw maksymalną stratę w punktach);
vPREV:=PREV;
EntryPrice:= If(vPREV <= 0,
If(LongEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(LOW <= vPREV - MoneyMgmtStop, -vPREV,
If(LOW <= HighestSince(1,vPREV=0, HIGH) - 3 * ATR(10), -vPREV,
If(LOW <= HighestSince(1,vPREV=0, CLOSE) - 2.5 * ATR(10), -vPREV, vPREV))));

Source / From: TOP