Click here to Login




How to create buy and sell trading rules based on News Data

Updated on 2011-11-01





To create buy and sell trading rules based on news, you need to download news data first. Fortunately, there are several news data downloaders available in the QuantShare sharing server. You can for example download news releases, articles, blog post titles, tweets...

Each downloader gets data for the ticker symbols you specify and stores it in a custom database. For example, the Historical Stock Market News item gets RSS feeds from Google, downloads more than 3 years worth of news items and saves the data in a custom database whose name is "google_news". This database contains three fields: date (news release date), title (The title of the news release) and description (A brief description of the content of the news release).


Here are some other interesting downloaders:

- Currency Pairs Calendar Data: Gets economic calendar events for the most traded FX pairs (including EUR/USD, GBP/USD and USD/CAD)

- Currency Trading News from Yahoo - Forex Market: Downloads trading news for several Forex pairs

- StockTwits: Downloads realtime tweets for the US stock market. You can use this item to get tweets for the Forex and futures markets.

- Recent Insider Buying and Selling for US Stocks: Retrieves insider trading news (buying and selling activity data)

- Stock News from Articles, Bloggers, Columnists, Traders and Analysts: Gets articles for U.S. stocks from a variety of blogs and online newspapers.


Now, let us download some news data using the Historical Stock Market News item.

- First, download this item from the sharing server (click on the above link, click on "Download" then follow the instructions)
- In QuantShare trading software, select "Download" then "Download manager"
- Select the item you have just downloaded then click on "Open Selected Downloader"
- In "Symbols" field, select one or several stocks then click on "Start Downloading"


How to display these news releases

There are mainly two ways to display the trading news releases you have previously downloaded:

- Database Editor
- Database Data Viewer

Database Editor:

- Select "Data" then "Edit databases"
- Select "Custom" then "google_news"
- Select the "Databases" tab then select a symbol (stock, currency pair, futures symbol...)

Data is displayed on the right panel. You can add, remove and update rows or fields and export the data to CSV format.

Database Data Viewer:

- In the main menu, select "Tools" then "Database Data"
- Select "google_news" database to display news release for the active chart stock or for a list of stocks (Click next to "Filters" to update the symbols criteria)

This tool allows you to display news releases and lets you filter news by a specific keyword. To do this, type a keyword next to "Search" and select a field (Example: Title).



Note: To display stock trading news on a chart, click on "Show data on chart".




Create news-related trading rules

News data can be plotted on a chart, used in a screen or watchlist, backtested in a trading system or used in portfolio to generate buy and sell signals. You may even develop market composites based on it. Example: Number of news articles that contains the word "rise" for each trading bar across all stocks in the U.S. Stock Market.

There are several functions you can use to retrieve and analyze custom database data in QuantShare language.

For a complete list:

- Open the "Add Indicator" control (Right click on a chart, select "Edit Formula" then click on "Add Indicator")
- In "All Indicators" tab, select "database" category

The "GetDataCount" function for example calculates the number of items (News releases in this case) that occurred in each trading bar period.
The "GetDataStringCount" function returns, for each trading bar, the number of news releases that contains a given keyword.

Example of a trading system:

buy = GetDataStringCount("google_news", "title", "buy") > 0;
sell = GetDataStringCount("google_news", "title", "sell") > 0 or GetDataStringCount("google_news", "title", "down") > 0;


The above formula can be backtested using the simulator or added to a portfolio strategy.

Interpretation:

Enters a long trade/order if a news release contains the word "buy"
Exits an existing position if a news release contains the word "sell" or the word "down"


Trading the news using advanced rules

To create advanced news based rules, you can implement your own indicators using "Create Functions" tool.

- Select "Tools" then "Create Functions"
- Click on "Add", type the indicator name then click on "Save Item"
- News data can be referenced using the "cFunctions.GetCustomDatabaseData" function.

Here is how to implement the built-in "GetDataCount" function:

VectorCustom vc = cFunctions.GetCustomDatabaseData("google_news", "title");
for(int i=0;i < vc.Length;i++)
{
  result[i] = vc[i].Length;
}



Here are some advanced news based trading indicators: (You can edit each indicator to see how it is implemented)

- News parser function: Returns whether a news release contains a specific word from a list of words passed to the function.

- News Sentiment Indicator: Calculates a sentiment measure by counting the number of bullish or positive words and then subtracting this value by the number of bearish or negative words.

- Word Occurrence in News Titles - Quantitative Trading Analysis: This function facilitates the optimization of news-based trading strategies. Read the trading object description for more information.


These functions can be applied, in day trading and EOD trading, to create quantitative strategies based on news releases, tweets, economic releases, futures reports...












no comments (Log in)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1481 days ago

Profile Graphs
Posted 1586 days ago

QuantShare
Previous Posts

More Posts

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.