A trading algorithm is a strategy that takes in the price of a financial instrument (a stock), calculates various properties of that stock, then depending on the values of those properties returns either a buy signal, a sell signal, or a null signal. If the algorithm returns a null signal then nothing happens and the system simply waits for the next price. If a buy signal is returned then a buy order is generated and sent to the trading system. Similarly for a sell signal except that a sell order is sent.
The main objective of trading in this manner is not necessarily to maximize profit but rather to control execution and risk. In effect, trading using algorithms removes the human emotion component of trading.
Building an algorithm falls u