Appendix A. Creating Local Alerts

In thinkScript®, you have the ability to create local alerts. In general, alerts are signals that are triggered when a condition is satisfied.

The common syntax for thinkScript® alerts is the following:

alert(condition, text, alert type, sound);

The condition parameter defines a condition upon which you want this alert to be triggered. The text parameter places a specified text next to the alert. The alert type parameter defines a type of the alert.

Available alert type values are:

  • Alert.ONCE – alert can be triggered only once after adding a study.

  • Alert.BAR – alert can be triggered only once per bar.

  • Alert.TICK – alert can be triggered after each tick

The sound parameter plays a sound when the alert is triggered.

Valid sound values are:

  • Sound.Bell

  • Sound.Chimes

  • Sound.Ding

  • Sound.NoSound

  • Sound.Ring

Consider the following script:

Alert(open > 400, "Open is greater than 400! Current value is" + open, alert.ONCE, Sound.Ring);

This example script triggers an alert when the Open price becomes higher than 400. The alert is triggered once and it plays the ring sound.