Algorithmic and Mechanical Forex Strategies | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • Testimonials
  • Contact

What’s going on?

April 22, 2015 by Shaun Overton 9 Comments

It’s been a bumpy month by any definition. We made a ton of money in the aftermath of last month’s Fed announcement, only to give it all back the next week. QB Pro recovered most of the earlier gains, then last week’s drawdown took it all back again. It’s been painful.

The good news is that the new changes to QB Pro are rolled out. Several of you sent in emails asking about new currencies like GBPNZD and AUDCAD appearing in your account. Kudos to you for paying close attention to the trading.

The total currencies traded in the basket is up to 16 pairs. While the max leverage is unchanged at 36:1 (still very, very high), the leverage per pair is only 2.25:1. Future losses like the one from last week will still occur.

The difference is that the size of the positions is reduced by over 2/3. The impact of getting caught in losing trades that are all reflective of USD weakness decreases significantly. We’re now trading a mix of AUD, CAD, CHF, EUR, GBP, JPY, NZD, USD and XAG. No one currency should dominate the performance.

The system also does extremely well on emerging market currencies. I’m holding off on adding RUB, MXN and others until I determine the impact of the spreads on overall profitability. They’d do amazing if we could trade for free!

Short term performance expectations for QB Pro

We’re coming into the summer, which is when the forex market traditionally falls into the doldrums. That’s generally a good thing for QB Pro. The markets whipsaw up and down without really going anywhere.

The alternative is that the Fed hikes rates in June and sends the market into a USD buying frenzy. That’s also good news. Most of the money that QB Pro made over the past 8 months was driven by USD strength. A rate hike would unleash chaos in emerging markets and equities. That’s the kind of condition to push volatility into our new crosses, creating opportunities for us to trade.

QB Pro 2.0 isn’t happening

I’m extremely disappointed. After several thousand dollars in programming expenses, and not to mention the 100+ hours that I spent coding myself, the QB Pro 2.0 change is a wash.

I had a trusted developer audit my code to make sure I wasn’t doing something stupid like trading on future prices or anything. Neither him nor myself caught anything from December until March.

Towards the end of last month, a single line of code ruined it all. One of my key features was deciding when to bail on trades and go the opposite direction. Well, it turned out that I accidentally introduced data snooping into the backtesting platform. I pre-calculated when losing trades occurred to calculate probabilities.

In plain English, my goal was to calculate “If today was a big loser, then do the opposite tomorrow.”

What I accidentally coded was “If tomorrow is a big loser, then do the opposite.” If only that were possible!

I don’t want to muddle up the explanation with code examples. Suffice it to say that the idea didn’t work out when I took away the ability to look into the future.

There are some features of the 2.0 system that I wish to analyze in the coming months, but for now it’s going to have to take a back seat.

What’s next?

My plan is to sit tight for a few weeks to ensure that the new pairs are working as intended. Whenever I am personally satisfied with the system behavior, I intend to increase the amount of capital in my account.

Don’t hold my feet to the fire. This part is a subjective process, so I can’t put a precise time frame on it. If and when I am satisfied – and it’s going very well the first few days – then I will make a decision about increasing my capital at risk.

If and when I choose to increase my capital in the account, I will then re-open QB Pro to new traders.

PS: I hope that the drawdowns encourage some of you to withdraw profits the next time the opportunity presents itself. You don’t want to lose more than you are comfortable risking.

Filed Under: QB Pro, Test your concepts historically Tagged With: backtesting, drawdown, QB Pro

Choosing The Right Strategy

November 12, 2014 by Eddie Flower 3 Comments

Traders use a variety of strategies in the markets, all based on two forms of analysis: Fundamental analysis and technical analysis. Although institutions and other large traders often use a combination of these two analytical styles, most independent traders rely on strategies based largely on technical analysis.

Let’s take a look at both analytical styles as they apply to trading forex.

Fundamental analysis

In the stock markets, equities traders are sometimes able to value a company (and therefore predict its share price) if they know all the information about that company. That’s because the share price of the company reflects the value of its known assets. By knowing a company, the equity trader knows what its share price should be.

However, in forex markets using fundamental analysis alone is far less effective, because it’s extremely difficult to value an entire country’s economy in order to predict its currency’s value. Most forex traders use exclusively technical analysis.

When full scale fundamental analysis is applied to forex markets, it’s most often used as a way to predict longer-term trends. And, some traders use data such as news releases in the short term to generate trades or confirm signals. So, along with their mainstay technical analysis, some traders incorporate fundamental data.

Here are some of the fundamental indicators commonly used by forex traders:

★ Non-Farm Payroll

★ Consumer Price Index (CPI)

★ Purchasing Managers Index (PMI)

★ Durable Goods Sales

★ Retail Sales

For best results, savvy traders also pay attention to various meetings of government officials and industry conferences, and other venues where market-moving quotes and commentary can be found.

Meetings are scheduled to discuss inflation, interest rates and other issues that directly affect currency prices. These meetings and conferences are often reported in the industry press before they reach mainstream media. The important event for fundamentals-based forex traders is the Federal Open Market Committee (FOMC) press conference and meeting transcript.

Forex traders can follow meetings and conferences and become highly knowledgeable specialists, and profit by knowing a particular market better than most others.

Technical analysis

Technical analysis is by far the most common basis for forex strategies. Using technical analysis in forex is different than in equities, because the forex time frame is 24 hours worldwide whereas many stocks don’t trade overnight, so their price movements are different.

Traders use a huge variety of individualized systems, often built by knowledgeable EA providers, with many different indicators. Here are just a few of the most common indicators and theories used in technical analysis:

★ Elliott Waves

★ Parabolic SAR

★ Gann Theory

★ Fibonacci Numbers

★ Pivot points

Traders craft many different strategies based on technical analysis, especially by combining multiple indicators. Other developers create trading systems based on finding historical buying and selling patterns that are expected to be repeated.

Developing a personal strategy

Successful forex traders develop and fine-tune their strategies over time. Some traders focus on a particular tool or calculation, while others user a broader approach and experiment with a combination of technical and fundamental analysis.

Many new traders wisely start out by “paper trading” or using a demo account with a forex broker. And, experienced traders almost invariably develop new systems with backtesting before trying them in real time. Lack of experience can cause you to lose your capital, so it’s important to take the time to practice before committing significant money to any new trading system.

Regardless of whether you use technical indicators alone, or incorporate fundamentals as well, if you have the discipline to learn your target markets and trade confidently while carefully managing risks, then your strategy has an excellent chance to succeed.

Do you rely on technical indicators? Fundamental indicators? Or, a combination of both?

Filed Under: Test your concepts historically, Trading strategy ideas Tagged With: backtesting, Fibonacci, forex strategy, forex trading system, Gann, parabolic SAR, pivot point

How To Win With Mechanical Trading Systems

March 18, 2014 by Eddie Flower 13 Comments

Much ink has been devoted to pinpointing the causes of mechanical trading systems failures, especially after the fact. Although it may seem oxymoronic (or, to some traders, simply moronic), the main reason why these trading systems fail is because they rely too much on the hands-free, fire-and-forget nature of mechanical trading. Algorithms themselves lack the objective human oversight and intervention necessary to help systems evolve in step with changing market conditions.

Mechanical trading systems failure, or trader failure?

Instead of bemoaning a trading-system failure, it’s more constructive to consider the ways in which traders can have the best of both worlds:  That is, traders can enjoy the benefits of algorithm-managed mechanical trading systems, such as rapid-fire automatic executions and emotion-free trading decisions, while still leveraging their innate human capacity for objective thinking about failure and success.

The most important element of any trader is the human capability to evolve. Traders can change and adapt their trading systems in order to continue winning before losses become financially or emotionally devastating.

Choose the right type and amount of market data for testing

Successful traders use a system of repetitive rules to harvest gains from short-term inefficiencies in the market. For small, independent traders in the big world of securities and derivatives trading, where spreads are thin and competition fierce, the best opportunities for gains come from spotting market inefficiencies based on simple, easy-to-quantify data, then taking action as quickly as possible.

When a trader develops and operates mechanical trading systems based on historical data, he or she is hoping for future gains based on the idea that current marketplace inefficiencies will continue. If a trader chooses the wrong data set or uses the wrong parameters to qualify the data, precious opportunities may be lost. At the same time, once the inefficiency detected in historical data no longer exists, then the trading system fails. The reasons why it vanished are unimportant to the mechanical trader. Only the results matter.

mechanical trading rules

Pick the most pertinent data sets when choosing the data set from which to create and test mechanical trading systems. And, in order to test a sample large enough to confirm whether a trading rule works consistently under a wide range of market conditions, a trader must use the longest practical period of test data.

So, it seems appropriate to build mechanical trading systems based on both the longest-possible historical data set as well as the simplest set of design parameters. Robustness is generally considered the ability to withstand many types of market conditions. Robustness should be inherent in any system tested across a long time range of historical data and simple rules. Lengthy testing and basic rules should reflect the widest array of potential market conditions in the future.

All mechanical trading systems will eventually fail because historical data obviously does not contain all future events. Any system built on historical data will eventually encounter ahistorical conditions. Human insight and intervention prevents automated strategies from running off the rails. The folks at Knight Capital know something about live trading snafus.

Simplicity wins by its adaptability

Successful mechanical trading systems are like living, breathing organisms. The world’s geologic strata are filled with fossils of organisms which, although ideally suited for short-term success during their own historical periods, were too specialized for long-term survival and adaptation. Simple algorithmic mechanical trading systems with human guidance are best because they can undergo quick, easy evolution and adaptation to the changing conditions in the environment (read marketplace).

Simple trading rules reduce the potential impact of data-mining bias. Bias from data mining is problematic because it may overstate how well a historical rule will apply under future conditions, especially when mechanical trading systems are focused on short time frames. Simple and robust mechanical trading systems shouldn’t by affected by the time frames used for testing purposes. – The number of test points found within a given range of historical data should still be large enough to prove or disprove the validity of the trading rules being tested. Stated differently, simple, robust mechanical trading systems will outshine data-mining bias.

If a trader uses a system with simple design parameters, such as the QuantBar system, and tests it by using the longest appropriate historical time period, then the only other important tasks will be to stick to the discipline of trading the system and monitoring its results going forward. Observation enables evolution.

On the other hand, traders who use mechanical trading systems built from a complex set of multiple parameters run the risk of “pre-evolving” their systems into early extinction.

Build a robust system that leverages the best of mechanical trading, without falling prey to its weaknesses

It’s important not to confuse the robustness of mechanical trading systems with their adaptability. Systems developed based on a multitude of parameters led to winning trades during historical periods – and even during current observed periods – are often described as ‘robust.’ That is no a guarantee that such systems can be successfully tweaked once they have been trade past their “honeymoon period.” That is an initial trading period during which conditions happen to coincide with a certain historical period upon which the system was based.

Simple mechanical trading systems are easily adapted to new conditions, even when the root causes of marketplace change remain unclear, and complex systems fall short. When market conditions change, as they continually do, the trading systems which are most likely to continue to win are those which are simple and most-easily adaptable to new conditions; a truly robust system is one which has longevity above all.

Simple algorithmic mechanical trading systems with human guidance are best because they can undergo quick, easy evolution and adaptation to the changing conditions in the environment (read marketplace).

Unfortunately, after experiencing an initial period of gains when using overly-complex mechanical trading systems, many traders fall into the trap of attempting to tweak those systems back to success. The market’s unknown, yet changing, conditions may have already doomed that entire species of mechanical trading systems to extinction. Again, simplicity and adaptability to changing conditions offer the best hope for survival of any trading system.

Use an objective measurement to distinguish between success and failure

A trader’s most-common downfall is a psychological attachment to his or her trading system. When trading-system failures occur, it’s usually because traders have adopted a subjective rather than objective viewpoint, especially with regard to stop-losses during particular trades.

Human nature often drives a trader to develop an emotional attachment to a particular system, especially when the trader has invested a significant amount of time and money into mechanical trading systems with many complex parts which are difficult to understand. However, it’s critically important for a trader to step outside the system in order to consider it objectively.

In some cases, the trader becomes delusional about the expected success of a system, even to the point of continuing to trade an obviously-losing system far longer than a subjective analysis would have allowed. Or, after a period of fat wins, a trader may become “married” to a formerly-winning system even while its beauty fades under the pressure of losses. Worse, a trader may fall into the trap of selectively choosing the testing periods or statistical parameters for an already-losing system, in order to maintain false hope for the system’s continuing value.

An objective yardstick, such as using standard deviation methods to assess the probability of current failure, is the only winning method for determining whether mechanical trading systems have truly failed. Through an objective eye, it’s easy for a trader to quickly spot failure or potential failure in mechanical trading systems, and a simple system may be quickly and easily adapted to create a freshly-winning system once again.

Failure of mechanical trading systems is often quantified based on a comparison of the current losses when measured against the historical losses or drawdowns. Such an analysis may lead to a subjective, incorrect conclusion. Maximum drawdown is often used as the threshold metric by which a trader will abandon a system. Without considering the manner by which the system reached that drawdown level, or the length of time required to reach that level, a trader should not conclude that the system is a loser based on drawdown alone.

Standard deviation versus drawdown as a metric of failure

In fact, the best method to avoid discarding a winning system is to use an objective measurement standard to determine the current or recent distribution of returns from the system obtained while actually trading it. Compare that measurement against the historical distribution of returns calculated from back-testing, while assigning a fixed threshold value according to the certainty that the current “losing” distribution of mechanical trading systems is indeed beyond normal, to-be-expected losses, and should therefore be discarded as failed.

So, for example, assume that a trader ignores the current drawdown level which has signaled a problem and triggered his investigation. Instead, compare the current losing streak against the historical losses which would have occurred while trading that system during historical test periods. Depending upon how conservative a trader is, he or she may discover that the current or recent loss is beyond, say, the 95% certainty level implied by two standard deviations from the “normal” historical loss level. This would certainly be a strong statistical sign that the system is performing poorly, and has therefore failed. In contrast, a different trader with greater appetite for risk may objectively decide that three standard deviations from the norm (i.e. 99.7%) is the appropriate certainty level for judging a trading system as “failed.”

The most important factor for any trading systems’ success, whether manual or mechanical, is always the human decision-making ability. The value of good mechanical trading systems is that, like all good machines, they minimize human weaknesses and empower achievements far beyond those attainable through manual methods. Yet, when properly built, they still allow firm control according to the trader’s judgment and allow him or her to steer clear of obstacles and potential failures.

Although a trader can use math in the form of a statistical calculation of standard distribution to assess whether a loss is normal and acceptable according to historical records, he or she is still relying on human judgment instead of making purely-mechanical, math-based decisions based on algorithms alone.

Traders can enjoy the best of both worlds. The power of algorithms and mechanical trading minimizes the effects of human emotion and tardiness on order placement and execution, especially with regard to maintaining stop-loss discipline. It still uses the objective assessment of standard deviation in order to retain human control over the trading system.

Be prepared for change, and be prepared to change the trading system

Along with the objectivity to detect when mechanical trading systems change from winners into losers, a trader must also have the discipline and foresight to evolve and change the systems so they can continue to win during new market conditions. In any environment filled with change, the simpler the system, the quicker and easier its evolution will be. If a complex strategy fails, it may be easier to replace than to modify it, while some of the simplest and most-intuitive systems, such as the QuantBar system, are relatively easy to modify on-the-fly in order to adapt to future market conditions.

In summary, it can be said properly-built mechanical trading systems should be simple and adaptable, and tested according to the right type and amount of data so that they will be robust enough to produce gains under a wide variety of market conditions. And, a winning system must be judged by the appropriate metric of success. Instead of merely relying on algorithmic trading rules or maximum drawdown levels, any decision about whether a system has failed should be made according to the trader’s human judgment, and based on an assessment of the number of standard deviations of the system’s current performance when measured against its historic-test losses. If mechanical trading systems are failing to perform, the trader should make the necessary changes instead of clinging to a losing system.

Filed Under: How does the forex market work?, MetaTrader Tips, Trading strategy ideas Tagged With: backtesting, expert advisor, forex, mechanical trading, risk management, standard deviation, stop loss, strategy

How To Know When Your System Fails

February 26, 2014 by Andrew Selby Leave a Comment

One of the most frustrating aspects of quantitative trading is that most of the strategies we develop will end up failing. Experiencing system failure can be very difficult for a trader to handle on many levels. There will be a tough emotional and psychological impact to deal with, and there will also be financial losses to address.

Because system failure can be such a devastating event, we need to be prepared to recognize it as early as possible and have a plan to deal with it. System failure could be defined by drawdowns that are too large, drawdowns that are too long, or a general failure to create profits. Whatever definition you prefer, it is important to consider failure in quantitative terms, leaving subjective opinions out of the decision. 

system failure

Dealing with system failure can be extremely difficult. The key is to avoid making it a subjective evaluation by pre-defining failure criteria.

Daniel Fernandez from Mechanical Forex wrote a post this week on how to define and quantify system failure. In that post, Daniel discusses having a specific definition for failure that accounts for sample size, relative performance, and performance relative to historic testing results. His point is that traders need to have a quantitative limit at which they will give up on a system.

Avoiding Subjective Assessments

Daniel makes a great point about traders who have an emotional attachment to their strategies ignoring statistical evidence that the system is failing:

When the attachment – due to economical, psychological reasons, etc – is too great, a trader will always have problems with saying that a system failed, because the burden of failure might be greater than the burden of financial loss if the system continues to trade.

When we spend a large amount of time developing our system, we can naturally become attached to them. Just like parents dealing with disciplining their young children, we will have to separate our desire for these systems to succeed from our ability to realistically interpret what is actually happening.

Failure is Relative

Whether you choose to compare your system to a benchmark, historical backtesting, or a monte carlo simulation, you should have a pre-defined limit for how far the system will be allowed to deviate from its expected results. This will help to eliminate any subjective opinions about how well a system is performing.

Sample Size Matters

It is also important to have a pre-defined limit for the sample size that you will consider statistically significant. Comparing a 5 trade sample to a 5000 trade backtest is obviously quite flawed, but you have to set a number of trades that you will consider to be a good representation of your strategy.

As the number of trades increases or decreases, so does the significance of the depth or length of a drawdown. It is your responsibility to define the point at which the number of trades crosses the threshold of significance.

Filed Under: Trading strategy ideas Tagged With: backtesting, live trading, system failure

The Blueprint for Creating Your Own Forex Strategy, Part 2

February 18, 2014 by Andrew Selby Leave a Comment

Earlier this month, we looked at an article from Forex Crunch that covered the first three steps for building a new quantitative Forex strategy. Those first three steps covered brainstorming strategy ideas, defining the rules, and optimizing the parameters.

At that point we had a strategy that we had reason to believe would perform well in a trading situation. The next steps would involve properly testing our strategy in order to prove its value.

forex strategy

After brainstorming, defining rules, and optimizing a new Forex strategy, the next steps involve rigorous testing.

Forex Crunch has since published the second three steps for creating a robust Forex system. This post focuses on testing the system that was created with the first three steps. It suggests starting with in-sample testing, then moving to out-of-sample testing, and then suggests some even deeper methods of testing.

The Most Important Point Regarding Testing

While there is plenty of great information in the article about the different types of testing that should be performed on a new Forex strategy, the most significant point that the article makes is actually stated in the introduction:

Relying on the CAR (compound annual return) figure is not always a good idea because this metric does not take into account the risk that was involved in producing those gains.

This point is extremely basic, which makes it easy to overlook. While a strong compound annual return is the end goal of every trader, we all know that there are many ways to arrive at a strong compound annual return, and some of them aren’t worth the effort.

In addition to compound annual return, we also need to be concerned with how the strategy performs from a risk perspective. Looking at statistics like maximum drawdown, profit factor, Sharpe ratio, and winning percentage gives us a better idea of how the strategy arrives at its compound annual return.

This bigger picture view will give us a more qualified overview of what trading the strategy will feel like. We can use that to determine if the amount of risk the strategy exposes our capital to is in our tolerable range.

Testing Forex Strategies

Testing on in-sample data is where we can fine tune our strategies in order to get the return and risk statistics into the desired range. From there, we move to out-of-sample testing where we attempt to replicate those statistics on a fresh data set.

There are also testing methods like Walk-Forward Optimization and Monte Carlo Simulations that can shed even more light onto how our new system can be expected to perform in live trading. The important thing to watch for during this testing phase is consistency. The strategy should perform similarly across all of these different types of testing.

If the strategy produces solid returns through a wide range of testing, it can be expected to produce similar results in live trading.

Filed Under: Test your concepts historically Tagged With: backtesting, in-sample, monte carlo, out-of-sample, walk forward

The Difference Between Optimization and Curve-Fitting

February 3, 2014 by Andrew Selby Leave a Comment

Optimization and curve-fitting are two terms that are very common among quantitative traders. They are so common that many traders confuse the terms, or use them as synonyms when they actually have very different meanings.

Michael Harris recently published a guest post on System Trader Success that broke down the meaning of each of these terms and explained how they interact with each other. He also shared a process for determining how likely a strategy was to be exposed to a curve-fitting bias that is based on how its parameters are utilized.

curve-fitting

Knowing the difference between optimization and curve-fitting can help you avoid exposing your strategy to backtesting biases.

Optimization vs. Curve-Fitting

Michael began by defining each of the two terms individually. What this shows us is that they have subtle differences with respect to each other. Here is how he explains it:

As already mentioned, curve fitting may involve optimization but the latter is a process with a much broader scope and includes many more possibilities than curve-fitting.

Michael looks at strategy optimization from the viewpoint of finding the best collection of entry and exit signals for a backtesting period. He explains that curve-fitting focuses more on the results than the signals that caused the result.

Is Curve-Fitting Really The Problem?

Another interesting point that Michael brings up is that there is no mathematical proof that optimized systems are more likely to fail because they are curve-fit. He suggests that it is possible for any optimized strategy to fail at any point, and that the strategy failure has nothing to do with what parameters the system uses.

He explains that a different form of bias is far more likely to cause a failure:

Nevertheless, optimization that causes selection of entry and exit collections is in general a problematic process because it introduces survivorship bias.

Michael argues that in almost every case where an optimized strategy fails, survivorship bias is more likely to blame than a curve-fitting bias.

How To Gauge Optimized Trading Strategies

While Michael does not believe that curve-fitting failures are nearly as prevalent as many traders believe, he does discuss how some strategies are more likely to be exposed to curve-fitting than others. In order to gauge how likely an optimized strategy is to be exposed to curve-fitting, Michael divides them into three different classes.

The first class contains strategies where the optimized parameters define both the entry and exit signals. These strategies are the most vulnerable to curve-fitting.

The second class contains strategies where just the entry signals are defined by optimized parameters. These strategies are less likely to be exposed to curve-fitting than those in the first class.

The third class contains strategies where the optimized parameters define only the exit signals. These strategies are the least likely to be exposed to curve-fitting.

 

Filed Under: Test your concepts historically Tagged With: backtesting, bias, curve fitting, optimization

Have You Prepared For System Failure?

January 3, 2014 by Andrew Selby Leave a Comment

One of the misconceptions that many quantitative traders fall prey to is neglecting to consider that their strategy will eventually stop working. We are led to believe that once we develop and backtest a profitable strategy, we will simply be able to print money indefinitely. However, this is almost never the case.

Due to the unpredictable nature of financial markets, all systems and strategies will eventually fail. At the very least, they will need to be adjusted. This means that developing a trading strategy is an ongoing process, not a one-time project.

system failure

Eventual system failure is inevitable for all types of strategies. Are you prepared for it to happen to you?

Daniel Fernandez from Mechanical Forex wrote a post on this topic earlier this week. He suggests that the ability to detect system failure with as little pain as possible is a pivotally important aspect of Forex strategy development. He explains why all quantitative strategies are bound to fail eventually:

Eventual system failure – what we can call system death – is an inevitable consequence of an edge developed on a finite amount of information on a market with potentially infinite variations.

Detecting System Failure

Fernandez made some particularly interesting points about the process of detecting potential system failure. In order to detect that a strategy no longer working, a trader will most likely have to go through a difficult losing period. 

Through extensive backtesting, walk-forward testing, and monte carlo simulations, a trader can establish parameters that describe a normal losing period for a given strategy. In order for that trader to determine system failure, they will have to trade through that normal losing period and then some.

The interesting concept that Fernandez brings up is that different strategies will have different conditions for those standard losing periods.

Low Win Ratio Strategies

Trading systems that are based on low winning percentages and high reward to risk ratios are expected to have long losing streaks. Therefore, it would take an exceptionally long losing streak to signal that system failure is possible.

Fernandez also adds that these types of strategies often rely on a few very profitable trades to make up for lots of small losses. That means that missing one key trade could result in a false signal that the system has failed.

High Win Ratio Strategies

Strategies based on high winning percentages and low reward to risk ratios pose the exact opposite problem. They experience much shorter losing streaks, so they are able to identify system failure much sooner.

Of course, the losses that these types of systems do take are often very large. While it might be a short string of losses that identifies the system failure, those losses are likely going to be incredibly painful.

Best Strategies for Detecting Failure

Fernandez concludes that the systems that provide the least painful means of detecting system failure are strategies with moderate winning percentages and reward to risk ratios.

He suggests that systems with reward to risk ratios around 1 to 1 and winning percentages just over 50% are able to signal failure in the best manner. These types of strategies can signal failure quickly, without crippling the buying power of an account.

Trading Frequency

The last topic that Fernandez mentions is the trading frequency of a strategy. Again, he suggests targeting a middle-of-the-road approach.

The fact that high-frequency trading systems can run through long losing streaks quickly might be seen as an advantage. Fernandez points out that this can be a double edge sword. Short term disruptions in market behavior can lead to false signals of system failure. 

 

Filed Under: Test your concepts historically Tagged With: backtesting, risk reward, system failure, walk forward, winning percentage

Walk Forward Optimization: A More Detailed Explanation

December 10, 2013 by Andrew Selby Leave a Comment

Two weeks ago, we looked at an example of using walk forward optimization by VBO Systems that tested a volatility breakout system. While this article was interesting from a nuts and bolts aspect, it left a lot on the table in terms of explanation.

The author has since expanded that post to include a more detailed explanation of exactly what we are trying to do with walk forward optimization. This new introduction to the article provides us with some details and background on why walk forward optimization is so effective.

walk forward optimization

Walk forward optimization allows up to test how a strategy would have traded in a live environment and evaluate which parameters would have performed best.

The article starts by listing some of the reasons that systems can lose their edge:

  • The system is not based on a valid premise
  • Market conditions have changed in a dramatic way that invalids the theoretical premises on which the system was developed
  • The system has not been developed and tested with a sound methodology. For instance, (a) lack of robustness in a system due to improper parameters, and (b) inconsistent rules and improper testing of the system using out-of-sample and in-sample data

It continues by explaining how a basic walk forward optimization is conducted:

Walk forward analysis is the process of optimizing a trading system using a limited set of parameters, and then testing the best optimized parameter set on out-of-sample data.

This process is similar to how a trader would use an automated trading system in real live trading. The in sample time window is shifted forward by the period covered by the out-of-sample test, and the process is repeated.

At the end of the test, all of the recorded results are used to assess the trading strategy.

In order to make sure the concept is understood, it is also explained another way:

In other words, walk forward analysis does optimization on a training set; tests on a period after the set and then rolls it all forward and repeats the process.

We have multiple out-of-sample periods and look at these results combined. Walk forward testing is a specific application of a technique known as Cross-validation.

It means taking a segment of data to optimize a system, and another segment of data to validate. This gives a larger out-of-sample period and allows the system developer to see how stable the system is over time.

As we covered in the previous post, there are three main aspects of this process:

  1. Define in-sample and out-of-sample periods
  2. Define a robust parameters area
  3. Execute the walk forward

As you can see, performing a walk forward optimization on a system that you are developing will help you to gain an understanding about how a system will perform in real time, while at the same time finding the optimal parameters for the strategy.

Filed Under: Test your concepts historically Tagged With: backtesting, forward testing, walk forward optimization

Walk Forward Optimization: Explained in Plain English

November 29, 2013 by Andrew Selby Leave a Comment

Traders that gravitate towards quantitative strategies are typically nerds.

I don’t mean that in a negative way, because I consider myself one as well. However, nerds have a tendency to speak and write using far more complex words and sentences than actually necessary.

Because of that tendency, entry-level explanations can often be confusing for beginners to understand.

This comes across especially well on the topic of walk forward optimization. Most of the articles about the topic are very complex and involve some high level math. This can be extremely discouraging for someone just looking into systematic trading strategies.

walk forward optimization

Many quantitative traders have a hard time explaining walk forward optimization in simple terms.

VBO Systems posted a very helpful case study using walk forward optimization this week. They started by briefly explaining the three main steps of their walk forward optimization process:

  1. Define in-sample and out-of-sample periods
  2. Define a robust parameters area
  3. Execute the walk forward

That’s simple enough. Next, they specified the system and data that they would be using for the case study:

For this test we will use the FDAX and a volatility breakout (VBO) intraday trading system.

We will use NinjaTrader and CQG historical 1-minute data, assuming 3 points of slippage for each R/T trade to cover trading frictions.

The first step in their process was to identify the in-sample and out-of-sample periods. Here is how they explained it:

We will choose as in-sample 1/1/2001 to 12/31/2009 for system design and in-sample optimization and 1/1/2010 to 12/31/2012 as out-of-sample period to evaluate the in-sample optimization robustness and execute the walk forward. We will then use a 3:1 ratio for the WFO (walk forward optimization):

  • Optimize 2007 to 2009 and verify performance out-of-sample in 2010
  • Optimize 2008 to 2010 and verify performance out-of-sample in 2011
  • Optimize 2009 to 2011 and verify performance out-of-sample in 2012

The next step is to define the parameters that they are looking to optimize. Here are the three that they listed:

  • Lookback period of the fast average
  • Lookback period of the slow average
  • Volatility filter

So far, this has been a pretty simple process, and VBO Systems does a great job of keeping their explanations simple. In order to define the robust area for each of these parameters, the article uses a 3D chart to identify the moving average lookback periods that perform reasonably well over the course of the in-sample data. The same process is applied on a standard chart to get the volatility filter parameters.

The final step is to perform the walk forward using the identified data parameters on the defined data periods. Basically, they just see which moving averages and volatility filter would have worked best on each of the in-sample data periods, and then test those parameters on the out-of-sample data periods to see if the returns are in-line with expectations.

The result of this case study is that each of the walk forward optimization periods produce similar returns to the overall system returns for the entire in-sample data set. This gives reassurances that the strategy has a certain level of robustness.

Filed Under: Test your concepts historically Tagged With: backtesting, robust systems, walk forward optimization

A Short-Term Bollinger Band Breakout Strategy Idea For AAPL

November 27, 2013 by Andrew Selby Leave a Comment

In addition to the popular futures and forex markets, many quantitative traders like to test and trade their strategies on liquid and active individual stocks.

AAPL is one of the most active stocks in the world, both in terms of volume traded and news coverage. It is also been on an incredible bull run over the past ten years. Any stock that has been as popular and newsworthy as AAPL has is bound to have some strategies custom designed for it.

Paststat.com devotes an entire section of their website to different quantitative ideas that traders are encouraged to take and develop for potential strategies. One of their recent articles featured an idea for a short-term breakout system designed specifically for trading AAPL.

The basic concept of the strategy is that it takes a long position in AAPL any time the stock breaks out and closes above its upper Bollinger Band. The strategy then holds the stock for between 1 and 5 days before selling. The strategy is based on a daily chart with Bollinger Band settings of 20 period moving average and 2 standard deviations.

bollinger band breakout

This simple Bollinger Band breakout strategy designed for AAPL has an 82% win rate and 1.48 profit ratio over the past few years.

The article describes the chart it contains very simply:

the trading odds for the $AAPL longs over the next 1/2/3/4/5 trading days period when ever $AAPL close crosses above the upper bollinger band 

The article backtests this strategy from the breakout in December 2009 through November 2013. Considering the simplicity of the strategy, the results are actually quite impressive.

Using a hold period of one day, the strategy produces 22 winners out of 28 trades. The average profit on a winning trade is 1.04% and the average loss on a losing trade is 0.57%.

When the hold period is increased to five days, the strategy increased to 23 wins. The average profit on those winning trades was 2.69% and the average loss on a losing trade was 1.82%.

The article goes on to post the results of each of the trades that were logged for the five-day holding period approach over the course of the backtesting period. This really emphasizes the high number of winning trades and the fact that the winning trades are bigger than the losing trades.

While this is certainly a small sample size, the initial backtesting results indicate that it may be worth investing some further time to develop this into an actual strategy. It is possible that the returns could be improved on by implementing a trend filter or some other confirmation indicator.

It would be very interesting to see further testing of trading this strategy on AAPL. It would also be interesting to test it on other individual stocks, and to attempt to further refine it.

 

Filed Under: Test your concepts historically, Trading strategy ideas Tagged With: aapl, backtesting, bollinger band, bollinger band breakout

  • 1
  • 2
  • Next Page »
FREE trading strategies by email

Trending

Sorry. No data so far.

Archives

  • Dominari
  • How does the forex market work?
  • Indicators
  • MetaTrader Tips
  • MQL (for nerds)
  • NinjaTrader Tips
  • Pilum
  • QB Pro
  • Stop losing money
  • Test your concepts historically
  • Trading strategy ideas
  • Uncategorized
  • What's happening in the current markets?

Translation


Free Trading Strategies

Privacy PolicyRisk Disclosure

Copyright © 2022 OneStepRemoved.com, Inc. All Rights Reserved.