Investopedia defines is as?“A trading system is simply a group of specific rules, or parameters, that determine entry and exit points for a given equity. These points, known as signals, are often marked on a chart in real time and prompt the immediate execution of a trade.“
So, its important that we devise rules that hold for itself. But before that, one has to understand that there is no holy grail which means that you have to compromise some thing for other and there is no system that shall work in every market scenario.
So, how do we go about Building a Trading System. Well, thats the big thing. For a start, you have to decide on a couple of things,
1. Charting Software you would use -> Any Trading system you build will have to be in the language the system understands. Also, for visual effect, its always better to have a charting software though the same can be done by using MS-Excel as well.
2. Time Frame: This is one of the most important parameters. I for example trade using 5 Mins, 15 Mins & 60 Min Bars. For my style of trading and my Risk Profile, I am comfortable using the same. But, shorter time frame means that you need to constantly monitor and if trading is part time (with a full time job on hand), this is a not a time frame one should venture into.
3. Market you want to trade upon: Many people express the sentiment that a good trading system should work in every market. I believe this is a very wrong concept due to a huge number of things which I shall not go into, but believe me, its always better to concentrate on a few rather than try to trade everything.?
For example, Volatility of Nifty is high when compared to Volatility of S&P (US) hence what works for US Markets may or may not work for Nifty and vice versa.
Now that we know the essentials,lets move to the next step.
Lets write a simple Trading System
A Simple Trading System can be a Moving Average Crossover
What are the factors to look at when testing. The following list is just some of them and are things I generally check.
1. Draw Down: This is the most important metric in my opinion. Trading Systems (TS) that are sensitive have lower DD’s than systems that have lower sensitivity. Ofcourse, higher sensitivity means, higher number of whipsaws. So, a trade off all the same. The metric that has to be looked at is either CAR / MDD or RAR / MDD. Lower the better since a 20% DD on paper has no impact whereas if your trade is down even 10% when trading using real money, it has a huge Psychological impact.
2. Profit Factor: This metric shows the net profitability of the system. Most systems (good) have a higher number of loss trades than profit trades, but still are able to give out a fairly high profit factor which means that even if you have suffered a couple of whipsaws, the system will recover everything once there is a good trend (for Trend following systems).
3. Equity Curve: Most systems allow one to draw the Equity Curve which shows how the starting capital would have performed over the course of the period. Too smooth a equity curve will in all?probability?be the result of over optimization which results in a phenomenon we call Curve fitting. While the result looks good on paper, again, when the same is used with real money, Self Destruction is guaranteed.
4. Exposure: Too low a exposure means that the system is most of the time in cash and does not make sense.?
5. K-Ratio / Sortino Ratio: For more info about these,please google them, but they are usefull metrics that show as to whether your profits are distributed across or just a few trades account for most of the profits (which is bad). While its said that a K-Ratio of more than 1 is good, I have never been able to get any higher than 0.25, so not sure if 1 is really possible. But, do eyeball the trades to see as to whether some trades could really have been taken.
Ok, I think that the above information is suffice and for more, well google is always on hand
Lets move to Optimization.
What is Optimization. Optimization is trying to determine what works best or rather what worked best in ?history and trying to see if the same can be used in future as well to get similar returns.
When people optimize, they generally tend to look for the best profit making factor. That is entirely wrong since peaks constitute less than 10% of the total available trading. Trying to catch the peak will just result in a trading system which shows great returns on back test but performs?medicorely in real time. What I am trying to say is that your system should not try to catch the 10% return that comes occasionally but try to catch say the 5% return that comes most of the time. The best performance in back test may not hence be the factor to choose.
To better understand that, one needs to look at a 3D Graph. AmiBroker provides such a thing where you can see the peaks as well as the valleys and?Plateaus.
To ensure that your system is not curve fitted, its essential that you run a Walk Forward optimization to see how it would have performed in reality without the benefit of hind sight.?
AmiBroker defines WFO as such,
The automatic Walk forward test is a system design and validation technique in which you optimize the parameter values on a past segment of market data (”in-sample”), then verify the performance of the system by testing it forward in time on data following the optimization segment (”out-of-sample”). You evaluate the system based on how well it performs on the test data (”out-of-sample”), not the data it was optimized on. The process can be repeated over subsequent time segments.
I think that I have covered all things that need to be covered. In my next post, I shall post a sample trading system and discuss the metrics as well as things that I have coded.?
Brickbats / Queries very much welcomed.
Cheers
Prashanth