[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Faster Chandelier Exit



PureBytes Links

Trading Reference Links


Excellent solution, David.  Do the results from the revised formula match
the original formula precisely?


----- Original Message ----- 
From: David Bozkurtian <dbozkurtian@xxxxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Thursday, February 17, 2000 5:35 AM
Subject: Faster Chandelier Exit

List,

A few weeks ago when the Chandelier Exit was posted to the 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 calculate the formula on a single stock.

Anyway, I did not hear of any feasible solutions. Last night, upon reading 
about the 25X25 system at
http://www.nt-tech.com.au/guppy/gup142.htm , 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.

{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,
{Trade entered today?}
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


---------------------------------------------------------------------
CHANDELIER EXIT, version 2 METASTOCK CODE
Below is the MetaStock code I posted for the Chandelier exit back in 
October, 1999. The trick is to define the entry date/price as the point at 
which your system triggered the entry, not by using the date functions. A 
side benefit is that you can also use it to implement a fixed dollar, or 
money management, stop.

The more time I spend with the Chandelier exit, the more I admire its 
strength as an exit and its simplicity. Because exits tend to be the weakest 
part of a system, I would urge everyone to spend some time with it.

And Chuck LeBeau gets credit for the MetaStock code, not me. I just took his 
framework and applied it to his exit.


{LONG EXIT}
LongEntry:= {this your entry system, eg. Cross(CLOSE, Mov(C,20,E))};
MoneyMgmtStop:= {this is your maximum loss, in points};

{DEFINE ENTRY PRICE, WITH EXIT BEING -- ENTRY PRICE AND NO TRADE BEING 0}
EntryPrice:= If(PREV <= 0,
{Trade entered today?}
If(LongEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(LOW <= PREV - MoneyMgmtStop, -PREV,
If(LOW <= HighestSince(1,PREV=0, HIGH) - 3 * ATR(10), -PREV,
If(LOW <= HighestSince(1,PREV=0, CLOSE) - 2.5 * ATR(10), -PREV,
PREV))));

{EXIT IF ENTRY PRICE < 0 (MEANING EXIT)}
EntryPrice < 0

{SHORT EXIT}
ShortEntry:= {this your entry system, eg. Cross(Mov(C,20,E), CLOSE)};
MoneyMgmtStop:= {this is your maximum loss, in points};

{DEFINE ENTRY PRICE, WITH EXIT BEING -ENTRY PRICE AND NO TRADE BEING 0}
EntryPrice:= If(PREV <= 0,
{Trade entered today?}
If(ShortEntry, CLOSE, 0),
{Trade entered before today. Stopped today?}
If(HIGH >= PREV + MoneyMgmtStop, -PREV,
If(HIGH >= LowestSince(1,PREV=0, LOW) + 3 * ATR(10), -PREV,
If(HIGH >= LowestSince(1,PREV=0, CLOSE) + 2.5 * ATR(10), -PREV,
PREV))));

{EXIT IF ENTRY PRICE < 0 (MEANING EXIT)}
EntryPrice < 0


from Glen Wallace