Amibroker Tutorial: Visualize Optimized results of Trading Strategy using Amibroker 3D Optimization

A short tutorial by Adrian Reid (Enlightened Stock Trading) demonstrating Amibroker’s native 3D optimization chart to visualize optimization results. He shows 1D and 2D examples (varying moving-average parameters), explains the water-level (high-water mark) to find stable parameter regions rather than isolated performance spikes, and recommends copying charts into a trading journal and choosing parameter values for stability.
Chapters
Hi, Adrian Read here, founder of Enlightened Stock Trading. And in this amibroker tutorial video, I'm going to show you a very cool feature for you to use when you're optimizing your trading system so you can visualize the results that you're getting.
And help you choose the best parameter settings or the right parameter settings for your objectives based on your optimization. As you can see on the screen in front of you, when you do an optimization you're normally presented with a table of data. And if you're a numbers person and you can look at this and choose the parameter value that you like the most, then that's great. But some people can't really find that a little bit difficult and would prefer to visualize the data. So I'm going to show you how to do that natively within amibroker in this video. So the first thing I'm going to do is we're going to select. So I've run here an optimization based on one of my trading systems called the Freight Train. And this is just a single variable optimization based on the moving average. So I varied one of the moving averages over quite a wide range. And as you can see in this output table, there's 20 steps in this optimization. And usually what I do is I look down the list the column of each of the relevant performance variables like the compound annual return, like the risk adjusted return, the max system drawdown, and so on and try and find the area of maximum stability. Sometimes it's quite hard though to see that just in the numbers. So if you want to see a chart, this is what you do. First of all, run your optimization. Then click on the heading of the column that you want to visualize in a chart. So click on car for instance, compound annual return. Then if you go to this, see this optimize button, there's a little drop down arrow right next to it. And if you click that, then click on 3D optimization chart and what happens is you get this 3D chart of the column that you have optimized.
Plotted. So the performance of the compound annual return in this case against the.
Optimization, the parameter value. So we've optimized the number of bars in the fast moving average and you can see here we've optimized from 10 to 100 in steps of five and we're plotting the compound annual return which shows there's a peak here at around 20 and then it drops down and then it's fairly stable and drops down again and so on. And there's a couple of really cool features that you can do with this chart. The first one that I really like is this high water mark, this watermark water level. So you can, by clicking these buttons on the right, you can raise or lower this horizontal. You see this sort of bluey line here that's called the water level. And the reason you use this is to see where the values where the performance is similar. So if you just click down, you can see which values poke through the watermark first. So here around 40 is higher than here and higher than here. And then if you keep dropping the watermark, you can see how it appears. So it just helps you interpret the data a little bit. So that's called the water level. Now the next thing you can do is all these buttons about how to format it. I don't worry too much about that. But what you can do is just click and drag this chart around so you can adjust the 3D view quite a bit just by clicking and dragging. Personally, I quite like the default value. So I just normally look at it just like this. Now we've looked at the car. Now you can copy this and paste into your notes. So I keep all of my system development notes in a onenote page. So I start a new onenote page for every system that I'm developing. And as I go down and record the results, you know, I might copy this. See, if you click this copy button, that puts a bitmap of that graph onto the clipboard and then you can go into your OneNote or into your trading journal and paste it in there so you've got a record of it. So this is just one.
Performance variable that we're plotting. What if we want to look at something different? Let's now look at the.
Max system drawdown. Let's plot that one. So all you have to do is click on the headline, the heading of the column that you want to plot, then come back here to optimize, click the little right, the little drop down box to the right and Then click the 3D optimization chart. And you see now we've got maximum system drawdown.
And higher on this chart is always better, right? So a drawdown of 28% is better than a drawdown of 33%. So the best drawdown. Let's adjust the water level again. The best drawdown on this optimization occurs here at looks like about 30 bars in the fast moving average, but it's not very stable. You can see here this is one of the great things about this 3D chart. You can See the relative stability of.
That performance variable as you change the parameter value. So the best value for drawdown in this case is at 30 bar in moving average. But you can see it's not stable, it's a performance spike or peak. Because if you go up a little bit, the performance drops. If you go down a little bit, the performance drops. So where is the area of stability? Well, it's actually out here to the right between about 15 and 25 or 30. That's the area of maximum stability. So if I was looking at this optimization, I would choose that as the performance value. And you can plot this for any of the columns.
In your optimization results. So if we click on net profit, produce this chart again and you get a chart based on net profit and you can see stability and so on. So that's for a one dimensional optimization. Now what if you're optimizing two parameters simultaneously? This is where it gets really, really useful. Now I've already done an optimization for the purposes of this video over here on the other analysis tab. And you can see what I've done is I've optimized two moving averages simultaneously. There's the long term moving average and there's the short term moving average. So let's have a look at how the 3D graph helps us interpret two dimensional optimization. So we come, I've selected compound annual return as the variable I want to plot. And we click on 3D optimization chart and look at this. So we get a 3D chart. Now that has the number of bars in the fast moving average on this axis, the number of bars in the slow moving average on this axis, and on the vertical axis, the performance.
Variable that we're measuring in this case, compound annual return. And this is where the water level is particularly useful because this surface chart is fairly hard to read. And what we're looking for is an area of maximum stability. So if you increase this water level, you can see how the peak in performance, the best compound annual return is way over here. And that looks like at about 60 on the fast moving average and 100 on the slow moving average. But you can see it's a bit of a spike. There's not really a big stable area of performance there. I think a better area of performance might be sort of out here or even over in this area. But the point is, or the useful aspect of this tool is you can now visualize within amibroker your optimization results. And I think that's really powerful because when we're optimizing the enlightened stock trading way. We're looking for stability, not just the peak in performance and plotting it like this on a 3D chart really helps you do this. And Again, with the 3D chart, even with the two parameter optimization, you can look at any of the performance values. Let's look at maximum system drawdown and we'll produce this chart again.
And you can see the maximum system drawdown and you can start to make decisions about where to position your parameter values based on the interaction between those the long term moving average and the short term moving average or whichever parameters it is that you've optimized. So I hope that's helped. Don't forget to make sure each time you produce these. Keep notes of why you're making the decisions, copy these, paste them into your trading journal and make sure that you keep a record of all of your decisions. This is just another powerful tool in helping you optimize for maximum stability. The great thing about optimizing for maximum stability is it helps you get a high level of confidence you'll be profitable in the future and not just have a beautiful looking backtest that is actually completely useless in real time trading. So I hope that helps. That's all about the 3D graph viewer in amibroker. A very underutilized tool. I highly recommend you check it out and I'll see you in the next video. Bye for now.
It.











