# MetaStock Programming Language – Exercises

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 test your knowledge as a Metastock Expert by completing the following.

Price Array Identifier                   Shortcut Do some exercises to be a better trader.

Open

High

Low

Close

Volume

Arithmetic Operators                    Shortcut

Division

Multiplication

Subtraction

Comparison Operators                 Shortcut

Less than

Less than or equal to

Greater than

Greater than or equal to

Equal to

Not equal to

Some of the following questions use the moving average function. If you are not familiar with this, we would suggest you to review on the previous posts to gain a basic understanding.

Complete the following formulas:

The close is greater than the open and either the volume is greater than 50000 or the turnover (closing price multiplied by the volume) is greater than 100000:

The close is within the top 20% of the period’s trading range (i.e., low to high):

The close minus 3%:

Language

A weighted moving average of the closing price which can be modified by the user (hint: you will need to use the Input function):

The closing price is greater than the 10 period simple moving average of the closing price; the volume is greater than a 10 period simple moving average of the volume; and the 10 period simple moving average of the closing price is greater than the 25 period simple moving average of the closing price. Develop this formula so that all of the ‘10’ values can be easily changed using the ‘variables’ feature:

If the closing price is greater than its 45 period exponential moving average, plot a 10, but if not, then plot a -5:

Comment out, but not remove ‘C>MOV(C,21,S)’ from the following formula:

V>Mov(V,20,S) AND C>O AND C>Mov(C,21,S) AND Ref(V,-1)<V*1.2

The 13 period simple moving average of the closing price is greater than the 21 period simple moving average of the closing price; the close is within the top 5% of the day’s trading range (i.e., low to high); and the turno- ver is greater than \$200,000:

A Metastock professional is expected to know everything about these things. In our next post, we will be presenting the introduction to pre-programmed 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 MetaStock Data.