Datetime of events is defined by user in Settings via a standardized line of text.
Motivation for coding this script:
All traders should be aware of economic calendar events. At times, when you really need to pay attention to an upcoming major event, you might even decide to use the vertical-line drawing tool to mark it. However, this takes manual effort.
This script provides a solution to performing mundane tasks such as drawing vertical lines and dragging them ever so slightly, just to have them approximately aligned with exact time.
(1) Source data - String representation of collection of datetime referencing to Economic Calendar Events
(2) Line color, & (3) Width of line - For displaying vertical lines drawn by script.
Standardized format for Source Data:
If 'GMT;2022,6,1,14,0,0;2022,6,2,12,15,0;' is provided to PineScript, then two vertical lines will be drawn on June 6, 2022 according to the exact time in 'YYYY,MM,DD,hh,mm,ss' format at the specified timezone ( GMT in this case).
Template for Source Data:
Included here, link below, is a shared Google Sheet that systematically processes Economic Calendar data provided in the 'Raw Data' tab.
Users are advised to use their preferred methods* to format the string (for source data param.), and apply their own criteria to sort down the Events. ( ie . only include Events of High Impact, etc.)
* Preferred methods (as mentioned above) does not mean being limited to using the template as provided in this post.
- Adjusted settings UI with 'text_area'
(2) Implemented fail-safe approach to ensure most recent lines get drawn, ignoring oldest events when n > 500 (max no. of lines allowed to shown on chart by pine)
Thanks to @jdehorty for pointing this out and letting me use his logic for converting Unix time.
🧠 Advisory & Consulting - Pinescript
🤖 Algo Signals based on documented backtests
Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.