An Introduction to IDL Indicator Programming

In the article An Introduction to Time Distribution Analysis, I introduced an indicator that can be used to generate reports based on user defined criteria. This indicator is a very good example that illustrate the concepts behind the NeoTicker indicator object model, which is the foundation for writing indicators and trading systems using regular programming languages (Delphi, VB, VC++, VC#, VB.NET, etc.) or one of the supported scripting languages (Delphi Script, VBScript).

(Lawrence – this article requires some basic knowledge in programming with one of the programming languages mentioned above)

Classic Indicator Programming Languages

The concept of programmable indicators was there ever since the first charting platform was introduced. The means to programming your own indicator usually fall in one of two categories. First, there is the formula based language that can carry out basic combinations of existing indicators. Second, is the ability to write indicators in a procedural/imperative programming language like Pascal.

(Lawrence – You can find more information about imperative programming at wikipedia)

The advantage of a formula based language is that it is more compact and easier to use in general for most users. Its weaknesses is exactly where its strong point ends, the easy to use advantage limited its ability to develop more complex indicators right from the beginning.

The advantage of imperative programming language is the ability to express more complex concepts. Its weakness, however, is that it requires the end-user to learn programming in the first place. Another big issue with imperative programming languages is that the code reusability is low, thus it is much harder to reuse (or maintain) the programming code you have developed for a specific task on another one, even though the two share a lot of similarities.

For most users, the combination of both is enough for handling the trading need at that point in time. However, as time progress, the world has marched on with much more complex trading environment. Using classic imperative programming languages is too time consuming to express the complex environment with clarity and simplicity.

The Arrival of Object Oriented Programming

Object oriented programming is not something new. It has been around for a long time. Its essentially an extension of the classic imperative programming that focus on separation of data scope and promote better programming practice.

The use of objects improves code clarity and reduces the cost of code maintenance.

(Lawrence – You can find more information about object oriented programming at wikipedia)

For most who are familiar with structural programming languages, that may not sound like such a big deal. So, lets take a look at the NeoTicker indicator object Heap to see how object oriented programming helps.

In NeoTicker, the Heap object has its own properties and methods that can be called by the user in their indicators. The Heap data are restored every time the indicator is updated again on the same bar. That creates a consistent environment for dealing with indicator calculations that requires bar to bar consistencies.

On the other hand, there are situations that the indicator writer will want to maintain information tick by tick. That, can be taken care of by the PHeap object within NeoTicker.

If we have to implement both Heap and PHeap using a classic programming language, then for each property or method available in the Heap, we will have to add individual functions for heap and pheap separately. That makes the language much less maintainable and harder to work with.

With an object oriented language, whenever we are adding new features to the Heap object, we know immediately that the PHeap object will get the new feature and is likely to have the correct solution. At the same time, the end-user of these objects can have a much more organized way to access all these functions based on the nature of the data they are going to work with.

Simply put, object oriented programming gives the designer an advantage over imperative programming, in implementing complex data models in a clean and organized matter, while expandability and long term maintenance of the language is greatly improved.

The Advantage of Using Microsoft COM Object – Cross Language Compatibility

The biggest breakthrough in object oriented programming is the introduction of Microsoft COM object architecture. It is the very first time that a generalized object definition is provided so that any programming languages can share the objects from any other programming language provided that they both handle COM objects.

By supporting COM objects, NeoTicker’s indicator can be implemented in any programming languages, with effectively the same logic, due to the fact that the same objects are used across all the programming languages.

For example, the Heap object is available in your indicator calculation no matter it is Delphi Script, or any one of the regular programming languages, like Visual Basic, Delphi, Visual Basic .NET, Visual C#, etc.

Case Study – The Time Distribution Analysis Indicator in Delphi Script and Delphi

The article Programming the Time Distribution Analysis Indicator discuss the conversion of an indicator written in DelphiScript into regular Delphi. It illustrates how easy it is to translate an indicator from one programming environment into another due to the fact that they share the same underlying object model.

Discuss this article

Leave a Comment

Blog Developed
By ContentRobot