Are there any free c++ libraries that would have some of the functions that would be used in developing a trading strategy. For instance, calculating drawdown, Volatility Forecasting, MAE, MFE....etc.

I know I could code these but this would help me save some time and focus on the strategy and not the report generations.


4 Answers 4


Here are some suggestions.

Search Amazon (or your favorite bookseller) for books concerning "C++ quantitative finance." I found several titles that look promising.

I went to SourceForge (searching on "Trading Systems") and saw several promising systems that might give you a leg up in drawdown, MAE, etc.

I use TradeStation 9.0 for comparing various trading strategies. It will provide MAE/MFE graphs, trade equity curves, and rank strategies based on maximum drawdown. But be sure to read Trading Systems That Work: Building and Evaluating Effective Trading Systems by Thomas Stridsman for an apt critique of TradeStation's generated reports.


These are the libraries I most prominently use for C++:

  1. QuantLib
  2. Boost C++ Libraries
  3. This is not specifically a library however it is extremely helpful, the Anaconda Compiler Tools.
  4. The Armadillo C++ library for linear algebra & scientific computing.
  5. The Intel Math Kernel Library for C++ (MKL).
  6. The Ta_Lib Technical Analysis Library has an API for C/C++.
  7. Eigen is a "C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms" as per their website. Eigen allows you to to do all sorts of computations with matrices of any size. It doesn't need anything other than the standard library, and the library tiself is standard with 98 to technically any C++m compiler should work (I use clang rather than GCC for the record, which you can install with sudo apt-get install clang).

As far as

calculating drawdown, Volatility Forecasting, MAE, MFE....etc.

goes, QuantLib does all of that and more! It is an extremely powerful library that can do a lot of things.


For actually creating your trading strategy, you could use the open-source TA-Lib (written in C/C++) available here. To test it, you could use R and the PerformanceAnalytics package.

  • 2
    $\begingroup$ Sorry, but this is a clear -1: TAlib is written in C and is, for better or worse, or technical analysis library. Why do you equate that to trading strategy? TAlib has nothing on drawdowns, vol forecasting etc pp. $\endgroup$ Commented Apr 2, 2011 at 21:09
  • $\begingroup$ The OP wanted "some of the functions that would be used in developing a trading strategy." Although I cannot quote any evidence in support, I am pretty sure that the tools of technical analysis are/can be used in developing such strategies. As to whether TAlib is written in C or C++, well I stand corrected. $\endgroup$ Commented Apr 3, 2011 at 14:37
  • $\begingroup$ C or C++? It is not the same $\endgroup$ Commented Apr 4, 2011 at 8:26
  • $\begingroup$ TAlib source is written in C, C++ Cli and Java $\endgroup$
    – ali_bahoo
    Commented Apr 7, 2011 at 10:36

QuantLib is widely used


  • 5
    $\begingroup$ Sorry, this doesn't answer the question: QuantLib is not for trading strategies but for derivative pricing. $\endgroup$
    – vonjd
    Commented Apr 1, 2011 at 17:20
  • 2
    $\begingroup$ @vonjd to me, derivative pricing is one of the part in the process of developing a trading strategy. $\endgroup$
    – phil
    Commented Apr 1, 2011 at 17:47
  • 2
    $\begingroup$ The question gives examples of what is meant: "calculating drawdown, Volatility Forecasting, MAE, MFE" - QuantLib can't do any of these. $\endgroup$
    – vonjd
    Commented Apr 1, 2011 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.