Jump to content

Welcome to the new Traders Laboratory! Please bear with us as we finish the migration over the next few days. If you find any issues, want to leave feedback, get in touch with us, or offer suggestions please post to the Support forum here.

  • Welcome Guests

    Welcome. You are currently viewing the forum as a guest which does not give you access to all the great features at Traders Laboratory such as interacting with members, access to all forums, downloading attachments, and eligibility to win free giveaways. Registration is fast, simple and absolutely free. Create a FREE Traders Laboratory account here.

Soultrader

Programming: Where to Start?

Recommended Posts

The platform dictates the language. Really the discussions on languages are academic. Unless you code everything from scratch that is. I would not recommend that to someone starting out. Oh or if you choose Neoticker which supports a variety of languages.

 

As the previous poster points out (and has been mentioned before) what you want to do and what you are used to will largely dictate the choice of platform. Again to re-iterate the platform will dictate the language you use. 80% or more of your code will be calls to the platform and so the language is pretty academic.

 

So are you going to write everything from scratch (I'm pretty sure the answer to that will be no :)) If thats the case we can pretty much dispense with the discussions on the merits of different languages and talk about the merits of platforms and the core features they expose programatically.

Share this post


Link to post
Share on other sites

You must have a reason for wanting to learn a language. What are your reasons. If you elaborate more fully here then the answer to your question will become more obvious.

Share this post


Link to post
Share on other sites
You must have a reason for wanting to learn a language. What are your reasons. If you elaborate more fully here then the answer to your question will become more obvious.

 

Just two things:

 

I share BlowFish's view.

 

And beside of the reasons, I would like to ask, how much time are you willing to invest to learn and use a language. 1 hour a day? 2 h? Full time?

And for how long? 1 month, 2 ... a year?

 

 

... and some more thoughts:

 

I guess beginners underestimate how much man months go into an application,

even if open sources are used.

And alone from scratch, well lets talk about man years or even man decades.

You make errors, open sources contain errors, ...

and they all have to be fixed at some point.

Just fixing them, how much time will it need? Especially if you don't understand the open sources you use.

So you have to learn, how they work

and so on.

Share this post


Link to post
Share on other sites

I've been involved in programming since I was 12 (I'm 28), I have a masters degree in informatics, had 5 years of programming + math.

 

While I know nothing about CQG, if you're looking for a completely free option, I'd share my experience: Ninja Trader + Zen-Fire data. Ninja Script is nothing but C#, which is an object-oriented language. OOP is used by large already and it's the type of programming language of the future, until someone comes out with another breakthrough, so it's advisable to start to learn what's IN at the moment, if there's an easy way.

 

And you bet there is. NT prepares all the objects you need for you, so in a pre-written code, you write the actions you want to happen, pascal-style is you want to. You can grab methods of pre-built objects and get into the OOP world, which requires a really a different mindset as was mentioned here before. But you can leave that for later and write a simple, deterministic step-by-step code.

 

My advice would be:

 

1. don't waste time reading books on advanced programming; on the net, there is plenty of sites showing the basics in 1-2 articles instead of 1st half of the book

 

2. don't waste time installing a programming environment for a language you want to learn, compile, run it, build an .exe etc and then be searching for ways how to use it for trading, start with NT and see your results in graphs immediately

 

3. start with the simplest thing possible, e.g. your first trading system should be something like: if I was not in a trade for 20 last bars, enter on MARKET, exit 10 bars after entering, on MARKET - and gradually build up. This example might sound complex first but it's two extremely, extremely easy-to-understand lines of code, nothing more. The example stated here servers as the "Hello world" in trading system programming. After you've done the 1st example, add more thoughtful ideas, add indicators, etc.. one thing at a time, make it work, save the code for later reference, reward yourself with a snack and you can move on - add another bit to it.

 

4. if you have no previous programming experience, inputting two very simple lines of code, almost copied from help, and pressing a button to see their effect on the graphs, is the way to go. You will understand immediately how this code works and adding variables to store information to be used a few ticks later, will come naturally to you as you add to your code - every new logic principle you implement for the first time, you will remember it til the rest of your life and use it

 

A quick recap: Sure, getting yourself several books on programming IS a way to go. But in today's world where time is one of the most highly priced commodities, I'd recommend to throw yourself into water, you will learn to swim in a way useful for you in the quickest time. That's my opinion and I believe with this approach, anyone can create their first simple automated trading system (for testing purposes I presume) within 1 single 8-hour day.

 

Let me know if you'd want to - I can prepare a set of steps for you so you can create your first strategy in NT in less than 10 minutes instead of figuring out what & where for yourself (you always have time for this later).

Edited by gandalf33

Share this post


Link to post
Share on other sites

I guess I am a little late to the party, but here are my comments.

 

If you want to be serious :

 

1) Refresh your math skills(take a course, no excuses...I said serious...).

 

 

Not really. I've programmed almost everything under the sun and you don't need any math skills beyond grade 6 to program unless you're programming a physics engine and or do transformations for graphics.

 

now from my own experience is:

1. C++:

for speed - writing programs (.exe) that speeds processes that you may want to do routinely. e.g. I use the end program to clean up ;arge xls and csv data files for data analysis.

to be noted - strong in arrays, but dont try if you want to manipulate matrices. Its going to be a real pain.

 

C++ is not much faster than most people make it out to be. C#, which is managed is only 30% slower in most scenarios since the run-time knows what platform it is running on and it can optimize accordingly. C++ is a mess anyway (not to mention that manual memory management is a nightmare). That's what you get when you try to hack object orientation into an old language like C that was not intended to be used as one.

 

Are C++ and C# two different languages? Im still unclear regarding the similarities between different languages...

 

Yes, C++ and C# are different. The syntax is similar though (as is Java). C# is basically a better version of C++. C# is "managed", meaning it runs on a run-time called ".NET" which was originally developed by Microsoft and runs on Windows only. There is another innitiaive called "Mono" that is basically a copy of Microsoft's .NET but runs on all the other operating systems. C# is getting better and more dynamic with every new version. It's currently at version 3.0 but C# 4.0 is already in the works.

 

I suppose if I learn C++ or Python I could easily adjust to the rest?

 

All imperative programming languages are basically the same which means that if you understand one, it's pretty easy to pick up others. Statically typed languages are compiled while dynamic languages are usually interpreted at run-time and/or the code is dynamically generated and injected at run-time. It's a question of performance and productivity.

 

I would learn a procedural language (e.g. C or Pascal) first, then object oriented but statically typed (e.g. C++, C#, Java), then dynamic language (VB 6, Javascript, Ruby) and then maybe a functional language (e.g. Lisp, Cobol), which is not required but a completely different programming paradim.

 

If a person has not taken at least one computer course in high school or university, learning a programming language as an adult will be a daunting task.

 

My experience is it's better not to learn in high school or university, because it's taught so badly. It's better to get a good book from an author that knows what the **** he is talking about and go from there than listen to a tutor that does not really get it.

 

The absolutely central question is:

What are you intending to use your code for?

 

The answer to "where to start" will vary strongly depending on your intention.

 

I think it is essential that you answer that question. If all you want to do is write your own indicators, then you do not need to learn a general purpose programming language like those mentioned above.

 

The platform dictates the language. Really the discussions on languages are academic. Unless you code everything from scratch that is.

 

I agree. Just pick a platform and just learn the simplified programming language that comes with it. I think there was a reason they came up with domain-specific programming languages like EasyLanguage.

Share this post


Link to post
Share on other sites

can we define our goals and resources a little more:

 

...Primarily interested in being able to code strategies for various platforms. ...

 

what various platforms would you consider:

 

trading platform: your program runs inside a trader application:

- CQG formula

- Tradestation easylanguage

- Ninja Trader

- Neoticker

- eSignal

 

other platforms:

- Matlab

- R

- web server/web browser

 

native platform:

- C#

- C++

- VB

- Java

- Perl, PHP, Python

 

Writing a program (aka script) that runs within a trader application allow you to focus entirely on your algorithms because the programming for datafeeds and visualization has already been solved. The platform philosophy (single symbol, action occurs after a "bar" has closed) may not allow you to express your own ideas as you originally envision them.

 

Using a non-trader application you will need to consider your datafeed requirements, especially if you want realtime data. Maybe this is already solved with CQG-Matlab?

 

Native platform means running directly on your computer operating system, e.g. a program that runs under Windows, MacOS, or *Nix. In a pure computer-science definition, native means your program is translated to machine code that runs directly on hardware. In fact, this only occurs with C++. Writing an interactive realtime application, will require learning a great deal about COM or .NET for datafeeds and thinking about event driven (rather than linear) programming. Unless you intended to become a hobbyist or professional programmer I would avoid this route.

 

Programs which read and write files and do not require a GUI are relatively easy in any of the programming languages. I would favor an interpreted language like Perl, PHP, or Python (I prefer PHP since I also use it for web programming.)

Share this post


Link to post
Share on other sites

I program for a living. I have been doing it for 11 years now. Started off with COBOL and now program VB6, C#, and T-SQL.

 

- I agree with the others to stay away from C++. Unless you want to program full time, as opposed to trading full time, C++ is not the direction you want to go.

- I say to pick a language that CQG supports. Try to figure out if you can which language might have the most CQG stuff written in it.

- I have always found it is easier to learn programming by taking an existing program that you know works, and tweaking it to see what happens. See if you can find a simple indicator and then tweak it. Change a 10 period moving average and change it into a 8 or 12. Modify it to display in a different color or style. Those are all likely settings that can be changed programatically.

- When you look at something you know works, it eases the pressure of having to know it all to get going. You don't need to know it all, just modify it for what you need. This will obviously leaves gaps in your knowlege. You might decide to fill in those gaps or be satisfied with what you have if it is working for you.

- If you get something working, but it is not fast enough or whatever, you can then post it and have others critique it or pay to have a professional make it into everything you want it to be.

 

Hope this helps.

Share this post


Link to post
Share on other sites
I program for a living. I have been doing it for 11 years now. Started off with COBOL and now program VB6, C#, and T-SQL.

 

- I agree with the others to stay away from C++. Unless you want to program full time, as opposed to trading full time, C++ is not the direction you want to go.

- I say to pick a language that CQG supports. Try to figure out if you can which language might have the most CQG stuff written in it.

- I have always found it is easier to learn programming by taking an existing program that you know works, and tweaking it to see what happens. See if you can find a simple indicator and then tweak it. Change a 10 period moving average and change it into a 8 or 12. Modify it to display in a different color or style. Those are all likely settings that can be changed programatically.

- When you look at something you know works, it eases the pressure of having to know it all to get going. You don't need to know it all, just modify it for what you need. This will obviously leaves gaps in your knowlege. You might decide to fill in those gaps or be satisfied with what you have if it is working for you.

- If you get something working, but it is not fast enough or whatever, you can then post it and have others critique it or pay to have a professional make it into everything you want it to be.

 

Hope this helps.

 

I agree with the majority of it but the divergence is important.

 

John says to avoid C++. If he means "don't start building platforms from scratch in C++" I totally agree because there is so much to do and so much to learn.

 

But.

 

Sierra Chart uses C++ as one of its two programing interfaces. And it doesn't have to be (very) hard because they provide the structures and you just do the bit in between. It is not much more difficult than easy language.

 

Similarly one of the easy testing platforms Amibroker uses C++ for their coding but never says it so it doesn't scare one off - I can code for amibroker and then, with very minor changes use it in Sierra Chart.

 

More extreme, esignal code is also easy to change to SC code.

 

So, I think that many platforms use C++ like coding - the key isn't to avoid C but to avoid trying to do too much.

 

I do like the suggestion about starting with existing code and making a small variation ... thats how I learned C (and then C++) and I've gone from changing a CCI to 1000s of lines of code (just completing a bar by bar backtester because SC's one is tick by tick and they won't have a native bar by bar until next year).

Share this post


Link to post
Share on other sites

Help me understand; I'm not a newbie since I have traded for a time but I am new to systems and about to work toward that milestone. I've started out with JavaScript primarily because I was told that even though it is a 'scripting' language more than a programming language I should be able to pick up enough programming fundamentals from learning it to extrapolate (as it were) to programs that define trading systems. Is this a bit off the mark? Is there no *universal* programming or definitin language as it were for trading systems? Should there be?

 

Thanks,

 

SB

Share this post


Link to post
Share on other sites
Help me understand; I'm not a newbie since I have traded for a time but I am new to systems and about to work toward that milestone. I've started out with JavaScript primarily because I was told that even though it is a 'scripting' language more than a programming language I should be able to pick up enough programming fundamentals from learning it to extrapolate (as it were) to programs that define trading systems. Is this a bit off the mark? Is there no *universal* programming or definitin language as it were for trading systems? Should there be?

 

Thanks,

 

SB

 

 

I repeat...

 

for all the non-programmers, all the people who has not taken at least one computer course at high school or university...

 

please, please, please, stick with EasyLanguage.

 

if you don't know what it is, Google for it.

if you don't know who supports it, Google for it.

if you need an indicator in EasyLanguage, Google for it.

 

 

many people gave lots of "good" intentioned advices...

feel free to take a detour if you must.

Share this post


Link to post
Share on other sites

TradeStation has a steep learning curve, within the program itself, before even delving into it's programming language. It's not an easy program to configure or learn how to use. I spent years getting comfortable with it.

 

But it's programming language is the best of all the languages, in terms of it's simplicity. It's powerful enough to code anything imaginable and code it with less effort and less words than it takes in other languages. I am not proficient in many languages but I can read enough of all languages, and have proficiency in enough languages to know I am lucky to have found my way to TradeStation and it's EasyLanguage.

 

It's worth whatever it costs to make the switch.

 

I repeat...

 

for all the non-programmers, all the people who has not taken at least one computer course at high school or university...

 

please, please, please, stick with EasyLanguage.

 

if you don't know what it is, Google for it.

if you don't know who supports it, Google for it.

if you need an indicator in EasyLanguage, Google for it.

 

 

many people gave lots of "good" intentioned advices...

feel free to take a detour if you must.

Share this post


Link to post
Share on other sites
TradeStation has a steep learning curve, within the program itself, before even delving into it's programming language. It's not an easy program to configure or learn how to use. I spent years getting comfortable with it.

 

But it's programming language is the best of all the languages, in terms of it's simplicity. It's powerful enough to code anything imaginable and code it with less effort and less words than it takes in other languages. I am not proficient in many languages but I can read enough of all languages, and have proficiency in enough languages to know I am lucky to have found my way to TradeStation and it's EasyLanguage.

 

It's worth whatever it costs to make the switch.

 

tradestation has a steep learning curve?

 

that's the first time I have ever heard of someone with such a remark.

 

 

Have you tried Ninjatrader?

 

What do you think of it?

How would you compared the user interface with TradeStation?

Share this post


Link to post
Share on other sites

I don't have NT installed here and I don't have any desire to switch to it. The few times that I've tried it are limited to when I found some NT code on the internet that I wanted to translate. That experience didn't give me enough information about it to have an opinion about it's user interface but I definitely prefer TS's programming language.

Share this post


Link to post
Share on other sites

A slightly off-subject question, but does anyone know the official designation of the language used by the ProRealTime software (and hence many of the spreadbetting firms who white label this charting package)?

 

Thanks,

 

Bluehorseshoe

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.