In Part 1 and Part 2 of our Beginner’s Guide to developing trading system, we talked about the necessary skills and how to approach a trading system. We said that an Automated Trading System consists of several elements. You need to decide which markets you want to trade, identify and code a trading logic, account for trading costs and optimize via backtesting (but not overfit).
Here, we specifically talk about the process of identifying the trading logic and developing a strategy. The strategy will be the meat of your trading system.
The end goal of a trading strategy is to give you a final trading action - buy or sell a certain quantity of a trade-able asset. However there is structured process that leads to this end goal. Ideally your trading strategy should decide the following:
- DIRECTION: identify if an asset is cheap or expensive or fair value
- ENTRY TRADE: given that an asset is cheap/expensive, decide if it wants to buy/sell that asset
- EXIT TRADE: given that an asset is fair priced and if we hold a position in that asset(bought or sold it earlier), decide if it wants to exit that position
- PRICE RANGE: decide the price (or price range) that it wants to make this trade at
- QUANTITY: Amount of capital(how many shares of a stock for example) that it wants to trade
This give you the final trading action, for example: buy X number of shares of comapny Y at below Z price, that you an send to your broker.
While thinking about designing a trading strategy, I find the following flowchart helpful
Let’s analyze what’s happening here in detail:
- We have real time price data for multiple securities(this could come from a broker or a data vendor or a co-located server) feeding into our system
- DIRECTION — This data feed get analyzed by our prediction model, which uses current as well as historical data to predict a fair value for the securities using a pre-learned logic. The actual prediction can vary based on how you have built your model. For example, instead of predicting the fair value, you could predict the probability that price will go up(or down)
- ENTRY/EXIT TRADE — The previous prediction feeds into trading signal logic, which decides if we want to make a trade. This is very important. Even if an asset is cheap, you may not want to necessarily buy it. For example, the fair value of a stock may be Rs 100 and it is currently trading at Rs 99 (you expect price to go back to Rs 100), but the variation in stock prices (standard deviation) recently may be Rs 10 and you may want to wait for a better entry point. Or the cost to trade might be Re 1, leaving you with no profit if you buy at Rs 99. Or you may already be at your maximum position limit. This part of the logic identifies which trades to make and what price to trade at (PRICE RANGE)
- QUANTITY: Now you know what trade to make, you have to decide how much funds to allocate to that trade. The logic here will vary greatly from strategy to strategy. Normally, you don’t want to enter (or exit) into a trade all at once. You may want to enter a trade in small chunks to avoid losses from a bad decision or to trade at the best price or to avoid impacting the market too much. In the previous example, you may buy small quantity of stock at 99, then wait till price goes to 98 and buy some more and so on. The amount of position you already hold and available funds to trade also affect this logic. If you are trading multiple assets, you will have to decide how much to allocate to each asset as well.
- Finally we have the complete order that we are ready to execute in the market.
The aim of this post was to walk you through the systematic approach of developing a trading strategy. In the next few tutorials we will talk about some basic strategies such as mean reversion and momentum that will help you with step 2 and 3 — identifying the Direction, Trade and Price. For some hands-on experience, try developing your own strategies using our toolbox.