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

Decided to take another stab at learning programming. Its been my number weakness for years and yet Ive been delaying this requirement.

 

Can anyone recommend any programming language and books on where to start? Primarily interested in being able to code strategies for various platforms. So probably best if I begin with something general and compatible with all the mainstream platforms. Thanks!

Share this post


Link to post
Share on other sites

If you want a general idea, I think C++ is a good place to start.

 

C++ Language Tutorial

 

As far as a trading-specific language, I think Easy Language is most widely used, though I have no experience with it:

 

https://www.tradestation.com/support/tutorials/easylanguage.aspx

 

I'm a programming newbie, but I've read a lot about getting started...It's just that I never get past the "getting started" phase. I've written a "hello world" program in c++ many, many times.

Share this post


Link to post
Share on other sites

If you want to be serious :

 

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

 

2) Have a clear goal what you want to attempt.

 

3) C# is great (Ninja), Easylang is ok(depends on what you want to achieve, thus if you have very very smart ideas (like me ...lol) you will need to exe them on a platform that has no limits ( TS and MC are not the way to go , why ? well these programs cannot calc Multimarket analysis well at all unless you use Global variables, and for that you will need to know C# ...again its all in what you want to attempt).

 

 

4) If you are going for the pro stuff (I have been programming for over a decade , so from experience I must stress that the basics is what counts), you will need 1-2 years of experience to even attempt smart coding , if you want easy lang level - 3-6 months - with proper guidance .

Share this post


Link to post
Share on other sites

as what programmer mentioned, it depends on what you really want to achieve with the programming language you learn.

 

I'm not too sure if EasyLanguage is really classified as a proper programming language, what I do know 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.

 

2. MATLAB:

for manipulation of matrices, mathematical programming

to be noted - not really portable to other computers (the MCR is a joke...the installation is big and you need to have the MCR relating to the same MATLAB version you created your little program). Its really expensive too.

 

3. R:

for data analysis. its called a statistical analysis environment, but I tend to view it as a general data analysis environment since there are so many packages for different usage asides statistical analysis.

to be noted - its free, but GUI is really limited. console is the main way to do things. If GUI is important, Tinn-R has to be a companion to R. The combination will give a MATLAB-like GUI workspace.

Share this post


Link to post
Share on other sites
Guest TomH

3. R:

for data analysis. its called a statistical analysis environment, but I tend to view it as a general data analysis environment since there are so many packages for different usage asides statistical analysis.

to be noted - its free, but GUI is really limited. console is the main way to do things. If GUI is important, Tinn-R has to be a companion to R. The combination will give a MATLAB-like GUI workspace.

 

R is more of a scripting language than a serious general programming environment, as mentioned above, but for financial analysis you should be able to implement some serious stuff after a few days with packages like R's quantmod - that would take months from a standing start with C++

 

If the original poster wants to learn the principles of programming then C or Java are the sorts of things used in undergraduate CompSci classes. However for day to day rapid development I previously use perl and Java, and more recently hack up financial models in R

 

In the real world, if you learn the principles of loops, conditionals, variable types and functions, then you have the basics of most procedural languages, and converting your knowledge from say VBscript, javascript, Bash, R, perl, and most of the platform specific scripting languages for the trading platform is a matter reading the manual.

Edited by TomH

Share this post


Link to post
Share on other sites

I would recommend (fairly highly) Easylanguage for numerous reasons.

 

It is fast to get results which should a) keep you motivated b) allow you to learn quicker.

 

There are thousands and thousands of studies and code samples. A good way of learning is looking at how other people do it. Again you will get quick practical results modifying someone else's code whilst learning a bit at a time. This leads on to pier support. Just look at TL and ask yourself if I need help which language is best supported?

 

It is based on Pascal.... some might mock that but personally I think its a strong language. One of its design criteria was that it was easy to learn and has stringent compile time checking (it is usually harder to find bugs at run time, though this is less important with 'scripted' stuff). There will always be a flavour of the month language C++, Java, C Sharp, Ruby etc. Fashion plays a big part in programming languages though many are main stream now. If you can program the languages become less important.

 

The biggest challenge you are likely to find is not the language itself but the functions (trendy languages will call them methods) you call to do basic stuff, e.g. read data series, plot something, find out the time etc. EL implements this cleanly and more importantly simply.

 

Nothing wrong with starting a project and just throwing yourself in. (Hello world is a popular one!) despite doing a degree in computer science (in the 70's) I didn't really become accomplished until I actually started writing code professionaly.

Share this post


Link to post
Share on other sites
R is more of a scripting language than a serious general programming environment, as mentioned above, but for financial analysis you should be able to implement some serious stuff after a few days with packages like R's quantmod - that would take months from a standing start with C++

 

If the original poster wants to learn the principles of programming then C or Java are the sorts of things used in undergraduate CompSci classes. However for day to day rapid development I previously use perl and Java, and more recently hack up financial models in R

 

In the real world, if you learn the principles of loops, conditionals, variable types and functions, then you have the basics of most procedural languages, and converting your knowledge from say VBscript, javascript, Bash, R, perl, and most of the platform specific scripting languages for the trading platform is a matter reading the manual.

 

heh, I dont know whether to call MATLAB and R a programming language or not, but, I prefer to use the word environment XD. as Tom has mentioned, it reduces the time from idea to an actual work.

Share this post


Link to post
Share on other sites

I should add my answer was more from the point of view of learning 'general' programming. If your bias was towards statistical analysis and mathematical modelling I'd probably have to modify my answer:)

Share this post


Link to post
Share on other sites

hey I am learning java not because I wanted to do something in TA but because I want to learn some programming language. But after reading above posts I am curious to know where will I stand w.r.t programming for technical and stat analysis visa vis other languages if I learn java language in depth if it is possible. Thanks

Share this post


Link to post
Share on other sites

Hi James,

 

It really doesn't matter IMHO, what matters is that you understand the idioms. How to think about a problem in terms of those idioms.

 

I would not recommend C++ however, as you have to learn too much detail outside of those idioms (pointers, references, other low level intricacies). Focus on higher level languages that allow you to learn the idioms. Some languages that come to mind in this area are:

- Java

- C#

- Ruby

- Pyhthon

 

Once you understand the idioms well and can think about a problem in those idioms, learning another language is strictly syntax. You know how to solve the problem, just need to learn the syntax for it.

 

With kind regards,

MK

Share this post


Link to post
Share on other sites

Thank you all so much for the suggestions. I just got back from the bookstore, got myself some intro books on C++ and Python. I am not looking to do anything fancy as all my strategies are very simple. The only issue was I couldnt even program simple stuff.

 

As for EasyLanguage I am not sure if I will ever use Tradestation as I am pretty much hooked on the CQG platform and hard for me to convert at the moment. I may start flooding the Coding forum with some newbie questions so I hope its okay... hopefully nobody reports it to me :)

 

Are C++ and C# two different languages? Im still unclear regarding the similarities between different languages... I suppose if I learn C++ or Python I could easily adjust to the rest? Thanks!

Share this post


Link to post
Share on other sites

Here's my 2 cents' worth:

 

I say "2 cents" because I am not qualified to give expert advice.

I do not have a computer degree;

I only took ONE programming course in university. (That's only because it was a compulsory credit.)

 

 

Here's my 1st 2 cents; it is not a discouragement, just a reality:

 

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.

 

It is not impossible, it just requires effort.

 

 

Having said that, if you still want to proceed... here are my 2nd 2 cents:

 

I would steer away from C#, C++, Java, etc.,

These are powerful and versatile Object Oriented Programming languages (OOP)...

They are not difficult to learn; there are lots of free tutorial on the web,

...and lots of books in the library.

but I would still steer away from them because these languages require

a different thinking mindset to learn and operate.

You will need to put on a geek's hat to think in C# and the like.

Many people have tried and succeed,

some have tried and "spent time"...

If you want a challenge, by all means go for it.

 

 

Here's my 3rd 2 cents:

 

Those who have read my posts here will know I will "shill" for EasyLanguage. LOL.

 

EasyLanguage is a dedicated programming language specially designed for trading.

 

You can find EasyLanguage's root in Pascal;

Pascal is an English-like teaching language invented in the 60's.

 

Pascal is a procedural programming language;

it employs structured programming and data structuring.

ie. EasyLanguage has taken up Pascal's good programing practices.

Good programming practice saves you time in logic design and headaches in debugging.

 

EasyLanguage has been around for almost 20 years.

It is a product of continuous refinement and enhancement;

thanks to a large community of users that gave valuable feedback and

feature requests over the years, EasyLanguage has become quite a comprehensive

trading engine for amateurs and pros alike.

 

There are lots of free EasyLanguage indicators and strategies on the web.

Anything you can think of, probably it has already been done and the codes posted.

 

EasyLanaguage is supported by a number of programs:

TradeStation (benchmark version)

MultiCharts (enhanced version)

Open E Cry (limited version)

TradersStudio (limited version)

plus a few more...

 

Can EasyLanguage do everything a trader wants?

The short answer is "NO".

e.g. EasyLanguage does not support Level II.

 

Can EasyLanguage be extended by user?

Yes, through DLL and function libraries.

e.g.

Global Variable

http://www.traderslaboratory.com/forums/f46/global-variable-v2-2-a-6023.html

ELCollections - Collections for EasyLanguage

http://www.traderslaboratory.com/forums/f46/collections-easylanguage-5929.html

ADE - All Data Everywhere

http://www.traderslaboratory.com/forums/f46/ade-all-data-everywhere-easylanguage-5934.html

 

 

 

My conclusion:

EasyLanguage is a good place to start for the uninitiated.

If you know some programming basics, then you won't have a problem with C#, etc.

Edited by Tams

Share this post


Link to post
Share on other sites

if you understand the differences,

it will make your choice easier.

 

Procedural vs. Object-Oriented Programming

 

[ame=http://www.youtube.com/watch?v=4_Oj4xcD52A&feature=related]YouTube - Procedural vs. Object-Oriented[/ame]

Share this post


Link to post
Share on other sites

I went down this path for a bit on diff't angle. - I started with v.b.a for excel figuring my familiarity with excel would make this easier. I began learning to declare variables and doing loops etc... But figured out that programming at that level is total overkill. I think it's a good idea to learn intro programming but programming is really for building tailored applications. In this modern age, I believe what most of us want to do is be able to manipulate data easily. And this requires being able to write script within a code editor on an existing application (an app that is highly flexible - like excel and easylanguage). You don't want to be stuck maintaining the syntax of basic instructions to the data-set, such as the syntax associated with telling the computer how to handle an extra space or defining a variable as an integer. These are things that can be worked out at the application layer.

Edited by Frank

Share this post


Link to post
Share on other sites

At the end of the day the language is essentially different syntax though as Tams points out there are a few conceptual differences. It is also 'clear cut', it either is syntactically correct or not.

 

The big issue is the platform because the bulk of what you will be doing is calling functions (or invoking methods) to get stuff in and out of your code. It is how this 'API' stuff is implemented that is likely to prove challenging or not. The nature of programming nowadays is understanding the API you are programming too. Actually IO (input output) and getting stuff to and from the operating system has always been the tricky stuff. The charting app you use is essentially your operating system. Put another way there is not much programming involved in programming :)

 

If you use CQG it would make quite a lot of sense to go with that though it will be hard to get specific help on that platform (though I am sure many can provide general programming help).

 

Why not just dive in and write a simple moving average and see how you get on?

Share this post


Link to post
Share on other sites
At the end of the day the language is essentially different syntax though as Tams points out there are a few conceptual differences. It is also 'clear cut', it either is syntactically correct or not.

 

The big issue is the platform because the bulk of what you will be doing is calling functions (or invoking methods) to get stuff in and out of your code. It is how this 'API' stuff is implemented that is likely to prove challenging or not. The nature of programming nowadays is understanding the API you are programming too. Actually IO (input output) and getting stuff to and from the operating system has always been the tricky stuff. The charting app you use is essentially your operating system. Put another way there is not much programming involved in programming :)

 

If you use CQG it would make quite a lot of sense to go with that though it will be hard to get specific help on that platform (though I am sure many can provide general programming help).

 

Why not just dive in and write a simple moving average and see how you get on?

 

Hi Blowfish,

 

Thanks for the reply. Which language would you be referring to if I was to use CQG? Would C++ be the correct choice? Thanks.

Share this post


Link to post
Share on other sites

Just remember that code you write will need to be maintained. Maintenance is a pain in the ass. If you aren't a programmer by nature (who can maintain code extremely quickly), you will end up spending all your time just determining where the bugs in your program are and have little time left for actually figuring out profitable concepts/strategies.

Edited by Frank

Share this post


Link to post
Share on other sites

There's the rub, CQG is one of the few platforms I know absolutely nothing about (except that it is expensive!).

 

Most Platforms have there own scripting implementation based on one of the popular languages. I know CQG has a formula language but I don't even know if that is appropriate for developing 'full blown' studies to be honest.

Share this post


Link to post
Share on other sites

that video on object oriented computing was not exactly clear...

 

I am not a programmer but read a bit on this and think I understand some of the basics and writing it out probably helps further so I will and will ask for comments.

 

object oriented computing simply means you are interacting at a level that requires less knowledge of basic programming plumbing.

 

Microsofts excel is best example I know of -- Excel knows how to sum numbers etc... and you just have to stick in =2+2 into the cell, you don't have to declare '2' as an integer, you don't have to use headers and announce what you are about to do -- all this stuff is just wasted time, excel is geared specifically for this kind of thing. Easylanguage makes similar assumptions that are essentially a giant time-saver. Programming purists might think that this isn't real programming but guess what -- programmers are the guys who work FOR the the Wharton grads.

 

Now Microsoft wanted to add another level on top of that basic Excel-application level to 'extend' the functionality. So it developed VBA (Visual Basic for Applications) which allows you to now interact more powerfully with a worksheet... or a cell.... or a RANGE of cells. So if you want to work with cells A1:B2 --you can do this as A1:B2 just becomes an 'object' -- and you are interacting with the object -- and the underlying application knows how to interact with the object. In this way, you have taken out a lot of wasted time/complexity code out of the equation. This is a pretty cool structure and so programming becomes less about understanding how to structure a full program --- and more about understanding how to structure the shortcut --- which saves time and allows for MORE actual analysis.

 

The interesting thing is that as Microsoft extends the app with VBA, they also extend the core application -- so that you can actually do many types of loops and manipulate arrays without even writing VBA code into the editor, you just need to know the short-cut and write it into the same space where you enter data --- and they have essentially created dialog boxes to help if you get stuck --- its all just automating the VBA code.

 

I bring this up to show that the lines are all blurring and that understanding basic programming is good in that it helps you more deeply understand what is going on under the hood of the app -- ie, the word 'trim' in programming means clean up a word to get rid of extra spaces around it --- but if you write =TRIM(A1) in excel, it does the exact same thing.... you could write a program to 'trim' the data --- or you could bypass all that and just write =TRIM (cell)...... there are tons of short-cuts like this...

 

as Blowfish stated, there isn't really that much true programming in programming anymore. its all going the way of the business user (knowledge worker) and away from 'full program writers' (ie, the value of understanding the FULL program details matters less and less as time goes on)...

Edited by Frank

Share this post


Link to post
Share on other sites
I would recommend (fairly highly) Easylanguage for numerous reasons.

 

It is fast to get results which should a) keep you motivated b) allow you to learn quicker.

 

There are thousands and thousands of studies and code samples. A good way of learning is looking at how other people do it. Again you will get quick practical results modifying someone else's code whilst learning a bit at a time.

 

I agree with you

 

I've started programming less than a year only in reading code samples in this great site with the help of good teachers.

 

Before I knew only 2+2 results with Excel ( 3 and half, I think ?)

 

Now I can manipulate basic codes and I'm afraid to be not as intelligent as you are to do more because I know my limits in logic.

 

So easyLangage is "easy" for real beginners with strong motivations to do basic things.

 

Good luck in your studies ! :)

Share this post


Link to post
Share on other sites
hey I am learning java not because I wanted to do something in TA but because I want to learn some programming language. But after reading above posts I am curious to know where will I stand w.r.t programming for technical and stat analysis visa vis other languages if I learn java language in depth if it is possible. Thanks

 

Hi Delta,

 

I guess nobody can really answer your question.

But I will tell you what I think.

 

Quite some time ago, I decided to implement an application, that should use

my brokers API. Because there is a Java application and a demo of its use available,

and I liked to learn Java (I have used other object oriented languages before,

my first one was SIMULA) I started to learn Java using NetBeans as development platform.

Btw. an advantage is, that you can use it for free and don't have to buy expensive software.

 

Now, as others have already written here, to learn the language and concepts is one thing,

and I don't know how long a real beginner needs for that, but there is a second point.

 

Are you able to develop all parts of your software alone?!

 

Lets explain, if you like to have charts, will you code all this,

or will you try to use open sources. Then, are there open sources available for your needs. Do you have to modify them?

 

Now to statistics. Same story as above.

 

So my conclusion is, with using Java (or comparable languages) you can do

nearly everything you like. But you have to do it.

 

 

So it is really the big question, what you would like to do with your

application. And before you start to learn Java, you have to check, if there is an easier, cheaper,

more efficient way to solve these tasks.

If there is none, well you might need to implement your application,

but for the majority of people, its easier and better to use already available platforms.

 

Hal

 

P.S.: I still like Java. I go on developing my own ideas, but it was a long tough way so far. And the way goes on.

Last but not least, if I can help you learning Java, just ask, but remember,

I am also still learning it. :helloooo:

Edited by HAL9000

Share this post


Link to post
Share on other sites

Seriously James - stay away from C++ as a first language. You will spend a huge amount of time with the memory management aspect of programming and it just isn't necessary to add that complexity when learning. The languages I listed before relieve you of that. Memory management in languages like C++ of Delphi are where 95% of the bugs reside in professional programs.

 

Sure, you can start here and end up where you want to be. But it will take longer and a lot more effort.

Share this post


Link to post
Share on other sites

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.

 

There are several main directions where programming in connection with trading might go:

 

A Statistical evaluations (means, regressions, time series analysis)

B "Old-style" indicators (like variations of MAs, Stoch etc., using price and/or volume to compute new values.

C Extracting new / additional information from high-speed/high-bandwidth datastreams (like CQG), doing computations on bid/ask/trades, Dom-data etc.

 

Please add more that I forgot.

 

Since you said you want to interface to CQG I guess you want to go for the more innovative/high-speed things.

 

 

 

It can be useful to consider several parameters of programming languages:

 

- Speed of execution

- Learning curve for the user

- Support for the user (environment supporting the development, language helps with error checking, debugging helps, language straightforward)

- Mathematical / statistical analysis supported

- Can try truely innovative approaches

- Forums and example programs available

 

 

Some people recommended the use of trading-platform dependent languages like EasyLanguage.

This restricts the user to the possibilities of the platform.

There are always big limitations if the program runs in a "sandbox". Also there may be some day where suddenly there is no more access to the platform (company shuts down). E.g. many OpenTick users are looking in the net for new homes.

This approach is mainly suited if you want to go for "old-style" indicators.

Speed -, Learning+, Support+, Math+/-, Innovations--

 

 

C++

Sure it is the fastest high-level programming language out there and you can nearly do anything with it.

But WARNING it has a very steep learning curve (some of the posters already admitted that he never got beyond "hello world" - this is just the usual outcome for newbies & C++).

Also there are tons of traps hidden in the language and the user has to do many things (checking) that in other languages the compiler does for him. Many examples how you change your code just very slightly and it means something completely different.

Good news: You don't need C++: With modern fast computers mostly you do not need the ultimate speed, fast is good enough. And: When dealing with price, volume and so on you do not need complex language features.

Speed++, Learning--, Support--, Math +/-, Innovations++

 

 

C#

Is very different from C++!

It does error checking, it is much more straightforward in the language construction.

C# is pretty much the same as Visual Basic.

You can just go to MSDN and find hundreds of pages where you see that the language constructs are just a bit different (between C# and VB), the essence is the same.

Example: BitConverter Class (System)

Speed +, Learning+, Support+, Math+/-, Innovations++

 

 

Visual Basic (VB)

In my view better to read (Yes, I admit - I started with Pascal 25 years ago and still like it) and more free support out in the net.

Otherwise with only few exceptions like C#.

Modern processors in connection with VB can easily keep up with a real-time data stream at 100kB/sec and still do quite funny things.

Speed +, Learning+, Support+, Math+/-, Innovations++

 

 

Java

Learning curve pretty much like C# or VB.

Additional advantage of being able to let programs run on different systems (linux).

Personally I prefer anyway the (free) development platforms from Microsoft. They support the user in many ways.

Speed +, Learning+, Support+, Math+/-, Innovations++

 

 

 

Python

Can be learned pretty fast, intelligent language.

But relatively slow, not so much support. May be hard to connect to some data provider API (because you have to write an adaptor in the first place).

Speed -, Learning+, Support +/-, Math+/-, Innovations-

 

 

Mathematical languages (MatLab, R..)

The language is usually quite easy to learn, the mathematics behind you must know before!

You are limited to quant-type strategies.

Speed -, Learning+, Support+, Math++, Innovations-

 

 

Excel

Dead slow. Very easy to learn in the first place.

If you try to do something a little complex you end up with unreadable code.

But good for a quick look at numbers.

Speed --, Learning++, Support+, Math+, Innovations--

 

 

 

Quote from CQG site:

"Samples of how to use the CQG API are provided for C#, C++, MatLab, Microsoft Excel VBA, and Visual Basic 6.0."

 

In this case just follow the precedence CQG has already implied: C#!

Btw if they say C# surely VB is possible also but I don't know if they have sample code.

 

 

Sorry for getting lenghty. It is a complex question.

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.