Designing a Trading System in MetaStock- Part 2


In Part 1 of Designing a Trading System in MetaStock, I had discussed the major components you needed to be able to track to create a mechanical entry system. These were measures of price, liquidity, trend, and volatility. The question now is, how do we code this into MetaStock?

First, let me offer you the most valuable piece of knowledge I have acquired over the years about MetaStock formula writing. This one secret will turn you into a MetaStock master. Do you think I know all of MetaStock`s hundreds of pre-programmed formula and propriety indicators? Well, I`m good, but I`m not that good.

When coding in MetaStock, the key to getting it “right” is to write what it is you are trying to achieve “down in English”. Once you`ve done this, it is easy to convert it into a MetaStock formula.

Let`s look at an example. Our first entry condition is a measure of price. As mentioned in Part 1, you want to set a price minimum to remove speculative stocks. Please note that the values you select will depend on the exchange you are trading. Some markets tend to be more expensive than others. For this example, we are looking to design a long-term trend following system to trade on the Australian Stock Exchange.

In Australia anything under $1 could be classed as a speculative stock. So how do you stipulate that the stocks you want must be greater than $1? First, “write it in English”: You want stocks with a 21-day average closing price that is greater than $1. Now, you can convert this into a MetaStock formula.

Using the formula reference section in the MetaStock Programming Study Guide, you can check the syntax of a moving average. Once you have this information, it`s simply a matter of plugging in the correct numbers. Then, by using the “greater than” symbol, you can stipulate the price to be greater than $1. The MetaStock code will look like this:

Mov(c,21,s) > 1

Let`s move onto the next component, liquidity. This is a measure of how much money a stock trades. It is important to identify stocks that have enough money moving through them so that you`re never caught with a stock you can`t get out of. For this example, let`s say we require the 21-day average of volume multiplied by the closing price to be greater than $200,000. In MetaStock language this would be:

Mov(v,21,s)*C > 200000

In the next article I`ll go through the last two components needed to design a mechanical entry system in MetaStock. With this information, you will be well on your way to starting an effective, and profitable, trading system in MetaStock.

Source by David Jenyns

Leave a Reply

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