Formula Language Course · Lesson 1 of 9
You don't have to be a geek to use MetaStock. Its formula language looks foreign at first glance, users affectionately call it 'MetaSpeak', but it is logical to its core, and anyone with a bit of persistence can learn it.
MetaStock's programming language breaks down into three simple components:
Combined, these three form the foundation of everything, and they drive MetaStock's four major tools: the Indicator Builder, the Explorer, the Expert Advisor and the System Tester.
The language was patterned after spreadsheet formulas. If you can build a reasonable spreadsheet, you are halfway to reading MetaSpeak already. If you can't, no matter: we begin at the beginning.
Price array identifiers are the atoms of technical analysis: the open, high, low, close, volume and open interest of each period. In a formula they identify which price field the calculation should operate on.
In MetaSpeak the identifiers abbreviate to single letters or short names:
O, H, L,
C, V (also written
OPEN, HIGH and so on). So the simplest
useful formula you will ever write:
( H + L ) / 2 ...the midpoint of each bar. Already recognisable as spreadsheet thinking: values, combined with operators, producing a new value for every bar on the chart. That pattern, repeated with richer ingredients, is the entire language.
Open MetaStock's Indicator Builder (Tools menu), create a new indicator, and plot
(H + L)/2 on any chart. Watching your own first formula draw
itself is worth ten pages of theory. In
Lesson 2 we add the operators
properly and start building expressions with real logic in them.
Everything in these lessons works in the free 30-day MetaStock trial: full software, live data, your own watchlist.
Start Your Free 30-Day Trial →30-DAY TRIAL · FULL VERSION · CANCEL ANYTIME · AFFILIATE LINK, SAME PRICE FOR YOU
The Formula Language Course: Course home · 1. First formulas · 2. Operators · 3. Precedence & periodicity · 4. Built-in functions · 5. Nesting · 6. Variables · 7. Comments · 8. Pasting functions · 9. Exercises