The WIDGET_INSTRUMENT_SELECTION message is received by all widgets and scripts when a widget reports a change in its context. This allows a widget or script to react to the most recently "active" instrument in the software. For example, WIDGET_INSTRUMENT_SELECTION is issued when a user clicks anywhere on a chart, making it active.
A widget or script can read the most recent instrument selection at any time using Framework.lastGlobalInstrumentSelection. The WIDGET_INSTRUMENT_SELECTION message is then a notification that this value has changed.