| SID Name | Description | Rating |  | 767 ChandelierExit | A simple interpretation of the Chandelier Exit by Chuck Le Beau | Not Rated |
 | The logic for this function: |
#A simple interpretation of the Chandelier Exit by Chuck Le Beau
#The Chandelier Exit hangs a trailing stop from the highest high of the position,
#minus a multiple of the 45 bar Average True Range (ATR). This function simply returns
#a value that can be used in a stop order. This function can except an optional parameter
#to specify a multiple of ATR to use, a default of 3 is used when nothing is passed.
#This function assumes the position is long.
my ($atr)=@_;
if (Position) {
$atr=3 if not defined($atr);
return (MaxPriceSinceEntry-(Today(ATR(45)) * $atr));
}
#no position, return undefined
return undef;
|