PINE LIBRARY

offline_detection Library

ảnh chụp nhanh

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.

Example:


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.
alertsdebuggingofflinetimesessions

Thư viện Pine

Theo tinh thần TradingView thực sự, tác giả đã xuất bản mã Pine này dưới dạng thư viện nguồn mở để các lập trình viên Pine khác trong cộng đồng của chúng tôi có thể sử dụng lại. Chúc mừng tác giả! Bạn có thể sử dụng thư viện này riêng tư hoặc trong các bài đăng nguồn mở khác. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ.


My published indicators: tradingview.com/u/NeoButane/

Sorry if I haven't replied to your message yet, I'm a bit backlogged :)
Ngoài ra, trên:

Thông báo miễn trừ trách nhiệm