### EXAMPLE BREAKOUT DETECTOR declare upper; #### ALERT/ALARM SETTINGS input alert = no; input noise = {"Bell", "Chimes", default "Ding", "Ring", "NoSound"}; def box_top = 3338; def box_bot = 3332; # detect if regular trading hours def RTH = If (SecondsFromTime(0930) >= 0 and SecondsTillTime(1600) >= 0, 1, 0); # combinations that constitute an alert def bull = high > box_top; def bear = low < box_bot; # limit frequency of triggered alert (spamminess) def trigger = (bull or bear) and !Highest(trigger[1], 8); Alert( alert AND trigger, if bull then "BULL BREAKOUT" else "BEAR BREAKOUT", Alert.BAR, noise ); ### END