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.
진정한 TradingView 정신에 따라, 저자는 이 파인 코드를 다른 파인 프로그래머들이 재사용할 수 있도록 오픈 소스 라이브러리로 공개했습니다. 저자에게 박수를 보냅니다! 이 라이브러리는 개인적으로 사용하거나 다른 오픈 소스 출판물에서 사용할 수 있지만, 이 코드를 출판물에서 재사용하는 것은 하우스 룰에 의해 관리됩니다.