You could write the formulas from scratch, although personally, I have found many to be tediously complex and indecipherable, especially when trying to re-interpret them from other applications such as Metastock. A good dll to add to your library is TA-Lib, this comes with a comprehensive list of functions that will set you on your way. Best of all it is opensource which is fairly unusual for anything finance-related.
Just a few tips on using these functions in your C# programs - I assume you are retrieving your data from an SQL database - first, you need to retrieve your data as an strongly-typed list object:
IOrderedQueryable<Price> prices = (from p in _db.Prices
where p.Date <= date
where p.Date >= _earliestDate
where p.Epic == epic
orderby p.Date ascending
select p);
Next, as most functions in TA-Lib want double arrays (double[]) for input prices, you need to cast your data as follows:
double[] priceCloseSubset = (from p in prices select Convert.ToDouble(p.Close)).ToArray();
You should now be able to utilise these functions in your own designs.
No comments:
Post a Comment