📄 chandelier exit.afl
字号:
//------------------------------------------------------------------------------
//
// Formula Name: Chandelier Exit
// Author/Uploader: Jarod Marshall
// E-mail: riot_starta@hotmail.com
// Date/Time Added: 2006-02-02 07:43:01
// Origin:
// Keywords: Chandelier Exit Stop Loss
// Level: semi-advanced
// Flags: system,indicator
// Formula URL: http://www.amibroker.com/library/formula.php?id=583
// Details URL: http://www.amibroker.com/library/detail.php?id=583
//
//------------------------------------------------------------------------------
//
// These two forms of the same indicator are designed to act as the Chandelier
// Exit stop loss as described by Barbara Rockefeller in "Technical Analysis
// for Dummies", and is written especially for use with AmiBroker. She
// describes the Chandelier exit as a dataset of "the highest high or the
// highest close SINCE YOUR ENTRY." To allow the Chandelier exit to stop you
// out gives you a couple of average-true-ranges (ATRs) from the best price
// the stock has reached SINCE YOUR ENTRY.
//
// Only *you* know when your trading rules will dictate that you enter the
// trade, and so my Chandelier Exit Preview here allows you to preview the
// Chandelier exit series by clicking on the bar that AmiBroker’s
// back-test/optimize says you should buy on. If your RSI says
// “buy” on the 1st of June, simply overlay my Chandelier
// Exit formula onto your price data, and click on the bar corresponding to
// the 1st of June. The three series named "Chand..." will change each time
// you click a different bar. Thus when you click the 1st of June bar, you get
// a Chandelier Exit stop loss especially designed for buying that stock on
// the 1st of June. The second formula, the Chandelier Exit, is designed to
// fit into your automated AmiBroker trading formulae.
//
//------------------------------------------------------------------------------
_SECTION_BEGIN("Chandelier Exit Preview");
YourHold = BarIndex() - SelectedValue(BarIndex()); //How many bars between the selected bar and each bar following
Multiple = Param("Multiple", 3, 1, 10, 1); //How many ATR抯 to be allowed below the highest high since selected bar
ATRPeriods = Param("ATR Periods", 22, 1, 50, 1); //How many periods to use for the ATR
Graph1 = HHV(Close,YourHold) - (Multiple * ATR(ATRPeriods)); //Chandelier exit line from highest close
Graph2 = HHV(High, YourHold) - (Multiple * ATR(ATRPeriods)); //Chandelier exit line from highest high
Graph3 = LLV(Low, YourHold) + (Multiple * ATR(ATRPeriods)); //Chanderlier exit from lowest low (used when going short)
Plot(Graph1, "ChandClose", ParamColor( "ChandClose Color", colorCycle ), ParamStyle("ChandClose Style") );
Plot(Graph2, "ChandHigh", ParamColor( "ChandHigh Color", colorCycle ), ParamStyle("ChandHigh Style") );
Plot(Graph3, "ChandLow", ParamColor( "ChandLow Color", colorCycle ), ParamStyle("ChandLow Style") );
_SECTION_END();
_SECTION_BEGIN("Chandelier Exit");
YourHold = BarIndex() - ValueWhen(<your "buy" criterion>, BarIndex(), 1);//Replace <...> with your 'buy' formula
Multiple = Param("Multiple", 3, 1, 10, 1); //How many ATR抯 to be allowed below the highest high since latest "buy" bar
ATRPeriods = Param("ATR Periods", 22, 1, 50, 1); //How many periods to use for the ATR
Graph1 = HHV(Close,YourHold) - (Multiple * ATR(ATRPeriods)); //Chandelier exit line from highest close
Graph2 = HHV(High, YourHold) - (Multiple * ATR(ATRPeriods)); //Chandelier exit line from highest high
Graph3 = LLV(Low, YourHold) + (Multiple * ATR(ATRPeriods)); //Chanderlier exit from lowest low (used when going short)
Plot(Graph1, "ChandClose", ParamColor( "ChandClose Color", colorCycle ), ParamStyle("ChandClose Style") );
Plot(Graph2, "ChandHigh", ParamColor( "ChandHigh Color", colorCycle ), ParamStyle("ChandHigh Style") );
Plot(Graph3, "ChandLow", ParamColor( "ChandLow Color", colorCycle ), ParamStyle("ChandLow Style") );
_SECTION_END();
Buy = <your "buy" criterion>;
Sell = <your "sell" criterion> OR Cross(Graph1, Close); //Use the appropriate Graph1, Graph2 or Graph3 for whichever Chandelier exit you wish
Short = Sell;
Cover = Buy;
_SECTION_END();
/* These two forms of the same indicator are designed to act as the Chandelier Exit stop loss as described by Barbara Rockefeller in
"Technical Analysis for Dummies", and is written especially for use with AmiBroker. She describes the Chandelier exit as a dataset of
"the highest high or the highest close SINCE YOUR ENTRY." To allow the Chandelier exit to stop you out gives you a couple of
average-true-ranges (ATRs) from the best price the stock has reached SINCE YOUR ENTRY.
Only *you* know when your trading rules will dictate that you enter the trade, and so my Chandelier Exit Preview here allows you to preview
the Chandelier exit series by clicking on the bar that AmiBroker抯 back-test/optimize says you should buy on. If your RSI says 揵uy
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -