No matter how many tools a charting program provides, there will always come a time when you need to do something that the software has not been programmed to do. Whether plotting indicators that aren't built into the software, or researching proprietary formulas of your own, you need the capability to somehow create custom indicators.
Any charting program that doesn't have the capability to create custom indicators and formulas is really nothing more than a toy, and cannot really be taken any more seriously than some of those web-based charting plug-ins. While interesting, and possibly useful for part-time end of day stock traders, they really have no place in the tool-kit of a serious day trader.
Realizing the need for a powerful, yet easy to use computer language, we sat down and tried to come up with the features that the perfect programming language would have. It had to be as fast and powerful as other programming languages, yet easy to write with minimal stumbling blocks for non-programmers. Most importantly, it had to be optimized for building trading tools. The result was QScript, the trader's programming language.
If you've been keeping up with all the newest trading programs you'll notice that nearly every single one uses Microsoft's Visual Basic as the programming language of choice. The claim is that since Visual Basic is such a popular language, with so many millions of users, it is the perfect language to use to build indicators and systems. That way there will be many instructional books available and many people to help out with the tricky parts.
Let me ask you a question. Scissors are very popular tools among millions of people. You can use versions of them to trim bushes and cut branches off of your tree. Millions of people use them, so if you have trouble its easy to find someone who can fix your scissors. But if you want to mow the lawn, do you really want to use scissors to do it?
The fact of the matter is that Visual Basic was not designed to be used to program trading indicators. While you can use it to do so, you are going to have to put up with some language constructions that are really going to slow you down. You are likely going to have to track and store price data in your own data arrays, you are going to have to declare and manage your own variables, and you might even have to go out and buy a special compiler to build your indicator in the first place. Worst of all, since the language is not optimized for trading, you might end up having to write pages more code than you would have to otherwise.
Rather than discussing the pros and cons of using Visual Basic, C++, or other popular languages to build trading tools, I'll submit one example to you that should prove the point better than anything else. Let's consider finding a head and shoulders pattern on a bar chart. Every trader has looked for these at one time or another, but it falls outside the realm of the common programming tasks that popular programming languages were built for.
As a quick review, a head and shoulders pattern looks like this:
This classical pattern has been used for decades by traders and is probably the most famous of all chart patterns. The idea is to go short once price turns down from the second shoulder.
Although easy for a human to identify, this pattern is by no means a simple thing to describe to a computer. Assuming that each leg of this pattern is only one bar long (a very simple head and shoulders!) here's how the code would look in TradeStation's EasyLanguage:
| if c<o and c[1]>o[1] and c[2]<o[2] and c[3]>o[3] and c[4]<o[4]
and c[5]>o[5] and lowest(l[1],2)>low[5] and lowest(l[3[,2)>low[5]
and highest(h,2)<highest(h[2],2) and highest(h[4],2)>highest(h[2],2)
then begin... |
Why did I use EasyLanguage here? Because it produces the shortest code compared to other languages such as Visual Basic or C++ when it comes to writing trading indicators. So I'm using the best tool available aside from QScript...
That code might not look so bad to you. Even if you don't know EasyLanguage, that's probably not too scary. Of course, in real life no one really cares about head and shoulders patterns with sections only 1 bar long! If we increase our requirements only slightly and look for patterns with legs 2 to 5 bars wide, the code suddenly becomes a maze. This means that there are 4 different bar lengths for each particular leg. Six sections in the pattern equals 4x4x4x4x4x4, or 4096 different combinations of bar lengths. If you approached the problem like we did above, you'd end up with over 12,000 lines of code!
So in order to program this and not go crazy, you have to make a series of loops and use the various loop counters as possible bar lengths for your pattern. Without going too far into it, here's an idea of what it would take, again in EasyLanguage:
|
for leg1 = 2 to 5 begin
|
|
for leg2 = 2 to 5 begin |
|
|
for leg3 = 2 to 5 begin |
|
|
|
for leg4 = 2 to 5 begin |
|
|
|
|
for leg5 = 2 to 5 begin |
|
|
|
|
|
for leg6 = 2 to 5 begin |
|
...Finally! Now figure out if we've got a head
and shoulders...
|
|
|
|
|
|
end; |
|
|
|
|
end; |
|
|
|
end; |
|
|
end; |
|
end; |
| end; |
You don't have to understand programming to see that this is suddenly getting pretty nasty. That center portion of the code is going to be a bear to write, and the whole thing is going to be really slow. What if you wanted to find the largest possible pattern on top of it all, not just the first match? Good luck! The EasyLanguage for that is going to be at least 2-3 pages long, if you can even get it to work. If you're using Visual Basic or C++ go ahead and tack on another 2 pages.
Is this why you got into trading? To write mind-numbing code at your computer all day long? Kind of like cutting the grass with a pair of scissors!
Would you believe that it takes only 2 lines of code to find the head and shoulders pattern using QScript? Using the power of Regular Expressions, QScript can search for any kind of pattern like this quickly and efficiently. Each section of the pattern can be any number of bars long, and you can even tell it to return the longest or shortest match it found. In case you're curious, here's how it all looks:
if ( pat(c>o{2:5}, c<o{2:5}, c>o{2:5},
c<o{2:5}, c>o{2:5}, c<o{1} ~~ maximize, h[3]>h[1]
and h[3]>h[5], l[2]>l[1] and l[4]>l[1]) )
{ |
| |
...You've found a match - do what
you want in here... |
| } |
Here's a head and shoulders pattern found using this code: (The red dot is when the match was signaled)
Regular expressions are powerful pattern matching algorithms, and the heart and soul of programming languages like Perl. Usually they are used to search through text to find phone numbers and email addresses, but QScript contains a version designed for pattern matching on bar charts. This is an industry first, and you won't find anything like it in other computer languages. Granted, regular expressions are a little cryptic at first, but it's all pretty simple once you get to know how it works. You can learn to build your own regular expressions after an hour or so of study and be successfully testing patterns that experienced Visual Basic programmers can't even write without a week of free time and a bottle of Aspirin.
Most traders don't know how to program anyway, so why learn a hard language that will just cause you grief in the end? QScript is one of the most straight-forward and easy to learn programming languages ever created - and it's optimized for building trading indicators. In other words, it's the right tool for the job. Don't cut the grass with scissors - use a lawn mower!
Another great feature in Wave59 is the QScript debugger, which allows you to step through your code line by line to see what is happening. Remember that 12,000 line head and shoulders pattern mentioned above? Imagine spending a week programming that. Now, after all that hard work, you apply the indicator to your chart, sit back, and....nothing. That's right - your indicator doesn't work because there's an error somewhere!
So what are you going to do about it? If you are using one of these other programs, you're going to have to either sift through your source code line by line looking for the mistake (good luck!), or you're going to have to put in a bunch of "print" statements and store the values of various important variables to a file somewhere (and then sift through the file later). What this does is make it impossible to debug a program of any size. It's just too hard. Even worse, it makes it impossible to verify that your code is doing what you think it is. There might be values coming out one end, but how do you know you're not accidentally subtracting when you meant to add some important numbers? Your great idea for an indicator might be a dud because of a typo, not because the idea was bad!
Wave59 provides a built in debugger that lets you step through your code line by line and inspect all the values. This is how professional programmers find their errors - and there's no reason to deprive you of the same kinds of powerful tools. Below is a screen capture:
This graphic shows how you could debug the RSI oscillator. Local variable views, single variable detail, breakpoints, function traces, and all the other features of a full blown debugger are supported. It's another industry first and you won't find anything similar in any other program.
As I mentioned before, EasyLanguage (found in TradeStation) has been the language of choice for traders for many years. It's just as easy as any popular programming language to learn, and decidedly simpler to build indicators with for trading. Rather than force you to learn QScript before you can begin to use your custom EasyLanguage in Wave59, I decided to do things right and built an automatic conversion program.
Simply copy your EasyLanguage code, paste it into the converter, press the start button, and out comes perfectly written QScript! Indicators, Functions, ShowMe studies, and PaintBars can all be converted to QScript. In my experience 80-90% of EasyLanguage comes through with no changes necessary. The other 10-20% will require a few minor adjustments here and there, but very infrequently will you have to make any major changes to the source code.
Mechanical trading systems are not supported in Wave59 yet, so you won't be able to transfer those at this time. Aside from that, you should be able to port anything you've got working in TradeStation over to Wave59 with minimal fuss. And since QScript and EasyLanguage have very similar syntax and grammar, it won't be difficult to make those minor adjustments once you've passed your indicators through the converter.
The ability to write your own indicators provides you with the means to do an incredible amount of market research, which means that sooner or later you will find something really good. When you do build your own indicators, you can keep them for your own trading or can give them to your friends. You could even sell them if you wanted to.
Of course, if you do decide to share your indicators you want to be sure that no one can break in and steal your ideas. This was a big problem for EasyLanguage-based vendors in the past. Once someone breaks into your expensive indicator, they are free to post it on newsgroups or even sell it at a highly reduced rate. These are not the kinds of things you want to have to worry about when you give away your valuable techniques!
Wave59 uses modern cryptography to protect exported QScripts, not some kind of rinky-dinky password system. This means that no one is ever going to be able to break into your indicator and figure out how it works, no matter how hard they try. Your techniques are secure. You can even specify for your indicators to only work on certain installations of Wave59, which will allow you to lock your techniques to a particular person's computer.
The ability to write custom indicators is extremely important for the serious trader. Even if you have no need of this yet, sometime in the future you will have something you need to program, and its very important to have a convenient way to get this done. You don't want to have to learn a complicated programming language before you start! QScript is about as simple as a programming language can be, but remains powerful and flexible. Don't settle for anything less.
Click here to order, or here to return home.
|