NexusFi: Find Your Edge


Home Menu

 





C++ C# or C for backtesting (no ninja or multicharts C#, vanilla only with libraries)


Discussion in Platforms and Indicators

Updated
      Top Posters
    1. looks_one treydog999 with 3 posts (2 thanks)
    2. looks_two Jasonnator with 2 posts (1 thanks)
    3. looks_3 Koepisch with 2 posts (2 thanks)
    4. looks_4 pstrusi with 2 posts (2 thanks)
      Best Posters
    1. looks_one pstrusi with 1 thanks per post
    2. looks_two Koepisch with 1 thanks per post
    3. looks_3 treydog999 with 0.7 thanks per post
    4. looks_4 Jasonnator with 0.5 thanks per post
    1. trending_up 7,648 views
    2. thumb_up 7 thanks given
    3. group 8 followers
    1. forum 11 posts
    2. attach_file 0 attachments




 
Search this Thread

C++ C# or C for backtesting (no ninja or multicharts C#, vanilla only with libraries)

  #1 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039

I am wondering if anyone has any experience doing backtesting and pricing in C/C++ family of languages. I want to exclude ninjatrader and Multicharts C# versions due to the fact it is actually wrappered using their own proprietary platform. I am thinking in a platform independent and totally customization solution.

I was looking at QuantLib library. Anyone have any experience?

For a end to end tech stack, from backtesting to deployment I think C family languages will execute the fastest but develop the slowest. Also opinions on the garbage collection of C# vs C++? Any thoughts?

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
Better Renko Gaps
The Elite Circle
NexusFi Journal Challenge - April 2024
Feedback and Announcements
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Exit Strategy
NinjaTrader
 
  #3 (permalink)
 Koepisch 
@ Germany
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: FDAX
Posts: 569 since Nov 2011
Thanks Given: 440
Thanks Received: 518


I've build my own test environment to be independent from other Software vendors. It's a tough way because you have to build every functionality by yourself. But therefore you can focus your work at special topics, which are much important for your type of system. It's not a generic approach, but you can iterate thru your system development much faster. I use C# because i have to develop as fast as possible. It doesn't bother me if the backtest runs in seconds or minutes. You can even optimize C# code.

If you use plain C# and common components you can always transfer your c# code (trading system core - no gui stuff) into c++ code easily. There are a some tools for it available.

Reply With Quote
Thanked by:
  #4 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039


Koepisch View Post
I've build my own test environment to be independent from other Software vendors. It's a tough way because you have to build every functionality by yourself. But therefore you can focus your work at special topics, which are much important for your type of system. It's not a generic approach, but you can iterate thru your system development much faster. I use C# because i have to develop as fast as possible. It doesn't bother me if the backtest runs in seconds or minutes. You can even optimize C# code.

If you use plain C# and common components you can always transfer your c# code (trading system core - no gui stuff) into c++ code easily. There are a some tools for it available.

Thanks for the reply. What do you think of doing your stuff in MATLAB / R / PYTHON for rapid proto typing first then "translating" to C# C++. I mean it is a lot of hassle and may introduce new bugs, but it may be worth it as you can test more models more quickly. Although I think the end to end tech stack solution has a lot of pluses it also requires the most amount of development time as you mentioned. Atleast R / MATLAB / Python have pre built backtesting and statistical analysis tools vs say C++ which has Quantlib but its pretty stark compared to R which has 8000 or so librarys.

Started this thread Reply With Quote
  #5 (permalink)
 Koepisch 
@ Germany
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: FDAX
Posts: 569 since Nov 2011
Thanks Given: 440
Thanks Received: 518


treydog999 View Post
Thanks for the reply. What do you think of doing your stuff in MATLAB / R / PYTHON for rapid proto typing first then "translating" to C# C++. I mean it is a lot of hassle and may introduce new bugs, but it may be worth it as you can test more models more quickly. Although I think the end to end tech stack solution has a lot of pluses it also requires the most amount of development time as you mentioned. Atleast R / MATLAB / Python have pre built backtesting and statistical analysis tools vs say C++ which has Quantlib but its pretty stark compared to R which has 8000 or so librarys.

I looked at python and numpy in the past, but because i was new to it i never would as fast as in my current programming language. For myself i don't waste any time in searching for the approbiate library or getting familiar with it. If i need a functionality i'm much quicker in doing it myself with lots of freedom how to do it. But if you want get much of common statistics/functions which a "Quant Lib" provides, then invest time in evaluating these libs.

Reply With Quote
Thanked by:
  #6 (permalink)
Piasa
New York City + New York
 
Posts: 2 since Apr 2015
Thanks Given: 7
Thanks Received: 0

For the last 5 years I've used R as my primary quant tool. The number of functions and libraries is vast. And over the last year and a half the execution speed has become very high, probably due to the core routines being converted to c++. The greatest advantages, compared to other platforms and systems I've used is in the very powerful date/calendar management libraries, wide variety of high-quality graphics and charting packages, and finally the comprehensive statistical and optimization tools. Also useful are the data loading connections to a variety of the usual data sources. Also its free.

The R user community has grown rapidly, especially over the last 3 or 4 years. It is well on its way to outpacing SAS as the most popular data analysis system.

There are two challenges to using R (1) The script-learning curve is a bit steep. The syntax is powerful, but is a somewhat confusing mix of functional and object-oriented paradigms, and (2) Choosing the best libraries amongst the >5000 and counting, is a challenge. The best starting point is to read some of the introductory articles and guides found on the R foundation web site. It's worth considering if you plan on extensive back testing and modeling efforts.

Reply With Quote
  #7 (permalink)
 
treydog999's Avatar
 treydog999 
seoul, Korea
 
Experience: Intermediate
Platform: Multicharts
Broker: CQG, DTN IQfeed
Trading: YM 6E
Posts: 897 since Jul 2012
Thanks Given: 291
Thanks Received: 1,039


Piasa View Post
For the last 5 years I've used R as my primary quant tool. The number of functions and libraries is vast. And over the last year and a half the execution speed has become very high, probably due to the core routines being converted to c++. The greatest advantages, compared to other platforms and systems I've used is in the very powerful date/calendar management libraries, wide variety of high-quality graphics and charting packages, and finally the comprehensive statistical and optimization tools. Also useful are the data loading connections to a variety of the usual data sources. Also its free.

The R user community has grown rapidly, especially over the last 3 or 4 years. It is well on its way to outpacing SAS as the most popular data analysis system.

There are two challenges to using R (1) The script-learning curve is a bit steep. The syntax is powerful, but is a somewhat confusing mix of functional and object-oriented paradigms, and (2) Choosing the best libraries amongst the >5000 and counting, is a challenge. The best starting point is to read some of the introductory articles and guides found on the R foundation web site. It's worth considering if you plan on extensive back testing and modeling efforts.

Thanks for recommending R, I am actually fairly well versed in it myself. However it is just not fast enough. Yes the underlying libraries may be written in C/C++/Fortran, however control structures (for loops, if else) are really slow. apply functions works fine if you just want to run something against all the rows of something, or all the columns of something. But it does not work for creating an event based back tester, which requires for loops in order to expose each new event or tick.

Also the multi core/parallel functionality of R is low, python is worse with its GIL(global interpreter lock). But if you are going to work with intraday data on dozens of instruments your going to be waiting hours. C#/C++/Java etc have much better parallel computing capabilities.

Started this thread Reply With Quote
  #8 (permalink)
 
baywolf's Avatar
 baywolf 
San Diego, CA
 
Experience: Intermediate
Platform: TT Pro
Broker: Advantage
Trading: Gasoil, heatoil, crude
Posts: 55 since Sep 2009
Thanks Given: 26
Thanks Received: 33

To answer your original question, yes I have experience with C# and backtesting. For similar reason as Koepisch, I am more productive with C# syntax. For me, coder productivity is the most important thing. Coder enjoyment comes in second. Execution performance has not been an issue for me with C#.

Now, that being said, If I began my journey today, I would go with Python. I am slowly switching over to python in my dev environment, fwiw.

For me, python is also enjoyable to write. The syntax just makes sense to me, where as when I started (and failed) to learn R, it was nothing but frustration. I knew I wasnt going to be happy so I stopped early in to my education.

Python also has a following in the data science community. In higher education it appears they either will gravitate towards python or R. So I guess either will be fine. My thinking is that if you come from a computer science background you should go python, and if you feel more comfortable working with GUI based tools, then maybe you might choose R?

Reply With Quote
  #9 (permalink)
 
Jasonnator's Avatar
 Jasonnator 
Denver, Colorado United States
 
Experience: Intermediate
Platform: NT8 + Custom
Broker: NT Brokerage, Kinetick, IQFeed, Interactive Brokers
Trading: ES
Posts: 159 since Dec 2014
Thanks Given: 40
Thanks Received: 166

I'm taking a close look at StockSharp for exactly that; a true tick level backtester. Depending on your C# abilities, it might be worth a look.

Reply With Quote
  #10 (permalink)
pstrusi
Lalin Pontevedra Spain
 
Posts: 20 since Sep 2013
Thanks Given: 10
Thanks Received: 9


I've been reading a couple interesting opinions here regarding building your own, independent trading platform, so ditching any third-party software. I'm an intermediate level programming skill trader, basically in C#. I've been wondering if is it really worth programming your own platform in a Broker's Api, looking for achieving better performance, solving sync issues...etc To be honest I've been analyzing a couple of advanced samples and it seems to be really out of my league.

Any comment will be highly appreciated

Reply With Quote
Thanked by:




Last Updated on November 2, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts