Pre-Programmed Functions – Introduction For Metastock Experts

Posted in Blog

This is a continuation of our series on the basics of MetaStock Programming Language and Metastock tips. In this post we are going to go through pre-programmed functions any Metastock Professional should know.


Learn pre-programming for versatility.

In addition to the mathematical operators there are over 200 pre-programmed functions to allow coding versatility. The bulk of these fall into three categories: analysis tools, indicators and candlesticks. In this chapter we’ll look at each of these categories in detail, highlighting some of the more commonly used functions. Moreover, we’ll provide specific explanations, applications, and questions about these functions.

Before we begin though, we must explain what function parameters are, and where they’re used. A function is a set of predefined mathematical operations that MetaStock follows; and a parameter provides a function with the necessary information it needs to calculate these predefined mathematical operations. Some functions need no parameters; whereas others need numerous.

Let’s look at a couple of examples; the actual parameters are in bold, to make them identifiable. (These examples are only used to highlight what parameters are and where they are used).



This formula calculates a 14-period Average True Range. The only parameter required is the number of periods

(14). The ATR syntax is ‘ATR(Periods)’, and this is further explained on the next few posts.


This formula plots a 7-period simple moving average. The parameters include the data array (c), periods (7) and moving average type constant (s). Notice that when a function has multiple parameters each parameter is sepa- rated by commas. The moving average syntax is ‘Mov(Data Array, Periods, Constant)’, and this is further explained on the next few posts.

In this last example, we have introduced the idea that there are different types of parameters. Some of these may be specific to a particular function, while others are more universal. The price data array parameter, which we are already familiar with (refer to page 18, table 2.1), and the periods parameter which we just introduced in the moving average example, are the most universal parameters.

Periods refer to a single value, or a numeric constant, that determines the time period of a function. For example, a ‘periods parameter’ is the ‘7’ in the formula ‘Mov(C,7,S)’. This indicates that the moving average is a seven period average.

The other not so common parameters will be discussed as they arise in their respective functions.

Metastock Expert is expected to know everything about these things. In our next post, we will be presenting information that you need to know in terms of pasting functions. Do you want to learn how to use MetaStock formula like an expert? Just click here to learn more tips from the pros.

Watch this video for a quick introduction to Best Trading Software.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get Your Metastock 30 Day Free Trial