QUOTE:
I have a database table which contains news headlines (short text strings) that I'd like to be able to display on a chart with AnnotateBar().
Let me start by saying that is a task for a
fundamental provider, making the news items accessible and plottable like usual fundamental items. We've developed a couple of news providers that download news items from web/RSS:
Google News provider, Reuters News provider. This way of handling news items is more elegant than using AnnotateBar() to plot the strings but requires some development effort. Fortunately, we've got some sample C# code of a fundamental provider to help you get going:
Home - MS123 ProvidersTaking my idea further, you can even apply text sentiment analysis to your news items using
AlchemyAPI IBM Natural Language Understanding.
QUOTE:
OK, partially answered my own question with the "NamedSeries" option in the static provider. It didn't complain when I added a string variable to it, but I'm not getting anything out of it
Incorrect. Any DataSeries (including NamedSeries) can only hold values of type
double. There's no place for strings there.
QUOTE:
So, is there a way that the database provider is useful to me, or do I need to just somehow connect directly to the database from C# code (connection string etc...)?
No, the Database provider is not useful for this. (This closely related thread may have more explanations:
Database fundamental provider request). If the task of building a new fundamental provider seems too complicated for you, then you can:
1. Connect to the database programmatically in a WealthScript Strategy (or come up with a class library to handle this part, allowing to reuse the code in different Strategies easily). There are
countless examples on the net.
2. Create a new class (e.g. NewsItem) with the timestamp and textual value of a news item and a new collection for storing them e.g. (a Dictionary or List<NewsItem>)
3. Grab the data, parse, fill up your collection by creating new NewsItems and adding them to the collection
4. Finally, loop by the collection and plot the items using AnnotateBar etc.