WHY C++ ...

Discussions about custom-built testing platforms written in C, C++, or Java.
Post Reply
Robert Nio
Senior Member
Senior Member
Posts: 41
Joined: Thu Apr 17, 2003 11:34 am
Location: Palo Alto, California

WHY C++ ...

Post by Robert Nio »

I wrote part of the following in a previous post but I think it is worth repeating here:


When you use a commercial or freeware program, it will most likely do a great job at its core competency and those core functions usually work without major bugs. HOWEVER, people tend to push the limits and try to use those tools outside their intended purposes / core competencies. The results are unstable performances, erroneous calculations etc. etc.

Take MetaStock as an example; its great for charting and even has a programming language to create individual indicators / signals. But the “formula languageâ€
Kiwi
Roundtable Knight
Roundtable Knight
Posts: 513
Joined: Wed Apr 16, 2003 1:18 am
Location: Nowhere near

Post by Kiwi »

Having learned fortran, 3 types of assembly language, pascal, modula and a basic variant in my engineering days I have resisted learning C and Visual Basic. I moved from Metastock to Tradestation and Easylanguage (haha) when I moved to futures because the system tester dealt more accurately with entries and exits and because I no longer needed to scan a universe of stocks.

Just recently I got involved in building a multientry multiexit (up to 15 positions) system and discovered that in this environment TS falls apart unpredictably. So this system is running in an excel spreadsheet. Twice I nearly started to learn visual basic but I have resisted so far - it would have been much easier if I had!

Despite this I still run everything else in Tradestation because the visuals are better and I still like to look at trendlines and median lines. Perhaps when I have a learnt all I want to about statistics I'll learn Visual Basic and rewrite it again for fun.
Forum Mgmnt
Roundtable Knight
Roundtable Knight
Posts: 1842
Joined: Tue Apr 15, 2003 11:02 am
Contact:

Post by Forum Mgmnt »

The reason I ended up coding my own testing platform in C++ is that I hate to have limitations imposed on my testing. I also like to have really fast tools. I don't like to wait; I want testing to be fairly interactive, not test, wait, wait, wait, think of new test, test, wait, wait...

C++ gives you access to anything that can be done on a computer. You won't run into any limitations that are not also limitations of the hardware or operating system.

I also happened to be very good at programming already so the decision was easier. I got my first job programming when I was 16, writing commodity trading system simulations in BASIC on the Apple II and TRS-DOS computers for a commercial venture run by a guy who lived in my hometown of Harvard, MA.

We are already somewhat limited in that simulations often have to make approximations and guesses using limited information. There is not a lot of historical tick-data for the years before the late 80s, for example. So I hate to add to those inherent limitations by adding those caused by my choice of tools.

The last thing I want is to have a limitation caused by someone else not anticipating my needs or by an unsophisticated programming paradigm.

I also like to do things on the leading-edge which almost always means that generalized tools won't do what you want.

On the other hand, it certainly is possible to create a testing platform that allows both C++ and Visual Basic type access for easy coding of systems like TradeStation or Trading Recipes, but without any of their current limitations. :wink:

If there was a market for it I might just do it myself. Unfortunately, a lot of people tend to be dumb when it comes to software. They'll spend 100s of hours working around stupid tools, they'll lose $1,000s on poor trading systems because of limitations in their tools, but they'll make their software decisions on the basis of whether or not something costs $500 or $5,000.
Sir G
Moderator
Moderator
Posts: 243
Joined: Wed Apr 16, 2003 12:21 am
Location: Salt Lake City, Utah

Post by Sir G »

c.f.-

Can you give us some sort an idea of the speed difference between VB.net & C++?

Gordon
Robert Nio
Senior Member
Senior Member
Posts: 41
Joined: Thu Apr 17, 2003 11:34 am
Location: Palo Alto, California

Post by Robert Nio »

Sir G,

C++.NET is in an odd position. Microsoft are punting C# as the .NET language for C++ and Java programmers, so the inclusion of C++.NET as a core language that ships with both the .NET Framework SDK and Visual Studio.NET can create confusion.

The silver bullet going for C++.NET is that it is the only .NET language that can compile directly to native code, rather than MSIL. It also follows on from Visual C++ 6's ATL and MFC support, and may provide a good migration point for C++ applications to .NET. It's ATL Server and ATL Web Service project type support is also unique and isn't included in any other .NET language.

However, current support in the development community seems to be lackluster at best, with far fewer C++.NET resources than ones for C# or VB.NET. C++.NET is probably the natural choice for migrating pre-.NET C++ applications to .NET, and it's several niche features, such as its ability to compile not native code and to run in an unmanaged environment may secure it's place in the .NET future for a while to come, but more as a niche player than the mainstream languages C# and VB.NET.

.NET is a very fascinating tool to develop with, as it negates many of the traditional advantages and disadvantages of one language over another by providing a central method of execution, so speed differences between languages are negligible, and making a central repository of classes available so that for the most part, any language can do anything any other one can do. Learning to program in a .NET language is much more a case of learning how to use the .NET base classes than using the actual language itself, and experienced developers particularly will find that after a few weeks of developing in one .NET language, to jump to another will be very small indeed, as the use of classes between all the languages is almost identical.

One might squeeze a little more speed out of your development using C++ just because you have “finerâ€
Lquestfree
Full Member
Full Member
Posts: 15
Joined: Sun Apr 20, 2003 4:10 pm

Post by Lquestfree »

Sir G wrote:c.f.-

Can you give us some sort an idea of the speed difference between VB.net & C++?

Gordon

Below are some articles I came across. They provide some numbers but I'm not sure about the testing methodology ie there may be some flaws. Ultimately, using the lower level C++ language will allow you to tweak low - level processes like memory management which will lead to substantial performance gains.

But the ease of use of RAD language like VB.net plus access the feature-rich .NET framework can not be ignored. It makes the whole development process much more enjoyable.


Benchmarks managed vs native:

http://www.vb-faq.com/Articles/Gile/raw_performance.asp

http://www.devhood.com/Tutorials/tutori ... ial_id=203

http://www.codeproject.com/dotnet/Prime ... ojects.asp


If you should decide to use vb.net here are some performance considerations to keep in mind:

http://www.fawcette.com/vsm/2002_08/mag ... ult_pf.asp

http://www.msdn.microsoft.com/library/d ... ftechs.asp

http://www.msdn.microsoft.com/library/d ... rftips.asp

http://www.msdn.microsoft.com/library/d ... erfopt.asp

http://www.msdnaa.net/Resources/Display.aspx?ResID=862

Hope this helps,

J
GuyPapyrus
Contributor
Contributor
Posts: 2
Joined: Tue May 13, 2003 3:12 pm

How about Java?

Post by GuyPapyrus »

Do any trader/programmers (any here, not in the world :wink: )actively use Java as their language/platform of choice?

GP
Lquestfree
Full Member
Full Member
Posts: 15
Joined: Sun Apr 20, 2003 4:10 pm

Re: How about Java?

Post by Lquestfree »

GuyPapyrus wrote:Do any trader/programmers (any here, not in the world :wink: )actively use Java as their language/platform of choice?

GP
No Java, but i do use c# which has very similar syntax to java as well as similar performance...
RusselHarvey
Contributor
Contributor
Posts: 1
Joined: Mon Dec 15, 2003 3:29 pm

Post by RusselHarvey »

C# or Java should give enought advantage on par with C++ programming for trading system development, plus more and more the module and source code available on both commercial market as well as open source community.
Roscoe
Roundtable Knight
Roundtable Knight
Posts: 250
Joined: Sat Jan 24, 2004 2:06 am
Location: Houston TX

Post by Roscoe »

I elected to go the self-developed route after years of frustration with EasyLanguage, however it soon became apparent that the potential cost could be easily become extreme given the fact that I would have to hire some programming expertise. Next step: look around to see what else was available.

After spending some time evaluating various languages I settled on C++ for two simple reasons: 1: I had to commit to learning a language, and the range of available support for C++ is vast - books, courses, etc; and 2: I found a pre-release commercial package that had all my requirements (open architecture, integrated portfolio and position-sizing) that used C++ as the native language.

I have been using this environment for 18 months now and I am very pleased with the move - the flexibility of C++ is wonderful! Still a lot of learning to do, but I can code pretty much anything I can imagine (although some of my imaginings take a lot of working out!)

The speed of C++ is very noticeable - large test runs take minutes at most, and the code can be disarmingly simple in parts.
fliesch
Full Member
Full Member
Posts: 10
Joined: Sat Jan 10, 2004 9:36 am
Location: Switzerland

Post by fliesch »

Do you use Smartquant (now quantstudio)?

fliesch
Roscoe
Roundtable Knight
Roundtable Knight
Posts: 250
Joined: Sat Jan 24, 2004 2:06 am
Location: Houston TX

Post by Roscoe »

fliesch wrote:Do you use Smartquant (now quantstudio)?

fliesch
No.
sskappel
Contributor
Contributor
Posts: 1
Joined: Sun Mar 07, 2004 11:15 am

Implementing c++ into EasyLanguage real-time?

Post by sskappel »

I've just started to write in EasyLanguage. And I agree it's very frustrating when you know how c++ and java works.

But are there any ways of implementing c++ code to have a running real-time strategy, as you do when using EasyLanguage alone?

I have done some basic programming in c, c++ and java, and my brain works very well with programming. However, I'm not an expert on this field, and I don't know what DLL is, yet...
ksberg
Roundtable Knight
Roundtable Knight
Posts: 208
Joined: Fri Jan 23, 2004 1:39 am
Location: San Diego

Re: How about Java?

Post by ksberg »

GuyPapyrus wrote:Do any trader/programmers (any here, not in the world :wink: )actively use Java as their language/platform of choice?
Yes, I think you'll find a few of here.

There are plenty of heated debates that take place around language. Many of these perpetuate myths or misunderstandings. For Java, one of the items commonly mentioned myths is speed. Without fanning the flames around benchmarking methods, know that modern JVMs are very fast and competitive. For my Java platform implementation, I'm able to crunch a few thousand portfolios per hour ... well ahead of what I've seen from Trading Recipes, and this is on a 900MHz pIII. My experience is similar with respect to charting and other platform features.

All languages/libraries/environments have their benefits and drawbacks. I think it pays to examine what your needs are before committing to implementation language, and then see how those needs are met by a particular choice. I would strongly emphasize that language itself is only part of the equation: the ability to integrate commercial or open source libraries was a prime concern for myself.

I code in several languages. In my experience, there is a qualitative difference around the Java community. I am far more likely to be able to integrate code libraries. Some of this is due to Java design: as a library consumer I don't have to ensure the memory model is correct, or a certain use of pointers, or use of the right collections library. I find there is also a greater notion of componentization and re-use within the community, and a substantial number of these within open source. For my C#/MSFT projects, I'm continually frustrated that either (a) there is a predominant focus on GUI widgets, (b) there are very few system-level components, or (c) I get nickle-and-dimed for the simplest functionality. In Java, I've integrated off-the-shelf OSS libraries for FTP and web-spiders (auto-collection of market data), job scheduling, writing excel files without needing Excel, writing PDF report output, doing scientific and statistical calculations, and numerous other things. The quality is high, the integration has been easy, and it all greatly furthers my productivity.

I will say that Java is not as well equipped for doing user interfaces. SWT (from IBM) is probably your best choice for a responsive GUI, otherwise you'll need to be adept in JFC (Swing) to make it sing. SWT interface respond as well as any native application (well, because they ARE native).

I am not a Java bigot. I would much rather code in Smalltalk or some fully dynamic OOPL (like Groovy). My first fully functional trading platform was written in Smalltalk ... <sigh>, never again! Not that I didn't love coding it. No, Smalltalk as a community dried up, and the major vendors pretty much disappeared. Yes, there's an OSS alternative, I don't consider Squeak a viable deployment platform. Anyway, I used ParcPlace/Digitalk at the time, and was left with an unsupported code base. There's a great deal to be said about having broad community support behind the language.

Anyway, my $0.02

Cheers,

Kevin
cut1
Contributor
Contributor
Posts: 1
Joined: Sat Mar 06, 2004 8:09 am

Post by cut1 »

@all

currently I found these Frameworks :

http://www.fmlabs.com/toolkit.htm
http://www.modulusfe.com/
http://www.smartquant.com/
http://www.quantlib.org/


I`m just looking for Charting libs and Data libs, so fmlabs and modulus would work best for me. any advices from your side ?

I`m just new into the C++ Language (know a little bit the API and how to construct Classes)


@Roscoe

wich Framework do you use ?
lkuoza
Contributor
Contributor
Posts: 3
Joined: Thu Mar 11, 2004 10:46 am

Another framework

Post by lkuoza »

There is another platform for back-testing your trading strategies - actiTRADER (http://www.actitrader.com/).

It is a Java-based freeware platform used for development, testing and execution your own trading strategies. If supports portfolio trading and dynamic money management.


As for the use of programming language I agree with RusselHarvey that
C# or Java should give enought advantage on par with C++ programming for trading system development, plus more and more the module and source code available on both commercial market as well as open source community.
At the same time Java is also cross-platform.
tobbe
Senior Member
Senior Member
Posts: 41
Joined: Sat Feb 21, 2004 4:25 pm

Java IDE

Post by tobbe »

If you're new to java and need a good IDE, have a look at http://www.eclipse.org. Its free, its great and a true rival to the MS Visual Studio/C# .NET IDE when it comes to functionality. I wish MS would implement some of the features in Visual Studio soon (refactoring support, testing support).

My own choice is C++ though.

Sorry if this was off topic. But I think nowadays an IDE is as important to productivity as is the language and class libraries (and of course, Emacs is an IDE, isn't it? :wink: ).

happy hacking,
tobbe
ricwa
Contributor
Contributor
Posts: 1
Joined: Wed Jul 21, 2004 10:35 am

MetaStock formula language in C# and VB.NET

Post by ricwa »

As far as charting, there is no better package than Dundas for the .NET platform (www.dundas.com). There's a learning curve (and it's not cheap) but they have a free unlimited trial period (puts a watermark on the chart stating that it's an eval copy).

As far as a programming framework, there is a new product comming out this late summer or fall that extends MetaStock's formula language to .NET. It allows you to embed MetaStock formulas in C# or VB.NET and code MetaStock formula expressions as an extension to the language. Send me a private message if you're interested in beta testing this. You need to have some experience in C# (VB.NET is in pre-beta and will not be supported until Visual Studio 2005)
Post Reply