Knowledge >> How to write a good requirements specification

How to write a good requirements specification

Although Soft4FX no longer offers MQL programming services, we still think that this article may be valuable for everyone who is planning to hire a programmer.

Coding any strategy requires good understanding of all its details. The better the specification, the less time we need to spend on the project. Therefore, the more specific you are, the faster the delivery will be. Less detailed specification will force the programmer to ask you more questions in order to fully understand your concept.

In general, specifications for indicators are less complex and easier to write than EA specifications, but this is not a rule. Since indicators specifications are more unique due to their nature, we will discuss how to write the specification for an expert advisor.

EA requirements specification

Writing good EA specification for the first time may not be easy, but it is worth your time. The most important parts are entry and exit conditions. Try to be as specific as you can in these parts. There are many ways of handling different signals and filtering them.

Try to answer the following questions in your specification (not all may be applicable to your strategy). These are the things most often omitted but very important.

Various kinds of stop losses, take profits, breakevens, time filters and money management rules are mostly standard procedures. However, it is best to describe everything you need to be sure it will be coded in the way you expect it.

Customers very often omit to specify the broker they intend to use. This may seem unnecessary, but the reality is that there are many different brokers with many different limitations when it comes to automated trading. Just to name a few: disallowing hedging, disallowing setting stop losses and take profits while placing a market order (market execution), imposing the FIFO rule, changing order comments, not supporting order magic numbers and so on. There is no need to worry if you do not understand what they all mean. The programmer will surely help you to figure out the limitations of your broker, but if you already know about such things, please write it in the specification.

Below you can read the key points of a standard EA specification as well as a sample specification. This should be good in most cases, but there are projects, which require entirely different descriptions. In such cases, feel free to provide your own structure and content of specification.

Key points to consider when writing the EA specification:

This is a sample requirements specification of a simple EA based on 2 indicators:

Project name: Sample_EA

This EA is based on two moving averages (MA1 and MA2) and RSI indicator.

Entry conditions:

A long position is opened, when MA1 crosses above MA2 and RSI is above 50.
A short position is opened, when MA1 crosses below MA2 and RSI is below 50.
Any position can be opened only after the bar closing (at the opening of a new bar).
There can be no more than one position open at the same time.

Exit conditions:

A long position is closed in any of the two cases:
- RSI gets below 50 (EA shouldn't wait for the bar closing, but act immediately)
- MA1 crosses below MA2 (EA waits for the bar closing)

A short position is closed in any of the two cases:
- RSI gets above 50 (EA shouldn't wait for the bar closing, but act immediately)
- MA1 crosses above MA2 (EA waits for the bar closing)


The EA should have the option to set take profit and stop loss levels as well as a trailing stop loss with adjustable step size.
I also need to have the possibility to adjust the parameters of the RSI and the two moving averages separately.

My preferred broker is XXXXX. It doesn't allow to set stop loss or take profit at the time of placing order (market execution).

I would like to use a percentage of current account equity for setting the size of each trade. I would also like to be e-mailed, when a new trade is opened.