Biên tập viên chọnOPEN-SOURCE SCRIPT

Live Economic Calendar by toodegrees

Cập nhật
⚠️ PLEASE READ ⚠️
Although this indicator is accurate in showcasing live and upcoming News Events, checking the original sources is always suggested. This indicator aims to save Time, but due to limitations it may not be 100% correct 100% of the Time.

Description:
The Live Economic Calendar indicator seamlessly integrates with external news sources to provide real-Time, upcoming, and past financial news directly on your Tradingview chart.

By having a clear understanding of when news are planned to be released, as well as their respective impact, analysts can prepare their weeks and days in advance. These injections of volatility can be harnessed by analysts to support their thesis, or may want to be avoided to ensure higher probability market conditions. Fundamentals and news releases transcend the boundaries of technical analysis, as their effects are difficult to predict or estimate.

Designed for both novice and experienced traders, the Live Economic Calendar indicator enhances your analysis by keeping you informed of the latest and upcoming market-moving news.

This is achieved with three different visual components:
  1. News Table: A dedicated News Table shows the Day of the Week, Date, Time of the Day, Currency, Expected Impact, and News Name for each event (in chronological order). Once a news event has occurred, or the day is over, it will be greyed out – helping to focus on the next upcoming news events.
    ảnh chụp nhanh
  2. News Lines: Vertical lines plotted in the future help analysts monitor upcoming news events; vertical lines in the past help analysts spot and backtest previous news events that already occurred.
    ảnh chụp nhanh
  3. News Labels: Color-coded news labels will plot once the news events have occurred. This not only gives analysts a minimalistic visual cue, but also retains the information of which news were released at that Time in their tooltips.
    ảnh chụp nhanh


Forex Factory Calendar News Feed:
The Forex Factory Data Feed includes news events from January 2007 to the present. The data is updated daily. Please see the Technical Description below for more information.
ảnh chụp nhanh

Forex Factory provides news for all major currencies and markets:
  • Australia (AUD)
  • Canada (CAD)
  • Switzerland (CHF)
  • China (CNY)
  • European Union (EUR)
  • United Kingdom (GBP)
  • Japan (JPY)
  • New Zealand (NZD)
  • United States of America (USD)


Further, there are four types of news impact, defined by respective color-coding which is retained to avoid confusion:
  • ⚪ Holiday
  • 🟡 Low Impact
  • 🟠 Medium Impact
  • 🔴 High Impact


News' Time of the day data is in 24H format, and 'All Day' news are marked at Daily candle open.

⚠️ Original Release Notes ⚠️
  • The original release of this indicator supports the Forex Factory News Calendar in EST (New York Time). Future updates will include multiple news sources, as well as supporting different Timezones.
  • Given Data limitations, the Daily chart can omit some data due to the market being close on some days. This will be fixed in the future once an efficient solution is implemented.


Key Features:
  • Impact-Based News Filtering: Filter news items based on their expected impact (holiday, low, medium, high) to focus on the most market-critical information.
  • Symbol-Specific News: Automatically filter news to display only what's relevant to the currency pair or trading symbol you are analyzing.
  • Custom Currency News: Want to see more than the news relevant to the current symbol? Toggle which markets' news you are most interested in.
  • Chart History: Keep your charts clean by displaying only the drawings of Today's news, or This Week's news.
  • Custom Lookback: Look further back in Time by choosing a custom number of Lookback Days, allowing you to backtest and keep in mind salient news events from the past.
  • Line and Label Customization: Both the News Lines and Labels are highly customizable (except the colors), allowing you to make the indicator yours.
  • Table History: Choose whether to focus on Today's news only, or the news for This Week.
  • Table Customization: The table colors and position are highly customizable, allowing you to make it fit your visual preference and your layouts' aesthetic.




Technical Description:
This script utilizes Pine Seeds, a service integrated with TradingView for importing custom data. This stunning feature enables users to upload and access custom End Of Day (EOD) data, which can be updated as frequently as five times daily.

This data can be imported in one of two formats:
  • Single Value: integer or float
  • Candle Data: open, high, low, close, volume


Upon encountering Pine Seeds, I recognized its potential for importing financial news events. Given that Forex Factory is a primary source of financial news in my personal analysis, integrating it into my layouts seemed like an exciting opportunity. This integration is expected to provide significant value to users looking to integrate additional news feeds all in one place.

Development Challenges:
  1. Format Limitations: News events must be converted into numerical values for import, due to the required Pine Seeds format.
  2. Amount of Data: With all currencies considered, the system may encounter over 40 news events in a single day.
  3. Data Availability: The reliance on End Of Day (EOD) data means that information for the current day is displayed with a delay, and accessing future data is not possible.


Solutions:
  1. Encoding: Each news event is encoded as an integer in the "DCHHMMITYP" format.
    D = day of the week
    C = currency
    HHMM = Time of day
    I = news impact
    TYP = event ID (see Event Library A and Event Library B)
    To ensure data assignment for each candle across the open, high, low, close, and volume series, the value "999" is used as a placeholder:
    ảnh chụp nhanh
  2. Importing: Utilizing the encoding system, up to five news events per day can be imported for a singular Pine Seeds custom symbol.
    By creating multiple custom Pine Seeds Symbols, efficient imports of a larger number of events is then easily achievable. Nine unique symbols have been established, accommodating up to 45 news events per day.
    These symbols are searchable, and accessible as "TOODEGREES_FOREX_FACTORY_SLOT_N" where N ranges from 1 to 9.

    The Pine Seeds data feed appears as follows:
    ảnh chụp nhanh
  3. Uploading Schedule: To ensure analysts are informed about current and upcoming week's news, events are uploaded one week in advance.
    This approach is vital for preparing for potential market impacts across various asset classes and currencies, allowing visibility of an entire week's news ahead of Time.
    ảnh chụp nhanh


Data Scraping:
Unfortunately Forex Factory doesn't offer an API to fetch their news feed.
Hence an ad hoc python scraper was developed to read and save news events from January 2007 till the present leveraging Selenium. The scraper algorithm is part of a larger script responsible for scraping data, formatting data, and creating all necessary datasets.

The pseudo-code for the python script is as follows:
  1. Read and save news event data on Forex Factory
  2. Format day of the week, currency, Time of the day, and impact data for the Encoding
  3. Encode and save News Event IDs – Event ID dataset is created
  4. Format news data for Pine Seeds (roll-back date by one week, assign news to open, high, low, close, and volume values)
  5. Create Pine Seeds Datasets

This script is ran everyday at Futures market close (16:00 EST) to update the last part of the each dataset, ensuring accuracy, and taking into account last-minute news additions or revisions.

Once the data (next week's news) is imported by the Live Economic Calendar indicator, it's immediately decoded by leveraging the Forex Factory Decoding Library, and saved into an array.

Upon a new week open, the decoded data is used to plot news events on the chart and in the news table.
See the inner workings of these processes in the Forex Factory Utility Library.

Although these libraries are specifically built for this indicator, feel free to use them to create your own scripts. Looking forward to see what the Pine Script community comes up with!

Thank you for making it this far. Enjoy!
Ciao,
toodegrees



This tool is available ONLY on the TradingView platform.

Terms and Conditions
  • Our charting tools are provided for informational and educational purposes only and do not constitute financial, investment, or trading advice. Our charting tools are not designed to predict market movements or provide specific recommendations. Users should be aware that past performance is not indicative of future results and should not be relied upon for making financial decisions. By using our charting tools, the user agrees that Toodegrees and the Toodegrees Team are not responsible for any decisions made based on the information provided by these charting tools. The user assumes full responsibility and liability for any actions taken and the consequences thereof, including any loss of money or investments that may occur as a result of using these products. Hence, by using these charting tools, the user accepts and acknowledges that Toodegrees and the Toodegrees Team are not liable nor responsible for any unwanted outcome that arises from the development, or the use of these charting tools. Finally, the user indemnifies Toodegrees and the Toodegrees Team from any and all liability.
  • By continuing to use these charting tools, the user acknowledges and agrees to the Terms and Conditions outlined in this legal disclaimer.
Phát hành các Ghi chú
Main Image Update
Phát hành các Ghi chú
Added option to show/hide label outline
Phát hành các Ghi chú
Bug Fixes in Bubble Sort – some events were being lost in the process, fixed
Phát hành các Ghi chú
To see changes, please remove the Live Economic Calendar from the chart, refresh your browser or TV app, then re-add to the chart!

– Temporarily removed "Past" option for line plotting, not compatible at the moment
– Added option to show Time of Day in AM/PM format
– Fixed bug where lines before the selected viewing interval were not showing

Phát hành các Ghi chú
Added Custom Timezone Feature!

To see changes: remove indicator from the chart, refresh TradingView, re-add to the chart.
Phát hành các Ghi chú
To see changes, please remove the Live Economic Calendar from the chart, refresh your browser or TV app, then re-add to the chart!

  • Fixed Bug where dates were formatted incorrectly.
    ảnh chụp nhanh
  • Fixed Bug where news were duplicated.
  • Found a more efficient solution to Market Close days problem.

Phát hành các Ghi chú
To see changes, please remove the Live Economic Calendar from the chart, refresh your browser or TV app, then re-add to the chart!

  • Fixed bug where news were displaying as "already occurred" but they were yet to be released.
Phát hành các Ghi chú
To see changes, please remove the Live Economic Calendar from the chart, refresh your browser or TV app, then re-add to the chart!

Updated Event ID Libraries
Phát hành các Ghi chú
Library Update
Phát hành các Ghi chú
To see changes, please remove the Live Economic Calendar from the chart, refresh your browser or TV app, then re-add to the chart!

Updated Event ID Libraries
Phát hành các Ghi chú
Updated Libraries
Phát hành các Ghi chú
To see the updated version, remove and re-add the tool to your chart.
  • Updated Event List
Phát hành các Ghi chú
To see the updated version, remove and re-add the tool to your chart.
  • Updated Event List
Phát hành các Ghi chú
To see the updated version, remove and re-add the tool to your chart.
  • Updated Event List
Phát hành các Ghi chú
To see the updated version, remove and re-add the tool to your chart.
  • Fixed Local Scope Error Limit
Phát hành các Ghi chú
Event 'FOMC Member Hammack Speaks' not found in legend.
Adding to Event Library B with ID 583.
Phát hành các Ghi chú
  • Event 'SNB Chairman Schlegel Speaks' not found in legend.
    Adding to Event Library B with ID 584.
  • Event 'FOMC Member Schmid Speaks' not found in legend.
    Adding to Event Library B with ID 585.


Phát hành các Ghi chú
Event 'Gov Board Member Tschudin Speaks' not found in legend. Adding to Event Library B with ID 586.
Phát hành các Ghi chú
Event 'MPC Member Lombardelli Speaks' not found in legend. Adding with ID 587.
Cyclesforecasting

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?


homo faber fortunæ suæ
Ngoài ra, trên:

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