Applystop calculation

Hi All

How do I find the way applystop is calculated?

I’m trying to create an ATR Chandelier stop but I can’t see how the Applystop function would be able to countback for the highest high as is shown below for 22 day period length (using stopModePoint mode).

Chandelier Exit (long) = 22-day High - ATR(22) x 3
Chandelier Exit (short) = 22-day Low + ATR(22) x 3

From http://stockcharts.com/school/doku.php?id=chart_school:technical_indicators:chandelier_exit.

I’m assuming that it just does the highest high from the buy date.

Check this link for the Chandelier stop and applyStop function in general:

https://www.amibroker.com/guide/afl/applystop.html

As for this part:

check this function:
https://www.amibroker.com/guide/afl/hhv.html
https://www.amibroker.com/guide/afl/llv.html

Thanks for the reply. Yes I am aware of these pages however I couldnt see where it states how the highest high period time is calculated for the Applystop function.

It is in the User’s manual: ApplyStop()

/* single-line implementation of Chandelier exit */
ApplyStop(stopTypeTrailing, stopModePoint, 3*ATR(22), True, True );

Trailing stop by definition uses highest high since entry for longs and lowest low since entry for shorts.

http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/

Using fixed HHV/LLV period as opposed to “since entry” would stop you prematurely,
but if this is what you want, you will find the code below. It is normal exit

LowTriggerPrice= HHV( High, 22 ) - 3* ATR( 22 );
HighTriggerPrice = LLV( Low, 22 ) + 3 * ATR( 22 );
Sell = Low < LowTriggerPrice;
SellPrice = LowTriggerPrice;
Short = High > HighTriggerPrice;
ShortPrice = HighTriggerPrice;

and this does not really require ApplyStop at all.

2 Likes