Description: Boolean and alert functions that check if the latest user-selected symbol 'sym' has started printing. Alerts trigger by bar close.
Usage: Mainly for 24/7 crypto exchanges. If an exchange you have alerts on goes offline, the alerts will not trigger. The offline alert is an alert to alert you of that. It's best to create the alerts while on "CRYPTOCAP:TOTAL" because it has the least downtime. The exchange you want alerts on is controlled by the 'sym' parameter. The alerts need to be enabled yourself.
Limitations: The alerts may be triggered by no volume in a bar, so it's best to set it on timeframes higher than 1 minute. Alerts are not enabled in libraries so the functions must be imported or copied into another script. alert.freq cannot be changed by input because it becomes a series string in a function. dynamic_requests must be true to export functions using `request.*()` calls.
Library "offline_detection" Creates alerts for the user-selected symbol by checking if its latest bar is current by comparing it against another chart.
isItDown(sym) Checks if 'sym' is offline by requesting time of 'sym'. Parameters: sym (simple string): (const string) The user-selected symbol in the form of "PREFIX:TICKER". Returns: True if time of 'sym' is not available.
isItDownNoSpam(sym) Checks if 'sym' is offline by requesting time of 'sym' once. Parameters: sym (simple string): (const string) The user-selected symbol in the form of "PREFIX:TICKER". Returns: True if time of 'sym' is not available and it was available in the previous bar close.
isItUp(sym) Checks if 'sym' is online after being offline by using isItDown(). Parameters: sym (simple string): (const string) The user-selected symbol in the form of "PREFIX:TICKER". Returns: True if time of 'sym' is available in the current bar but wasn't prior.
offlineAlert(sym) Checks if isItDown() is true. Parameters: sym (simple string): (const string) The user-selected symbol in the form of "PREFIX:TICKER". Returns: An alert when the symbol is not online and the time in UTC. This will continue triggering every bar close until the symbol is online.
offlineAlertNoSpam(sym) Checks if isItDown() is true. Parameters: sym (simple string): (const string) The user-selected symbol in the form of "PREFIX:TICKER". Returns: An alert when the symbol is not online and the time in UTC.
onlineAlert(sym) Checks if isItUp() is true. Parameters: sym (simple string): (const string) The user-selected symbol in the form of "PREFIX:TICKER". Returns: An alert when the symbol is now online and the time in UTC.
warningsign() Checks if the current chart is "CRYPTOCAP:TOTAL". Returns: A reminder on the chart.