Backtest sorting by lowest drawdown
Forums › ProRealTime English forum › ProOrder support › Backtest sorting by lowest drawdown
- This topic has 39 replies, 7 voices, and was last updated 4 years ago by Vonasi.
-
-
03/18/2018 at 3:08 PM #65575
I’ve been thinking about drawdown and although PRT does not let us sort our backtest results according to which backtest has the least drawdown it is possible to manually check this. If you reduce the starting capital and then run an optimization backtest some results will result in losses if the money runs out when drawdown is greater than capital. Keep reducing the capital and repeating the backtest and it will soon be clear which variables result in more acceptable drawdown.
This may be what some on here already do but I thought that I would post it just in case it helps someone achieve better backtest results.
In this image the start capital is 100000 and all tests are profitable but as can be seen the drawdown is massive.
Whereas in this image the start capital is 1500 and some tests have resulted in so much drawdown that the money runs out – but there is clearly ranges where drawdown is more acceptable. Obviously if the drawdown all happens late in the strategy then this method may not work.
An alternative would be to code something that monitors drawdown from the start of any period of being OnMarket and quits the strategy (or makes capital zero) during a backtest if a level of drawdown is exceeded. Does anybody already do this and care to share their code?
1 user thanked author for this post.
03/18/2018 at 5:01 PM #65588At the moment I have just added the following to my strategies so that if drawdown is greater than desired that particular backtest is stopped with the QUIT instruction. This has the added benefit of reducing backtest time. I can then sort the results by Max Gain or Nbr Bets and the results at the top of the table are most likely to be the ones that did not quit during the backtest and so are of the most interest.
If anyone has a better way then it would be good try it.
12345MaxDrawdown = 1500IF OnMarket and (PositionPrice - Low)*CountOfPosition > MaxDrawDown THENQuitENDIF03/18/2018 at 5:12 PM #65589If you use the above code on a strategy with money management then it won’t work very well. Best to use a percentage of equity as your maximum allowed drawdown if that is the case.
123456789Capital = 3000MaxDrawDownPercentage = 66Equity = Capital + StrategyProfitMaxDrawdown = Equity * (MaxDrawDownPercentage/100)IF OnMarket and ((PositionPrice - low)*CountOfPosition) > MaxDrawDown THENQuitENDIF4 users thanked author for this post.
03/18/2018 at 5:18 PM #65590My concern is usually not so much lowest drawdown, but highest ratio of gains/losses. Drawdown is an absolute number, and can be quite large for a system that makes even larger gains (system No. 1).
On the other hand, a system with only small absolute gains (system No. 2) may have small drawdowns as well. However, when you scale this system up to higher contract numbers, it may yield the same total absolute gain as system No. 1, but a much higher absolute drawdown.
This is why I prefer to look at the ratio of gains/losses instead of absolute drawdown. The ratio of gains to losses is independent of the number of contracts you trade.
So, if someone could find a way to sort backtest results by this ratio, it may be indeed quite helpful. However, usually, when you combine absolute gains and gain per position, you may come quite close to the best ratio of gains/losses.
Of two systems with the same absolute gain but different number of positions, the one with fewer positions will usually have lower drawdown and a better ratio of gains/losses. At least in my systems.
1 user thanked author for this post.
03/18/2018 at 5:31 PM #65593Hello Verdi55. I thought this sort of thread would be right up your alley! 🙂
Everything you have written is correct but at the moment I am just considering that not everyone wants to jump straight in and start trading a strategy that could just go straight into a massive drawdown. A smaller starting bank requires only strategies that have low risk of a large drawdown for someone to want to start trading them – and so I am just trying to find the best way of getting just those results.
As you say the ideal strategy has few trades with large gains and small losses but these can be the hardest strategies to have confidence in due to the lack of trades in the backtests. Add in the possibility of a large drawdown at any moment and confidence is even more difficult to find. Whereas a steadily profitable strategy with low drawdown and lots of trades but not massive gain/loss ratio is easier to backtest and easier to have confidence in the backtest results of I think?
03/18/2018 at 6:50 PM #65611A smaller starting bank requires only strategies that have low risk of a large drawdown for someone to want to start trading them – and so I am just trying to find the best way of getting just those results. As you say the ideal strategy has few trades with large gains and small losses but these can be the hardest strategies to have confidence in due to the lack of trades in the backtests. Add in the possibility of a large drawdown at any moment and confidence is even more difficult to find. Whereas a steadily profitable strategy with low drawdown and lots of trades but not massive gain/loss ratio is easier to backtest and easier to have confidence in the backtest results of I think?
In general, I agree. Among my short-term strategies, the ones with the highest ratio of gains/losses (say, between 1.6 and 4, in an optimized backtest, depending very much on current market behavior and volatility) have the lowest drawdowns as well (maybe 200-300 DAX points, all in an optimized backtest). The number of positions for these systems is about 1-2 per day, so I don’t think I have optimized everything away that does not fit into my idealized view. It is this kind of system that you can run almost permanently, because over time they make no or only small losses, even in bad times (which may take quite long, sometimes more than a year, unfortunately).
I observe the general tendency : Short-term trading (1-3 minute chart) has low drawdowns and high ratio of gains/losses, but not necessarily the highest absolute gains.
Longer term trading (30 minutes – 4 h chart) has much higher drawdowns, lower ratios of gains/losses, and most of time the highest absolute gain per time. The number of positions per time is lower here, of course, about 0.5 – 1 per day, in optimized backtests.
Of course, you always have to take care not to optimize all of the really bad days away in hindsight in your latest optimization run and to reduce the total number of positions this way. Look at some of the pathfinder systems, and you may know what I mean.
03/18/2018 at 7:00 PM #6561203/18/2018 at 7:59 PM #65613I run my backtests just with 1 contract for the whole period
There is in my mind no reason to do anything else but this. Adding money management while still developing a strategy is just adding another level of mud to dilute the clarity. Once I am happy that a strategy is as good as I can get it then I will add money management and have a look at the snap shot dream of what could have been – but then I will turn the money management off and forward test in demo with level stakes. No point in wasting lots of demo equity on a strategy that fails to deliver! Level stakes will tell us all we need to know.
As I have said somewhere else in another thread I am at the moment finding that daily or weekly strategies suit me better as I like trading the bigger picture rather than the noise – but they do require a bigger starting capital and can involve bigger drawdowns hence my interest in working out which backtests have the lowest drawdown. If a trader has a million in the bank then it is very simple to make a guaranteed profit by averaging down in the recessions and increasing your stake as you do – and you never need worry about the draw downs. I’m a few quid short of the million right now though so draw downs can still hurt
03/18/2018 at 8:22 PM #65614As my taxi driver said last time : The first million is always the hardest. Why ? From 1 to 2 millions you only need to double your capital…
The chart region around 30 minutes appears to be a good compromise between gains and small drawdowns. Weekly or daily charts for me usually come quite close to buy and hold. All the setbacks included.
03/18/2018 at 8:50 PM #65615If you are looking for good DAX signals on the hourly or daily timeframe, try this guy :
http://www.systems-trading.de/handelssignal.htm
Usually, he makes between 1000 and 2000 DAX points per year, ever since I have been looking at him. I don’t know how he does it, but normally it works well. His worst year was 2014 with only 300 DAX points.
03/18/2018 at 9:03 PM #65616Interesting discussion guys!I’ve added your drawdown snippets to my Snippet Finder Vonasi … is that okay?GraHal03/18/2018 at 9:13 PM #65617GraHal, here is another snippet I have posted today, and it may be interesting for your database. It sets the stop loss to break-even after a certain price movement into positive territory :
https://www.prorealcode.com/blog/learning/trailing-stop-max-favorable-excursion-mfe/#comment-5885
1 user thanked author for this post.
03/18/2018 at 9:58 PM #6562203/18/2018 at 10:13 PM #65623Weekly or daily charts for me usually come quite close to buy and hold.
If buy, hold a bit, sell, wait a bit, repeat = more profit than buy and hold after trading costs then it is a worthwhile strategy. Not exciting to trade but any profit is good no matter how it is come by!
No problem regarding the code for the snippet thing GraHal. In fact maybe the answer to the lack of others adding to your library can be solved by you personally hoovering code up when you see something you like. I think the process of adding may be too labour intensive /confusing for most people. Hopefully Nicolas will create a permanent library when he has some spare time! Bit off topic so back to drawdown and other closely associated subjects….
1 user thanked author for this post.
03/18/2018 at 10:19 PM #65624If you are looking for good DAX signals on the hourly or daily timeframe, try this guy : http://www.systems-trading.de/handelssignal.htm Usually, he makes between 1000 and 2000 DAX points per year, ever since I have been looking at him. I don’t know how he does it, but normally it works well. His worst year was 2014 with only 300 DAX points.
Thanks for the link verdi55 but unfortunately my language skills are not quite quite up to the quantity of German due to it being 100% German! Are we allowed to promote outside signal services on here? Someone may be along soon to tell you off!
-
AuthorPosts
Find exclusive trading pro-tools on