Showing posts with label backtesting-example. Show all posts
Showing posts with label backtesting-example. Show all posts

## EVALUATING YOURSTRATEGY

Once you’ve determined which markets you want to trade, selected a time frame, and defined your entry and exit rules, it’s time to test and evaluate your trading strategy.

#### Back-Testing

Back-testing is a method of testing which will run your strategy against prior time periods. Basically, you’re performing a simulation: you use your strategy with relevant past data to test its effectiveness. By using the historical data, you’re saving a ton of time; if you tried to test your strategy by applying it to the time periods yet to come, it might take you years. Back-testing is used for a variety of strategies, including those based on technical analysis. The effectiveness of back-testing relies on the theory that what has happened in the past WILL happen again in the future. Also, keep in mind that your backtesting results are quite dependent on the moves that occurred in the tested time period. It’s important to remember that this increases the potential of risk for your strategy.

#### The Monte-Carlo Simulation

The Monte-Carlo Simulation is a problem-solving technique used to approximate the probability of certain outcomes by running multiple trial runs – called simulations – using random variables. It is a way to account for the randomness in a trading parameter – typically, the sequence of trades. In Monte Carlo simulations, the basic idea is to take a sequence of trades generated by a trading system, randomize the order of trades, and calculate the rate of return and the maximum draw down, assuming that x% of the account is risked on each trade.
The process is repeated several hundred times, each time using a different random sequence of the same trades.

You can then pose a question such as "If 5% of the account is risked on each trade, what is the probability that the maximum draw down will be less than 25%?" If 1,000 random sequences of trades are simulated with 5% risk, for example, and 940 of them have a maximum draw down of less than 25%, then you could say the probability of achieving a maximum draw down of less than 25% is 94% (940/1,000). Keep in mind that the data used in Monte Carlo Simulations is still historical data; therefore, one could say that this simulation is a more sophisticated way of back-testing.

Paper trading is a method of “risk-free” trading. Basically, you set up a dummy account, through which you can test your trading strategy with paper money.

There are two methods to this:

you can either pretend to buy and sell stocks, bonds, commodities, etc., and keep track of your profits and losses on paper, or you can open an account online, usually through your broker (and usually for free). This is a fantastic way for new traders to kill a whole tree full of birds with one stone. First off, you’ll learn the tricks of the trade without putting your own money at risk. Second, you’ll be able to gain some much-needed confidence when it comes to maneuvering in the markets. And third, you’ll be able to test out your trading strategy in real-time simulation. This is probably the best way to test a trading strategy, since it doesn’t rely on historical data. On the other hand, it’s the most time-consuming strategy, since it might take weeks or months until you have enough data for a statistically relevant performance report.

#### Conclusion

When back-testing, there are definitely things you need to be aware of. It's not enough to just run a strategy on as much data as possible; it's important to know the underlying market conditions. As outlined in previous chapters: in non-trending markets, you need to use trend-fading systems; and, in trending markets, you should use trend following methods.

That's when clever back-testing helps you. If your back-testing tells you that a trend-following method worked in 2011-2013, but doesn't work in 2014 and 2015, then you should not use this strategy right now. And vice versa: when you see that a trend-fading method produced nice profits in 2010 , 2011 and 2012 then trade it.

#### How to Read and Understand a Performance Report

While testing your trading strategy, you should keep detailed records of the wins and losses in order to produce a performance report. Many software packages can help you with that, but a simple excel sheet will do the trick just as well. If you get in contact with us here at Rockwell Trading®, we can send you an excel sheet that will automatically produce a performance report for you after you’ve entered several trades.

#### Total (Net) Profit

The first figure to look for is the total, or net, profit. Obviously you want your system to generate profits, but don’t be frustrated when, during the development stage, your trading system shows a loss; try to reverse your entry signals.

You might have heard that trading is a zero sum game. If you want to buy something (e.g. a certain stock or futures contract), then somebody else needs to sell it to you. And, you can only sell a position if somebody else is willing to buy from you at the price you're asking. This means that if you lose money on a trade, then the person who took the other side of the trade is MAKING money. And vice versa: if you’re making money on a trade, then the other trader is losing money. In the markets, money is not "generated." It just changes hands. So, if you’re going long at a certain price level, and you lose, then try to go short instead. Many times this is the easiest way to turn a losing system into a winning one.

The next figure you want to look at is the average profit per trade. Make sure this number is greater than slippage and commissions, and that it makes your trading worthwhile. Trading is all about risk and reward, and you want to make sure you get a decent reward for your risk.

#### Winning Percentage

Many profitable trading systems achieve a nice net profit with a rather small winning percentage, sometimes even below 30%. These systems follow the principle: “Cut your losses short and let your profits run.” However, YOU need to decide whether you can stand 7 losers and only 3 winners in 10 trades. If you want to be “right” most of the time, then you should pick a system with a high winning percentage.

#### Understanding Winning Percentage

Let's say you purchased or developed a system that has a winning percentage of 70%.

What exactly does that mean?

It means that the probability of having a winning trade is 70% – i.e. it is more likely that the trade you are currently in turns out to be a winner rather than a loser. Does that mean that when you trade 10 times you will have 7 winners? No!
It means that if you trade long enough (i.e. at least 40 trades) then you will have more winners than losers. But it doesn’t guarantee that after 3 losers in a row, you’ll have a winner.

#### Example:

If you toss a coin then you have 2 possible outcomes: heads or tails. The probability for each is 50% – i.e. when you toss the coin 4 times, then you should get 2 heads and 2 tails.

But what if you tossed the coin 3 times and you got heads 3 times?

What is the probability of heads on the fourth coin toss?

50%, or less?

If you answered 'less,' than you fell for a common misconception. The probability of getting heads again is still 50%. No more and no less.

But many traders think that the probability of tails is higher now because the three previous coin tosses resulted in heads. Some traders might even increase their bet because they are convinced that now “tails is overdue.” Statistically, this assumption is nonsense; it’s a dangerous – and many times costly – misconception.

Let's get back to our trading example: if you have a winning percentage of 70%, and you had 9 losers in a row, what’s the probability of having a winner now? It's still 70% (and therefore there's still a 30% chance of a loser).

The average winning trade should be bigger than the average losing trade. If you can keep your wins larger than your losses, then you’ll make money even if you just have a 50% winning percentage. And every trader should be able to achieve that. If you can’t, reverse your entry signals as described previously.

#### Profit Factor

Take a look at the Profit Factor (Gross Profit / Gross Loss). This will tell you how many dollars you’re likely to win for every dollar you lose. The higher the profit factor, the better the system. A system should have a profit factor of 1.5 or more, but watch out when you see profit factors above 3.0, because it might be that the system is over-optimized.

#### Maximum Drawdown

The maximum drawdown is the lowest point your account reaches between peaks.

Let me explain:

Imagine that you start your trading account with 10,000, and, after a few trades, you lose 2,000. Your draw down would be 20%. Now, let's say you make more trades and gain 4,000, which brings you to 12,000 (8,000 + 4,000 = 12,000). And after this, on the next trade, you lose 2,000. Your draw down would be 16.7% (12,000 - 2,000). The 12,000 was your equity peak; that was the highest point in the period we looked at. If you started your account with 10,000 and the lowest amount you had in your account over a six-month period was 5,000, then you had a 50% draw down You would need to make 5,000 from the lowest point in order to recoup your losses. Even though you lost 50% from your high of 10,000, you would need to make 100% on the 5,000 to get back to your original amount.

#### Measuring Drawdown Recovery

Drawdown recovery can confuse many traders. If a trader loses 20% of his account, he thinks he needs to make 20% in order to get back to even. This isn’t true. If you started with 10,000 and lost 2,000 (20%), you would need to make 25% in order to get back to even. The difference between 8,000 and 10,000 is 2,000. If you calculate the 2,000 as a percentage of 8,000 (not the original 10,000) it works out to 25%. A famous trader once said: “If you want your system to double or triple your account, you should expect a drawdown of up to 30% on your way to trading riches.” Not every trader can stand a 30% drawdown. Look at the maximum drawdown that your strategy has produced so far, and double it. If you can stand this drawdown, then you’ve found the right strategy. Why double it? Remember: your worst drawdown is always ahead of you. It’s best to plan for it now.

#### Conclusion

The above examples provide you with some guidelines, but it’s up to you to decide whether the numbers in the strategy’s performance report work for you or don’t. Ultimately, YOU’RE the one trading the strategy, and YOU’RE the one who has to feel comfortable with the expected results of your strategy.