Algorithmic and Mechanical Forex Strategies | OneStepRemoved

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

The Risks Of A Martingale Forex Strategy

July 3, 2014 by Eddie Flower 12 Comments

A Martingale forex strategy offers a risky way for traders to bet that that long-term statistics will revert to their means. Forex traders use Martingale cost-averaging strategies to average-down in losing trades. These strategies are risky and long-run benefits are non-existant.

Here’s why Martingale strategies are attractive to forex traders:

First, under ideal conditions and including positive carry, Martingale strategies offer what appears to be a predictable profit outcome and a “sure bet” on eventual wins.

Second, Martingale forex strategies don’t rely on any predictive ability. The gains from these strategies are based on mathematical probabilities over time, instead of relying on skillful forex traders using their own underlying knowledge and experience in particular markets. Novice traders like Martingale strategies because they can work even when the trader’s “trade-picking” skills are no better than pure chance.

Third, currency pairs tend to trade in ranges over fairly long periods of time, so the same price levels are often revisited many times. As with “grid trading,” there are usually multiple entry and exit possibilities in the trading range.

It’s important to understand from the beginning that a Martingale forex strategy doesn’t improve the chances of winning a given trade, and its major benefit is that it delays losses. The hope is that losing trades can be held until they become profitable again.

Martingale strategies are based on cost-averaging. The strategy means doubling the trade size after every loser until a single winning trade occurs. At that point, because of the mathematical power of doubling, the trader hopes to exit the position with a profit.

Risky Martingale strategy

And by “doubling” the exposure on losing trades, the average entry price is lowered across all entry points.

A simple example of win-lose

The below table shows how a Martingale strategy works with a simple trading game, in which each round has a 50% chance of winning and a 50% chance of losing.

Stake          Outcome          Profit/Loss          Current Balance

$100            Won                        $100                         $100
$100            Won                        $100                         $200
$100            Lost                       -$100                         $100
$200            Lost                       -$200                        -$100
$400            Lost                       -$400                        -$500
$800            Won                        $800                         $300

In this simple example, the forex trader takes a position size worth a standard $100 in account equity. With each winning trade in that same currency pair, the subsequent position size is kept at the same $100.

If the trade is a loser, the trade size is doubled for each successive loser. This is referred to as “doubling down.” If the forex trader is lucky, within a few trades he or she will enjoy a winner.

When the Martingale forex strategy wins, it wins enough to recover all previous losses including the original trade amount, plus additional gains.

In fact, a winning trade always results in a net profit. This occurs because:

2n = ∑ 2n-1 +1

Where n is the number of trades. So, the drawdown from any number of consecutive losses is recovered by the next successful trade, assuming the trader is capitalized well enough to continue doubling each trade until achieving a winner.

The main risk of Martingale strategies is the possibility that the trading account may run out of money through drawdown before a winning trade occurs.

A basic Martingale forex trading system

In real forex trading, there usually isn’t a rigid binary outcome – A trade can close with a variable amount of profit or loss. Still, the Martingale strategy remains the same. The trader simply defines a certain number of pips as the profit target, and a certain number of pips as the stop-loss threshold.

In the following recent EUR/USD example showing averaging-down in a falling market, with both profit target and stop loss levels set at 20 pips.

Rate          Order      Lots           Entry           Average Entry           Absolute drop           Break Even           Balance

1.3500      Buy          1                 1.3500        1.3500                          0.0                                 0.00                        $0
1.3480      Buy          2                 1.3480       1.3490                        -20.0                              10.00                       -$2
1.3460      Buy          4                 1.3460        1.3475                        -40.0                              15.00                      -$6
1.3440      Buy          8                 1.3440        1.3458                        -60.0                             17.50                      -$14
1.3420      Buy         16                1.3420        1.3439                         -80.0                             18.75                     -$30
1.3439      Sell         16                1.3439        1.3439                         -61.2                               0.00                        $0

First, the trader buys 1 lot at a price of 1.3500. The price then moves against the trader, down to 1.3480 which triggers the stop loss.

The trading system accounts 1.3480 as a “theoretical” stop loss, yet it doesn’t liquidate the position. Instead, the system opens a new trade for twice the size of the existing position.

So, the second line of the table above shows one more lot added to the position. This allows an average entry price of 1.3490 for the two lots.

It’s important to note that the unrealized loss is the same, yet now the trader needs a retracement of only 10 pips in order to break even, not the 20 pips envisioned by a loss following the first trade.

“Averaging down” by doubling the trade size reduces the relative amount needed to recover the unrealized losses. By averaging down with even more trades, the break-even value approaches a constant level which comes ever closer to the designated stop-loss level.

Continuing the above example, at the fifth trade the average entry price is 1.3439 so when the price moves upward through that point, the overall averaged holdings reach the break-even level.

In this example, the first four trades were losses, but all were covered by the profit on the fifth trade. A mechanical forex trading system can close out this group of trades at or above the break-even level. Or, the system can hold the currency pair for greater gains.

When a Martingale strategy works successfully, the trader can recover all losses with a single winner. Still, there is always a major risk that the trader may suffer an unrecoverable drawdown while awaiting a winner.

Caveats about the Martingale forex strategy

From a mathematical and theoretical viewpoint, a Martingale forex trading strategy should work, because no long-term sequence of trades will ever lose.

Still, in the real world the perfect Martingale strategy would require unlimited capitalization, since the trader may face a very long string of losses before achieving a single winner. Few traders could withstand the required drawdown.

If there are too many consecutive losing trades, the trade sequence must be closed at a loss before starting the cycle again. Only by keeping the initial position size very small in proportion to the account equity could the trader have any chance for survival.

Ironically, the higher the total drawdown limit, the lower the probability of losing in a trade sequence, yet the bigger that loss will be if or when it occurs. This phenomenon is called a “Taleb distribution.” The more trades, the more likely that a long string of losses will arise.

This issue occurs because during a sequence of losing trades with a Martingale system the risk exposure increases exponentially. In a sequence of n losing trades, the trader’s exposure increases as 2n-1.

So, if the trader is forced to exit a trade sequence prematurely, the losses are very large. On the other hand, the profit from a Martingale forex trade only increases in a linear way. It is proportional to half of the average profit per trade, multiplied by the number of trades.

Regardless of the underlying trading rules used to choose currency pairs and entry points, if the trader is only right 50% of the time (the same as random chance) then the total expected gains from winning trades would be:

Profit ≈ (½ n) x G

When n is the total number of trades and G is the amount of profit on each trade.

However, a single big losing trade will reset this amount to zero. Continuing the example above, if the trader sets a limit of 10 double-down trades, the biggest trade lot size would be 1024. The maximum amount would only be lost if there were 11 losing trades in a row.

According to the above equation, the probability of this occurrence is (½)11. In other words, the trader would expect to lose the maximum amount once every 2048 trades.

After 2048 forex trades:

• Expected gains are (½) x 211 x 1 = 1024

• Expected worst single loss is -1024

• Expected net profit is 0

Assuming the trader’s trade-choosing strategy is no better than simple chance, the Martingale system always offers at least a 50-50 chance of success.

Again, Martingale doesn’t improve the chances of winning a trade, it simply postpones losses or helps the trader potentially avoid losses by staying in the positions long enough. It is risky, and very few traders have been successful with Martingale strategies in the long run.

Martingale forex strategies only work when currency prices are trading in a range

Some trend-following traders use a “reverse Martingale” strategy that involves doubling winning trades, and cutting losses quickly. However, Martingale strategies tend to suffer during trending markets. The only opportunities come from range-trading instead of trend-following.

The challenge is to choose currency pairs with positive carry which are range-bound instead of trending. And, the trading system should be programmed to unwind positions when steep corrections occur.

Martingale forex strategy can enhance yield

One occasional use of Martingale forex strategies is to enhance yield. Some traders use Martingale strategies with positive-carry forex trades of currency pairs with large interest-rate differentials. That way, positive credits accumulate during the open trades.

By limiting drawdown to 5% of the account equity, some traders achieve 0.5 to 0.7% monthly return by using Martingale strategies when EUR/CHF and EUR/GBP are trading in tight ranges over fairly long periods of time.

The trader must keep a watchful eye for the risks that can result when forex prices break out into new trends, especially around support and resistance levels. Again, Martingale only works with range-bound currency pairs, not trending ones.

How to calculate the drawdown limit for a Martingale forex strategy

For traders willing to risk a Martingale forex strategy, the first thing to decide is the position size and risk. To keep this example simple, let’s use powers of 2.

The number of lots traded will determine the number of double-down trade legs that can be placed. For example, if the maximum is 256 lots, this allows 8 double-down legs.

Maximum lots that can be traded = 2number of legs

If the final trade in a sequence is closed when its stop-loss point is reached, then the maximum drawdown will be:

Drawdown < Maximum number of lots x (2 x stop-loss) x lot size

So, with 256 micro lots, and a stop-loss set at 40 pips, the maximum drawdown would be $2048.

To determine the average number of trades that the system can sustain before a loss, use the calculation:

2number of legs + 1

In the current example, that number is 29, or a total of 512 trades. After those 512,  the trader would expect to suffer 9 consecutive losing trades.

With a Martingale forex strategy the only survivable way to manage drawdowns is to use a “ratchet” system: As profits are earned, the size of the trading lots and drawdown limits are both increased incrementally.

Trade sequence      Equity realized      Drawdown allowed      Profit

1                                          $1,000                            $1,000                                      $25
2                                          $1,025                            $1,025                                       $5
3                                          $1,030                            $1,030                                     -$10
4                                          $1,020                            $1,020                                       $5
5                                          $1,025                             $1,025                                      $20

This ratcheting adjustment should be handled automatically by the mechanical trading system, once the trader sets the drawdown limit as a percentage of the equity realized.

Entry

For entry signals in a Martingale forex strategy, traders sometimes “fade” or trade the false break-outs from the range. For example, when the currency pair’s price moves a certain number of pips above the 15-day moving average (MA), the system places a sell order.

When using this method, it’s important to act only on signals that indicate a high probability that the price will retrace back into the original range instead of breaking out.

Profit targets and stop-losses

It’s also important to set the profit targets and stop-loss points appropriately. On the one hand, if the values used are too small the system will open too many trades. On the other hand, if the values are too large then the system may not be able to sustain enough successive losses to survive.

With Martingale strategies, only the last stop-loss point is actually traded. All the previous stop-loss levels are “theoretical” points since the trades aren’t actually liquidated there, and in fact a new trade with double position size is added at each of those points.

Martingale trades must be consistently treated as a set, not individually. Forex trades using a Martingale strategy should only be closed out when the overall sequence of trades is profitable, that is, when there is a net profit on the open trades.

The Martingale trader hopes that a winning trade will be achieved before the drawdown from successive doubled losses drains the trading account.

The choice of profit targets and stop-loss points also depends on the trading time frame and the market’s volatility. In general, lower volatility means the system can use a small stop-loss value.

Some traders set a profit target of somewhere between 10 to 50 pips and a stop-loss value between 20 to 70 pips. There are several reasons for this.

A small profit target has a greater probability of being achieved sooner, so the trade can be closed while profitable. And, since the profits are compounded due to the exponential increase in position size, a small profit-target value may still be effective.

Using a small profit target doesn’t change the risk-reward ratio. Even though gains are small, the nearer threshold for gaining improves the overall ratio of winning to losing trades.

The benefits and disadvantages of a Martingale forex strategy

A Martingale forex trading strategy offers very limited benefits, such as trading rules that are easy to define and program into an Expert Advisor or other mechanical trading system. And, the outcomes regarding profits and drawdowns appear statistically predictable. As well, Martingale strategies don’t rely on a trader’s ability to predict market direction or choose winning trades.

However, Martingale forex strategies are invariably losers in the long run. They simply postpone or avoid losses instead of creating standalone profits.

And, unless the losses are managed carefully by adjusting the position sizes and drawdown limits when profits are earned, a Martingale strategy may run out of money during a particularly harsh drawdown. This can happen because exposure to risk increases exponentially, yet the profits only increase in a linearly.

In summary, Martingale forex strategies may be helpful when used during limited periods in trading ranges by experienced traders who focus on positive-carry currency pairs. Yet, the risks are overwhelmingly negative.

Have you ever tried a Martingale “double down” strategy in your own forex trading?

Filed Under: How does the forex market work?, Stop losing money, Trading strategy ideas, Uncategorized Tagged With: forex strategy, Martingale, mechanical trading

Mathematical Expectation in Multicurrency Forex Trading

June 9, 2014 by Eddie Flower Leave a Comment

Some forex traders use the same trading strategy for all currencies, while others use entirely different strategies depending on the currency pairs being traded. Or, traders may use multiple strategies with multiple forex pairs, in order to perhaps increase profits while reducing the risk of drawdown resulting from over-concentration on a single strategy.

Expert advisors (EA) make it possible to optimize the input parameters, yet they don’t necessarily make it easier to put separate strategies together into a single system. And, testing may show increased risk from overlapping or correlated drawdowns when disparate forex strategies are merged together.

Using algorithms, a trading system can check currency pairs and perform specific operations according to input parameters. A multicurrency, multi-system EA can be crafted in order to assess all trading strategies side-by-side. This may be helpful in case only a single EA is permitted to access a given account.

It can be challenging to develop a forex trading system that works well across different currency pairs under a variety of conditions. Most of the widely-known systems for multicurrency trading are based on trend-following strategies, such as Donchian-channel breakouts, and are designed to profit from very long-term trends. Yet, a multicurrency strategy must show clearly show a winning “edge” over the typical time horizons for forex traders.

Mathematical expectation forex strategy

For example, in order for a system to work well with both EUR/USD and USD/JPY the signals must have a high likelihood of success in spite of volatility and potential correlation between the two pairs. And, trades must become winners during fairly short time periods. If not, then trading correlated pairs may create a risk of over-concentration and excessive drawdown.

There are many profitable opportunities in trading the four major currency pairs — EUR/USD, GBP/USD, USD/JPY and USD/CHF. I’ve been enjoying good success by using a strategy based on Mathematical Expectation (ME). I use ME to analyze data and spot comprehensive trading opportunities and calculate entry/exit points for trading the four major currency pairs.

Mathematical expectation predicts the likelihood that a forex trade will win

A well-programmed EA can use ME tools to help build systems that work across multiple currency pairs. I’ve helped developed a couple of systems that work in real-time and show long-term profitability through back-testing.

Recently, traders have become more aware of the drawbacks that arise when using data-mining techniques to back-test and fine-tune strategies for forex trading systems. Alternative system-development methods like System Parameter Permutation (SPP) are now available and can help traders avoid the issue of data-mining bias.

If done carefully, SPP or data mining will help build a set of good-quality indicators to generate signals across the four major currency pairs. Then, the expert advisor calculates Mathematical Expectation to see whether the trade is likely to be profitable or not.

Finally, it’s a matter of specifying filters and testing to find precise strategies that consistently result in winning, profitable signals. Entry and exit points are calculated by the mechanical trading system using mathematical expectation adjusted for current volatility.

Calculating the mathematical expectation of success

Mathematical Expectation (ME) is a statistic that measures the greatest temporary profit that a trade experienced the entire time it remained open. It was first popularized under the Optimal-F position-sizing and money-management rules developed by Ralph Vince. The equation is:

Mathematical Expectation = MFE – MAE

The mathematical expectation tool gives multicurrency forex traders a predictive “edge” in developing winning systems. ME is defined according to the concepts of Maximum Favorable Excursion (MFE) and Maximum Adverse Excursion (MAE). ME’s value can be calculated in real time by the mechanical trading system.

Maximum Favorable Excursion is the greatest balance on a favorable trade before a forex trade is closed out, regardless of final closing price during the time period, whether daily, hourly or minutely. MFE is the highest positive balance achieved while the trade was open.

Maximum Adverse Excursion is the largest unrealized or temporary loss during a trade, regardless of whether the trade was closed out as a loser or not. MAE is the lowest negative balance on the trade while it was open.

In order to quantify and analyze the ME from a given forex pair, traders can simply calculate average MFE and average MAE for a large number of past trades. Mathematical Expectation equals Maximum Favorable Excursion minus Maximum Adverse Excursion.

If average MFE is larger than average MAE, then the Mathematical Expectation is positive. The larger the ratio between MFE and MAE for a given currency pair, the more favorable is the outlook for a potential trade.

Multicurrency forex trading strategies based on Mathematical Expectation

When trading EUR/USD, GBP/USD, USD/JPY and USD/CHF with a multicurrency strategy based on the Mathematical Expectation, this metric is usually positive and generally high, and similar among the various currency pairs.

It’s important to avoid evaluating position size, or trade-exit rules or any other parameters while the expert advisor analyzes the entry points. Those parameters can be set independently by the mechanical trading system based on ME adjusted for volatility, as discussed later in this article.

After determining the entry point and trade direction, the mechanical trading system calculates MFE and MAE values generally first at 10 bars beyond the entry price, then 15 bars beyond, then 20 bars beyond the entry price.

In addition to signaling entry points, the ME also shows whether the forex trade’s advantage is best immediately after opening the position, or at some average interval after being in the position.

My simplest multicurrency trading strategy uses daily charts and relies on a combination of three price-based rules, and only a few parameters that use mathematical expectation to predict success.

The rules for long and short trades are as follows:

Trade long (and close out a short trade) when:

Close > Previous Close
Open > Previous Low
Previous Close > Prior Close

Trade short (and close out a long trade) when:

Close < Previous Close
Open < Previous High
Previous Close < Prior Close

This system reverses the trade when the signal changes. So, if the system has a “long” position open when a “short” signal is received, the system will close the long position and instead go short. Likewise, if the system has an open “short” position when a “long” level is received, it will close the short and immediately go long.

Another parameter of this system is the stop-loss trigger which is set at a value just slightly more than the fifteen-day or twenty-day average true range (ATR). This value is updated each time a new signal is received in the same direction.

Nevertheless, if there are new signals in the same direction, my system does not add new positions, since I’ve found that drawdowns outweigh additional profits when doing so.

Finally, regarding position size the system allocates a maximum 2% of account equity to a single high-ME trade. If there are multiple signals in several currency pairs, yet the ME calculations are showing correlation among the signals, the total position sizes will be no more than 2% of equity.

Trading results

This simple multicurrency forex trading system has shown decent results in real trading, and back-testing over a twenty-year period shows that it would have enjoyed profitable results for at least sixteen out of the twenty years tested. It has shown a reward-to-risk ratio of about 1.7 and winner percentage around 45%, while the profit factor was nearly 1.4.

Still, the drawdowns can be lengthy – The longest drawdown seen under back-testing was more than 1000 days. The ratio of profit-to-drawdown when using this strategy is similar to that of buying-and-holding stocks, and during back-testing the ratio was about 0.35 with a total return of more than 500% during a twenty-year back-test.

Risk management for multicurrency trading strategies using ME

By knowing the average MFE and MAE values, a forex trader can program a multicurrency mechanical system to exit a trade at a profit target or stop-loss point determined by adding a calculated number of pips beyond the Maximum Favorable Excursion or Maximum Adverse Excursion values.

On average, in order to win over time the forex trading system must reach the profit goal more often than it touches the stop-loss exit level.

For example, if my system is seeing an average MAE of 35 pips and an average MFE of 55 pips, there is a tradable opportunity. The profit target may be projected for 50 pips, which is 5 pips less than MFE, and the stop-loss exit can be set at 30 pips, which is 5 pips beyond the MAE.

Regarding system design, it’s important to program the trading system to define profit targets and stop-loss points according to volatility instead of setting a fixed number of pips.

Volatility helps determine exit points for multicurrency trading

As mentioned earlier, a mechanical trading system can easily use Average True Range (ATR) as a volatility-dependent tool to calculate MAE and MFE in order to set exit points. The system determines the entry price plus or minus a percentage of the ATR that is workable according to the ME analysis. To have a large enough sample, I usually set the ATR to calculate the previous 15 or 20 time frames.

For example, during a market when the EUR/USD is moving an average of about 100 pips per day, the system should calculate target profit points and stop-loss points based on current volatility and the analysis of ME.

So, if a trade moves in a favorable direction for 55 pips, and if the current ATR is 85 pips, the move is not reported as 55 pips; instead, the MFE is reported as 64.7% of ATR.

Over time, I’ve seen that the MFE for the four major currency pairs EUR/USD, GBP/USD, USD/JPY and USD/CHF seem to fluctuate around an MFE value of about 60% of ATR, and average MAE around 40% of ATR for the typical entry after 15 time periods.

In order to fine-tune forex trading results according to volatility, the mechanical trading system can set the profit targets and stop-loss points at varying levels. For example, the system may set the profit target exit point at 55% of the ATR value away from the entry point, not at the MFE full value of 60%.

And, volatility may require setting the stop-loss exit points at 45% of ATR value beyond the entry point, not at 40% of ATR. Still, this system is likely to reach target profit levels more often than stop-loss levels, and winners should be larger as long as target profits are set larger than stop-losses.

For all trades, the calculated number of pips for target profits and stop-losses is always based on volatility just at the moment of the trade, as reflected by the ATR.

When a signal arises, the trading system checks the value of current ATR, then calculates the exact number of pips to reach target profit and stop-loss levels.

As an example, assume there is a signal to go long in EUR/USD,and the current ATR is at 100 pips. So, the target profit point will be at 55 pips over the entry price (55% of the ATR value). And, the stop-loss will be at 45 pips under the entry price (45% of the ATR).

A few more thoughts about Mathematical Expectation

The mathematical expectation is generally lower for “short” trades, and some traders have seen ME increase by as much as eighteen bars after the open, then decay during price swings by as much as eighty bars after open.

For “long” trades, the ME generally has a longer lifespan, with values that may increase quickly up to the thirtieth time period, and then continue slowly onward up to about 75 time periods. Using this system, my average trade duration is about 25 days.

The best upside when trading EUR/USD, GBP/USD, USD/JPY and USD/CHF seems to accrue by about 30 time periods. If the favorable movement continues onward past that average point, then it’s likely that some sort of fundamental bias in the market is prolonging the move.

In summary, this basic multicurrency forex trading strategy takes advantage of a positive, high ME shared across the four major currency pairs. The entries, profit targets and stop-loss points are all based on ME.

When the Mathematical Expectation indicators are predicting success, the four major currency pairs — EUR/USD, GBP/USD, USD/JPY and USD/CHF – can be successfully traded either together or separately.

Have you tried ME in your trading?

Filed Under: How does the forex market work?, Stop losing money, Trading strategy ideas, Uncategorized Tagged With: forex trading, MAE, Mathematical Expectation, maximum adverse excursion, maximum favorable excursion, ME, mechanical trading, MFE

Fractals in Forex Trading

May 6, 2014 by Eddie Flower 2 Comments

Fractals indicate natural resistance and support levels, which helps to identify good entry points and locate stop-loss points. Most importantly, fractals help me identify trends and ranges.

Fractals can be used effectively in forex trading, especially with the power of a mechanical trading system. Focusing on the EUR/USD and GBP/USD currency pairs gives the best results.

A fractal is a repetitive natural pattern

A fractal is a geometric shape or set of self-similar mathematical patterns found in nature. When broken into smaller pieces, fractal shapes exhibit the same shape or characteristics of the larger object.

In nature, fractal shapes and patterns may be observed in things such as broccoli and many other types of plants, where the smallest florets still have the same overall shape as the largest “head” of broccoli. Likewise, many mineral and crystal forms exhibit similar patterns on both large and small scales.

Price movements in marketplaces are often thought to be random and chaotic. Yet, as with other seemingly-random forms found in nature, fractal patterns can be observed in price charts of forex pairs and other assets. Forex price movements show certain repetitive fractal patterns which can be profitably traded.

Fractals used in forex trading may show the same form at every size scale, or they may show nearly the same form at different scales. Stated simply, in forex trading a fractal is a detailed, self-similar pattern that repeats itself, often many times over.

It’s important to note that these fractal patterns aren’t the regular, geometrically-square figures found in man-made structures; they don’t have sides with even-integer factors. The distinguishing characteristic of fractals in forex trading and elsewhere is their natural organic scaling when contrasted with ordinary geometric figures.

For example, doubling the length of one side of an ordinary geometric square will scale the area of that figure by four, since the square has 2 sides, and 22 equals four. Or, when a geometric sphere’s radius is doubled, the volume scales to eight, because the sphere has three dimensions, and 23 = 8.

In contrast, when the one-dimensional lengths of a fractal are doubled, the space contained within that fractal scales up by a number that is not a whole integer.

Leaving aside the mathematical and technical description of fractals — In essence, I use them in forex trading so that my mechanical trading system can break down larger “cluttered” price movements into very simple and highly predictable views of trends and reversals.

Once these trends are visible, it’s easy for my automated trading system to take advantage of them. In particular, I’ve found that fractal signals based on smoothed moving averages (SMMAs) are very valuable for trading when I use them together with momentum indicators.

How do fractals help with forex trading?

Fractals predict reversals in current trends. When viewed as a set of price bars on a chart, the most basic fractal pattern contains five bars or candlesticks with these characteristics:

1. When the lowest bar is positioned at the middle of a pattern, and two bars that have successively higher lows are located on each side of it, this signals the change from a downward trend to an upward trend;

2. When the highest bar is positioned at the middle of a pattern, and two bars that have successively lower highs are located on each side of it, this signals the change from an upward trend to a downward trend;

Bullish and bearish fractals

Stated differently, when the forex fractal pattern shows the highest high at the center, and there are 2 lower highs positioned at each side, it signals a bearish turning point. And, when the pattern has the lowest low at the center, and there are 2 higher lows positioned at each side, it signals a bullish turning point.

Fractals are lagging indicators, so a mechanical trading system can’t act on them until they’re a couple of bars into the reversal. Still, since most of the significant reversals last for multiple bars, the trend usually continues long enough for me to trade it.

Fractals work best for forex trading when used together with a momentum indicator. Along with fractal indicators, I also use an oscillator such as the CCI indicator to facilitate entering a forex trading position as early and safely as I can.

Fractal Alligator indicators

My favorite fractal tool is the “Alligator indicator,” which is a moving-average tool that relies on fractal geometry and SMMAs. This indicator with a fancy name was introduced by senior trader Bill Williams around 1995, and it’s commonly available in MetaTrader software.

If you’re using MetaTrader, you should be able to easily add this fractal indicator by clicking on the menu tabs “Insert,” then “Indicators,” “Bill Williams,” and “Fractals.”

Alligator indicator lines confirm the direction and presence of a trend. Specifically, the Alligator indicator consists of 3 smoothed moving averages. Overlaid on pricing charts, these balance lines represent the metaphorical “jaw,” “teeth” and “lips” of the Alligator.

Carrying the metaphor further, it can be said that when the 3 balance lines are intertwined or converged, the Alligator is asleep with its mouth is closed. This indicates that particular forex market is trading in a sideways range.

Once a trend forms, the Alligator awakens and it begins to “eat.” The Alligator isn’t a picky eater; it can feast on either a bull or a bear. Once satisfied, the Alligator’s mouth closes and the creature returns to sleep.

The Alligator fractal indicator shows trends in the following way: When the price is trading above the mouth of the Alligator, i.e. the green balance line is over the red line which is over the blue line, and all three are aligned and pointing upward, yet still below the price line, this indicator signals a clear uptrend.

Conversely, when the price moves below the Alligator’s mouth, and the blue line is over the red line which is over the green one, and all three of the balance lines are above the price line, then the indicator signals a downtrend.

Finally, once the fractal forex trading Alligator has sated itself, the green, red and blue balance lines once again converge and cross over, signaling the end of the trend. At that point, my mechanical trading system takes profits, and then begins to watch for the next fractal forex trading opportunity.

In short, my mechanical trading system filters fractal signals by stating that the buy rules are confirmed only if they signal a value below the “alligator’s teeth” in the pattern, which means the center average.

Likewise, my sell rules are only confirmed if they signal above the alligator’s teeth. As well, I double-confirm the validity of Alligator signals by using the CCI oscillator.

Fractal forex GBPUSD

The fractal Alligator formula

The Alligator’s jaw, often depicted as a blue line, shows a Smoothed Moving Average containing 13 periods; this line is then moved 8 bars into the future;

The teeth, depicted with a red line, shows a Smoothed Moving Average containing 8 periods, moved 5 bars into the future;

The lips, depicted as a green line, shows a Smoothed Moving Average containing 5 periods, moved 3 bars into the future.

To reiterate, when the red and green balance lines cross over the blue line, it signals my mechanical trading system to “sell.” Conversely, when the red and green lines cross under the blue line, it signals a “buy.”

For purposes of programming a mechanical trading system for fractal forex trading:

  • n is the number of periods
  • High(n) is the highest price during period n
  • Low(n) is the lowest price during period n
  • SMMA(ABC) is a Smoothed Moving Average in which A is the data being smoothed, B is the period being smoothed, and C is the shift in time-period

The mechanical trading system calculates the balance lines:

  • [Low(n) + High(n)] / 2
  • SMMA (Median price n, 13, 8) = Alligator jaw (the blue line)
  • SMM (Median price n, 8, 5) = Alligator teeth (the red line)
  • SMM (Median price n, 5, 3) = Alligator lips (the green line)

Forex markets show many false trends. That is, often a “trend” may appear to begin, yet the price action soon settles back into a sideways range.

When using fractals, my strategy correctly identifies real trends and then follows them. Fractal forex tools such as the Alligator help my mechanical trading system reach through price clutter and focus on finding and trading the real trends.

My fractal trading method based on Alligator indicators

Here’s the simplest form of my fractal trading system based on Alligator indicators:

• Determine the entry point according to when the Alligator balance lines are intertwined, i.e. the Alligator is “sleeping” and when the CCI oscillator is indicating an overbought price condition;

• Execute new orders with 2% of the account equity;

• Places a stop-loss order at exactly 20 pips below the entry point;

• Sets an exit order to be triggered when more than two of the Alligator balance lines cross the candlesticks and/or when the CCI oscillator indicates an overbought condition.

Other ways to use fractals

Fractals are an easy way to see or confirm trends on any time frame. I program my mechanical trading system to check and see whether the fractals are showing lower lows and lower highs, or higher highs and higher lows. For my typical forex trading, I use fractals based on one-day, one-week, and one-month time frames.

The longer the time frame used to generate the fractal, the greater the reliability of the signals it produces. Also, the longer the time frame, the fewer the signals.

Also, I program my mechanical trading system to calculate fractals in order to set trailing stops. Since fractals show changes in trends, they work well to trigger my mechanical trading system to exit from trades when very-short-term reversals threaten to eat up the profits from a trade.

Trading with fractals and Fibonaccis

Beyond using the fractal Alligator indicator, fractal tools offer a great way to confirm Fibonacci signals. I’ve found that fractal forex trading works well when used for Fibonacci retracement levels.

I program my mechanical trading system to draw Fibonacci bands and calculate the fractals using daily time frames in forex markets such as EUR/USD and GBP/USD.

Then, I open a position when the price touches the most-distant Fibonacci band, yet only after my mechanical trading system sees that a daily (D1) fractal signal has occurred. The mechanical trading system exits the trade when a D1 fractal reversal occurs.

When using Fibonacci tools, fractals help pinpoint tops and bottoms with great accuracy. This gives me the confidence to trade at the right Fibonacci level. It’s easy – My mechanical trading system simply looks for the daily fractal parameter.

General considerations when using fractals

In order to double-check the signals generated from fractal indicators, my mechanical trading system uses other indicators such as the CCI oscillator to confirm fractal signals before trading. And, as with any type of trading method, use appropriate risk management measures to ensure that drawdowns are reasonable.

Fractals can be plotted in multiple time frames and used to confirm each other. One simple rule  is to only trade short-term fractal signals in the direction of long-term fractal signals, since long-term fractals are the most reliable. Use another indicator for safety such as the CCI oscillator to confirm the signal.

The Alligator and other fractal tools help

Fractals offer a set of powerful tools that you can use to strengthen your profits. Since mechanical trading systems are able to calculate fractal values and act on them quickly, there are plenty of fractal-based trading opportunities.

My own personal favorite is the Alligator indicator, yet fractals also work well with Fibonacci indicators and other trading strategies. In fact, fractal tools enjoy a relatively small yet devoted following among successful traders.

There are plenty of articles about fractals, as well as trader discussions about the basis for fractal forex trading success if you’d like to explore the topic further.

How do you use fractals in your trading? Share your thoughts on fractals below.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: Alligator, Bill Williams, CCI, Fibonacci, forex trading, fractals, mechanical trading, SMMA

Forex Swing Trading With a 34-Day EMA Wins in a Trendless Market

April 29, 2014 by Eddie Flower 31 Comments

Forex swing trading is a mechanical trading method that harvests gains from forex pairs over periods of one to several days. Some forex swing trading strategies produce ho-hum results in trendless markets. Yet, I’ve found that a strategy based on 34-day exponential moving averages works well, even during range-bound sideways markets.

With the forex swing trading strategy described below, I use my mechanical trading system to take advantage of short term price trends and patterns that I might otherwise miss out on.

First, let me define the term “forex swing trading.” It means trading based on short-term price ‘swings.’ The price of the forex pair moves back and forth between “swing points,” which are the inflection points within an overall price range or channel.

The direction of the swing trade can be either long or short. Forex swing trading positions are usually held for a longer period than a day-trade, but for less time than buy-and-hold strategies which involve holding positions for weeks or months.

Forex swing trading offers an ideal mechanical trading strategy for independent traders like me, since my algo trading system can quickly recognize and exploit short-term price movements more effectively than large institutional traders can.

swing trading

The basics of forex swing trading

Although some traders apply swing trading to stocks, in my experience forex swing trading is the perfect form of swing trading.

And, forex swing trading is better than day trading or long-term trend trading. Here’s my reasoning: Although day trading can be good for risk management since the trader doesn’t hold positions overnight, it also limits the profit potential, since large price moves can occur overnight.

Trend trading may capture the profits of longer-term price moves, yet it also puts the trader in a position of facing worrisome drawdowns while awaiting the anticipated continuation of a trend.

Forex swing trading offers the best of both worlds: It has the advantages of trend trading and day trading, but without the drawbacks of either method. The twenty-four-hourly nature of currency markets is ideal for swing trading.

With my mechanical trading system, I enjoy a great compromise between the two extremes of day trading and trend trading. I find short-term trends in the forex markets, ride them to profitability, then I exit my position right when the price move ends.

My mechanical trading system harvests small but consistent gains which add up over time. Even in an apparently-trendless market, I can still be successful.

My trades are based on automatic data analysis in real time, and my trading algos provide super-fast trade executions. Best of all, my trading decisions are based on objective parameters instead of relying on my emotions about a particular market.

Forex swing trading rules

Knowing the best entry and exit points is the key to successful forex swing trading. Through the magic of a mechanical trading system which uses the best indicators and effective algorithms, I don’t need to have perfect timing.

Forex swing trading can be based on a simple set of rules, or you can program your mechanical trading system to use a somewhat more sophisticated set of rules, as I do.

In forex swing trading, my mechanical trading system uses a set of mathematical rules and indicators for buying and selling forex pairs. By relying on my mechanical trading system rather than manual trading, I enjoy several benefits.

Among the simplest approaches are those which measure the price of a forex pair by using 3 different moving averages based on closing prices.

The mechanical trading system is programmed to trade the forex pair “long” when those 3 moving averages become aligned in an upward direction. Likewise, the forex pair is traded “short” when the 3 moving averages are heading downward.

How my forex swing trading strategy works

I use a forex swing trading strategy that lets me take advantage of fairly short-term price moves, so I can profit even in an overall trendless market. I have a reliable and dependable short-term trendline-breakout strategy, and it can harvest quite a few pips from the typical winning trade.

The trick is to use the best length of time frame for the moving averages, as well as the right type of moving average. Rather than using a simple moving average (MA or SMA), I program my mechanical trading system to use an exponential moving average (EMA).

The EMA is similar to the ordinary MA, except that it gives more weight to the most-recent data. I do this because the EMA reacts more quickly to the latest price changes than the simple MA does.

This type of moving average lets me win in markets which would appear trendless over longer periods of time.

Some traders use either a 12-day or 26-day EMA, especially to create indicators such as the popular moving average convergence divergence (MACD) indicator, or a percentage price oscillator (PPO). And, in comparison, the 50-day and 200-day EMAs are often used to signal changes in long-term price trends.

Instead, for my forex swing trading I use the 34-day EMA (also called a 34ema) because I’ve found it offers the best way to determine short-to-mid-term trend direction in forex markets.

Of course, you can experiment by back-testing different time periods in your own chosen markets. Try 7-, 14-, 25-, or 50-day EMAs to see if they work better for your particular forex pair. Still, after my own lengthy research, for me a 34ema works best.

My “buy” rules for forex swing trading

Using my mechanical trading system, I enter the forex swing trade just after a break in the trendline. Based on the 34-day EMA, my mechanical trading system watches for a price rally or pullback. Then, as soon as that rally or pullback falters, my mechanical trading system executes the trade.

So, here are the steps I use. I program my mechanical trading system so it will:

1. Watch for a downward break from the trendline;
2. Confirm that the price moves above the 34-day EMA (34ema);
3. After the trendline breakout downward, watch the price highs of the subsequent candlesticks;
4. Wait to see the signal candlestick; that will be the candle with a high which is lower than the preceding candle’s high;
5. If that candle’s high is breached, my system immediately buys at market price;
6. Or, my system can execute a buy-stop order only a few pips over the high of the signal; candlestick; that way, if the price breaches its high, my order will be executed;
7. If my buy-stop order isn’t triggered, and if the candlesticks continue to set lower highs, my system moves the buy-stop order price to the successively-lower high on each candlestick that forms; eventually, the price will move upward and trigger my order.

For purposes of risk management during forex swing trading, my mechanical trading system automatically places a stop-loss order just a few pips below the low of that candle which triggered my order.

I ride the short-term swing, then harvest the gains and manage the risks as described later in this article.

My “sell” rules for forex swing trading

The “sell” rules for my forex swing trading system are exactly the opposite of the “buy” rules. Using the 34ema as the primary indicator, my mechanical trading system will:

1. Watch for an upward breakout from the trendline;
2. Confirm that the price is below the 34-day EMA (34ema);
3. After the breakout, monitor the price lows of the candlesticks;
4. The signal candlestick will be the one that has a low which is higher than the previous candle’s low; when that candle’s low is broken, my mechanical trading system immediately sells at market price;
5. Alternatively, my forex swing trading program can set a buy-stop order just a couple of pips below the low of the signal candle, so if the price breaches that low, my order is executed.

And, since good risk management is essential for survival in forex swing trading, my mechanical trading system sets a stop-loss order just over the high of the candlestick which triggered my entry order.

Setting profit targets and managing profits in forex swing trading

Forex swing trading works best for me when I’m not greedy. Some traders, especially those whose trading strategies are only profitable during large moves, try to squeeze too much out of every trade. By doing so, they often risk losing all the gains from that trade.

I have a different philosophy. Since markets are often trendless or trading sideways for long periods of time, I have plenty of trading opportunities. I’m not in a hurry to make a “killing” on each trade. I’d rather gain a small amount from many trades, since there is less risk for me that way.

When the trade goes in my direction and I’m in the profit zone, I lock in my profits by programming my mechanical trading system to use trailing stops that move along slightly behind the current price.

I use my mechanical trading system to set the trailing stops just a few pips below or above each of the successive dips and rises during forex swing trading. My forex algorithms choose the trailing stops based on the very-short-term support and resistance levels.

By setting trailing stops this way, I usually avoid being stopped out prematurely. If the short-term trend continues, I can often ride it for several days.

And, I always have plenty of trading opportunities, so I’m not feeling pressured to remain in a marginal trade which turn against me.

Advantages and risk management of forex swing trading

I use short-term trendlines and price action to great advantage. When a price breaks through its trendline, it’s usually a sign that the trend is changing. My mechanical trading system helps me enter a new trade at the beginning of the new trend.

My 34-day EMA forex swing trading strategy gives me plenty of advantages as long as I manage risks appropriately. This strategy lets me trade with the short-term trend while avoiding the major drawdowns that some traders experience by attempting to follow long-term trends.

My 34-day forex swing trading strategy offers a critical advantage over most forex swing trading strategies. Since moving averages are essentially lagging indicators, choosing the right time frame is the key to success.

Many forex strategies are based on simple moving averages or longer-term moving averages. So, they usually perform poorly in trendless markets. Yet, my 34-day EMA strategy uses a time period that’s more effective than longer MA periods.

In order to enjoy the advantages of my system, I must manage the risks appropriately. Overall, the risks of forex swing trading are comparable with any other type of speculative trading.

In markets which are completely trendless over the shortest time periods, it’s important for me to ensure that my stop losses are fairly tight. On the other hand, during bull or bear markets forex swing trading can be even more profitable.

Sometimes, the market will make a sudden sharp move in such a short period of time that the “swing points” won’t be detected by my mechanical trading system. Gap-up or gap-down breakouts can happen so quickly that my mechanical trading system isn’t able to respond effectively.

Still, by using the 34-day EMA, I’m usually able to participate in most market moves, while avoiding false signals in an overall trendless or sideways market.

34-day EMA is the best forex swing trading indicator for me

For me, using a 34-day EMA indicator is the best foundation for my forex swing trading. I’ve used it to develop and fine-tuned a winning strategy for my mechanical trading system. It offers me the “best of both worlds” and it even works in markets which may appear trendless to longer or shorter time periods of moving averages.

And, I’m not the only trader using a 34-day EMA strategy in the forex markets. During the past couple of years there’s been some research about forex swing trading using 34ema as an indicator, as well as plenty of articles and trader chatter about this type of strategy.

If you’re a serious forex trader, and you’re a bit frustrated by markets which seem trendless, I suggest that you try a 34ema strategy for your forex swing trading.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: 34ema, algorithm, forex swing trading, mechanical trading

Cointegration in Forex Pairs Trading

April 23, 2014 by Eddie Flower 21 Comments

Cointegration in forex pairs trading is a valuable tool. For me, cointegration is the foundation for an excellent market-neutral mechanical trading strategy that allows me to profit in any economic environment. Whether a market is in an uptrend, downtrend or simply moving sideways, forex pairs trading allows me to harvest gains year-round.

A forex pairs trading strategy that utilizes cointegration is classified as a form of convergence trading based on statistical arbitrage and reversion to mean. This type of strategy was first popularized by a quantitative trading team at Morgan Stanley in the 1980s using stock pairs, although I and other traders have found it also works very well for forex pairs trading, too.

Forex pairs trading based on cointegration

Forex pairs trading based on cointegration is essentially a reversion-to-mean strategy. Stated simply, when two or more forex pairs are cointegrated, it means the price spread between the separate forex pairs tends to revert to its mean value consistently over time.

It’s important to understand that cointegration is not correlation. Correlation is a short-term relationship regarding co-movements of prices. Correlation means that individual prices move together. Although correlation is relied upon by some traders, by itself it’s an untrustworthy tool.

On the other hand, cointegration is a longer-term relationship with co-movements of prices, in which the prices move together yet within certain ranges or spreads, as if tethered together. I’ve found cointegration to be a very useful tool in forex pairs trading.

During my forex pairs trading, when the spread widens to a threshold value calculated by my mechanical trading algorithms, I “short” the spread between the pairs’ prices. In other words, I’m betting the spread will revert back toward zero due to their cointegration.

Basic forex pairs trading strategies are very simple, especially when using mechanical trading systems: I choose two different currency pairs which tend to move similarly. I buy the under-performing currency pair and sell the out-performing pair. When the spread between the two pairs converges, I close my position for a profit.

Forex pairs trading based on cointegration is a fairly market-neutral strategy. As an example, if a currency pair plummets, then the trade will probably result in a loss on the long side and an offsetting gain on the short side. So, unless all currencies and underlying instruments suddenly lose value, the net trade should be near zero in a worst-case scenario.

By the same token, pairs trading in many markets is a self-funding trading strategy, since the proceeds from short sales can sometimes be used to open the long position. Even without this benefit, cointegration-fueled forex pairs trading still works very well.

Understanding cointegration for forex pairs trading

Cointegration is helpful for me in forex pairs trading because it lets me program my mechanical trading system based on both short-term deviations from equilibrium prices as well as long-term price expectations, by which I mean corrections and returning to equilibrium.

To understand how cointegration-driven forex pairs trading works, it’s important to first define cointegration then describe how it functions in mechanical trading systems.

As I’ve said above, cointegration refers to the equilibrium relationship between sets of time series, such as prices of separate forex pairs that by themselves aren’t in equilibrium. Stated in mathematical jargon, cointegration is a technique for measuring the relationship between non-stationary variables in a time series.

If any two or more time series each have a root value equal to 1, but their linear combination is stationary, then they are said to be cointegrated.

As a simple example, consider the prices of a stock-market index and its related futures contract: Although the prices of each of these two instruments may wander randomly over brief periods of time, ultimately they will return to equilibrium, and their deviations will be stationary.

Here’s another illustration, stated in terms of the classic “random walk” example: Let’s say there are two individual drunks walking homeward after a night of carousing. Let’s further assume these two drunks don’t know each other, so there’s no predictable relationship between their individual pathways. Therefore, there is no cointegration between their movements.

In contrast, consider the idea that an individual drunk is wandering homeward while accompanied by his dog on a leash. In this case, there is a definite connection between the pathways of these two poor creatures.

Although each of the two is still on an individual pathway over a short period of time, and even though either one of the pair may randomly lead or lag the other at any given point in time, still, they will always be found close together. The distance between them is fairly predictable, thus the pair are said to be cointegrated.

Returning now to technical terms, if there are two non-stationary time series, such as a hypothetical set of currency pairs AB and XY, that become stationary when the difference between them is calculated, these pairs are called an integrated first-order series – also call an I(1) series.

Even though neither of these series stays at a constant value, if there is a linear combination of AB and XY that is stationary (described as I(0)), then AB and XY are cointegrated.

The above simple example consists of only two time series of hypothetical forex pairs. Yet, the concept of cointegration also applies to multiple time series, using higher integration orders… Think in terms of a wandering drunk accompanied by several dogs, each on a different-length leash.

In real-world economics, it’s easy to find examples showing cointegration of pairs: Income and spending, or harshness of criminal laws and size of prison population. In forex pairs trading, my focus is on capitalizing on the quantitative and predictable relationship between cointegrated pairs of currencies.

For example, let’s assume that I’m watching those two cointegrated hypothetical currency pairs, AB and XY, and the cointegrated relationship between them is AB – XY = Z, where Z equals a stationary series with a mean of zero, that is I(0).

This would seem to suggest a simple trading strategy: When AB – XY > V, and V is my threshold trigger price, then the forex pairs trading system would sell AB and buy XY, since the expectation would be for AB to decrease in price and XY to increase. Or, when AB – XY < -V, I would expect to buy AB and sell XY.

Avoid spurious regression in forex pairs trading

Yet, it’s not as simple as the above example would suggest. In practice, a mechanical trading system for forex pairs trading needs to calculate cointegration instead of just relying on the R-squared value between AB and XY.

That’s because ordinary regression analysis falls short when dealing with non-stationary variables. It causes so-called spurious regression, which suggests relationships between variables even when there aren’t any.

Suppose, for example, that I regress 2 separate “random walk” time series against each other. When I test to see if there’s a linear relationship, very often I will find high values for R-squared as well as low p-values. Still, there’s no relationship between these 2 random walks.

Formulas and testing for cointegration in forex pairs trading

The simplest test for cointegration is the Engle-Granger test, which works like this:

  • Verify that ABt  and XYt are both I(1)
  • Calculate the cointegration relationship [XYt = aABt + et] by using the least-squares method
  • Verify that the cointegration residuals et are stationary by using a unit-root test like the Augmented Dickey-Fuller (ADF) test

A detailed Granger equation:

ΔABt = α1(XYt-1 − βABt-1) +ut and ΔXYt = α2(XYt-1 − βABt-1) + vt

When XYt-1 − βABt-1 ~ I(0) describes the cointegration relationship.

XYt-1 − βABt-1 describes the extent of the disequilibrium away from the long-run, while αi is both the speed and direction at which the currency pair’s time series corrects itself from the disequilibrium.

When using the Engle-Granger method in forex pairs trading, the beta values of the regression are used to calculate the trade sizes for the pairs.

When using the Engle-Granger method in forex pairs trading, the beta values of the regression are used to calculate the trade sizes for the pairs.

Error correction for cointegration in forex pairs trading:

When using cointegration for forex pairs trading, it’s also helpful to account for how cointegrated variables adjust and return to the long-run equilibrium. So, for example, here are the two sample forex pairs’ time series shown autoregressively:

ABt  = aABt-1 + bXYt-1 + ut  and XYt  = cABt-1 + dXYt-1 + vt

Forex pairs trading based on cointegration

When I use my mechanical trading system for forex pairs trading, the setup and execution are fairly simple. First, I find two currency pairs which seem like they may be cointegrated, such as EUR/USD and GBP/USD.

Then, I calculate the estimated spreads between the two pairs. Next, I check for stationarity using a unit-root test or another common method.

I make sure that my inbound data feed is working appropriately, and I let my mechanical trading algorithms create the trading signals. Assuming I’ve run adequate back-tests to confirm the parameters, I’m finally ready to use cointegration in my forex pairs trading.

I’ve found a MetaTrader indicator which offers an excellent starting point to build a cointegration forex pairs trading system. It looks like a Bollinger Band indicator, yet in fact the oscillator shows the price differential between the two different currency pairs.

When this oscillator moves toward either the high or low extreme, it indicates that the pairs are decoupling, which signals the trades.

Still, to be sure of success I rely on my well-built mechanical trading system to filter the signals with the Augmented Dickey-Fuller test before executing the appropriate trades.

Of course, anyone who wants to use cointegration for his or her forex pairs trading, yet lacks the requisite algo programming skills, can rely on an experienced programmer to create a winning expert advisor.

Through the magic of algorithmic trading, I program my mechanical trading system to define the price spreads based on data analysis. My algorithm monitors for price deviations, then automatically buys and sells currency pairs in order to harvest market inefficiencies.

Risks to be aware of when using cointegration with forex pairs trading

Forex pairs trading is not entirely risk-free. Above all, I keep in mind that forex pairs trading using cointegration is a mean-reversion strategy, which is based on the assumption that the mean values will be the same in the future as they were in the past.

Although the Augmented Dickey-Fuller test mentioned previously is helpful in validating the cointegrated relationships for forex pairs trading, it doesn’t mean that the spreads will continue to be cointegrated in the future.

I rely on strong risk management rules, which means that my mechanical trading system exits from unprofitable trades if or when the calculated reversion-to-mean is invalidated.

When the mean values change, it’s called drift. I try to detect drift as soon as possible. In other words, if the prices of previously-cointegrated forex pairs begin to move in a trend instead of reverting to the previously-calculated mean, it’s time for the algorithms of my mechanical trading system to recalculate the values.

When I use my mechanical trading system for forex pairs trading, I use the autoregressive formula mentioned earlier in this article in order to calculate a moving average to forecast the spread. Then, I exit the trade at my calculated error bounds.

Cointegration is a valuable tool for my forex pairs trading

Using cointegration in forex pairs trading is a market-neutral mechanical trading strategy that lets me trade in any market environment. It’s a smart strategy that’s based on reversion to mean, yet it helps me avoid the pitfalls of some of the other reversion-to-mean forex trading strategies.

Because of its potential use in profitable mechanical trading systems, cointegration for forex pairs trading has attracted interest from both professional traders as well as academic researchers.

There are plenty of recently-published articles, such as this quant-focused blog article, or this scholarly discussion of the subject, as well as plenty of discussion among traders.

Cointegration is a valuable tool in my forex pairs trading, and I highly recommend that you look into it for yourself.

 

Filed Under: How does the forex market work?, Uncategorized Tagged With: cointegration, cointegration calculations, forex pairs trading, mechanical trading

Coppock Curves : A Straight Line To Trading Success

April 15, 2014 by Eddie Flower Leave a Comment

Coppock Curves, sometimes called Coppock indicators or Trendex indicators, are a type of indicator which offers quant traders a solid foundation upon which to build a simple yet successful mechanical trading system.

As described in more detail below, I use Coppock Curves in my mechanical trading system to generate trading signals in the S&P 500 or any other highly-liquid index. Coppock Curves also work well for trading iShares and ETFs.

What is a Coppock Curve?

Coppock Curves are a momentum indicator. Over time, they oscillate over and under zero. The Coppock Curve indicator was first described in 1962 by the economist and trader Edwin Coppock. In fact, it works so well that the Market Technicians Association (MTA) recognized Dr. Coppock with a lifetime achievement award in 1989.

Spiraling staircase

Its value lies in showing the beginning of long-term changes in price trends of stocks and indexes, particularly at the beginning of upward trends. This indicator can also signal the bottoms of futures and forex markets, yet I’ve found it less reliable there.

Although you can program your mechanical trading algorithms to generate trading signals based on this indicator over any time frame, I typically use it with monthly charts across a wide range of stock and index markets. Still, active traders can certainly use Coppock Curves with daily or even hourly time periods.

Specifically, I use Coppock Curves to generate “buy” signals at the bottom of bear markets. This indicator is especially good for distinguishing between bear rallies and actual market bottoms.

This is a trend-following indicator, so it doesn’t precisely show a market bottom. Instead, it shows me when a strong, bullish rally has become safely established enough to trade confidently.

Best of all, in my experience trades from signals based on Coppocks Curves are fairly resistant to shakeouts and whipsaws. Coppock Curves are slow, but they’re safe.

Coppock Curves signal the end of a “mourning period”

As background, it’s worthwhile to note that the original idea which led Dr. Coppock to develop his indicator was based on the natural cycle of life, death, and mourning before returning to new life again.

He thought that the normal upward march of stock markets (and therefore stock indexes) was like the “life” part of the cycle, which of course was followed by “death” that is, the period of falling prices during a bear market.

Dr. Coppock was particularly interested in calculating the length of a stock market’s “mourning” period, after which it would be safe to re-enter the market “long” again. Logically, this entry point at the end of the mourning period would represent the beginning of the next long-term uptrend.

The apocryphal story says that he asked the bishops at a local Episcopal Church, one of his investment clients, how long people usually spent in mourning after bereavements. He was told that human mourning typically requires between 11 to 14 months, so those were the values he adopted in his original equation to determine when stock prices would begin to rise again.

Coppock Curves were first used as long-term indicators based on monthly charts. Of course, the signals generated with monthly time frames are fairly infrequent. Still, because I use Coppock Curves to trade a variety of markets, I receive plenty of trading signals.

In particular, the monthly time frame is very reliable for stock and index trading. Studies have shown that, since 1920 in the U.S. stock markets, Coppock Curves have generated winning signals with about 80% frequency.

Nowadays, with the rapid turnover in modern markets, it seems that trading cycles have become faster. In addition to monthly time frames, some traders have found that daily time frames work very well in generating successful Coppock Curve signals.

A trader can program a mechanical trading system to recognize and respond to signals based on a daily or hourly time frame, although additional algo trading parameters should be added to reduce the chance of overtrading.

If you want to use Coppock Curves to generate signals on shorter time frames, you could experiment with your mechanical trading system using a variety of make-sense “mourning periods” for your particular marketplace.

How to calculate Coppock Curves

The Coppock indicator is based on three variables: A shorter-term rate of change (abbreviated as ROC), and a somewhat longer-term ROC.  Coppock Curves are developed by using the weighted moving average (WMA) derived from the chosen time periods of a given market index.

The classic equation stated in words:

Coppock Curve = The 10-period WMA of a 14-period ROC plus an 11-period ROC

Or, as a formula for programming:

Coppock Curve = WMA[10] of (ROC[14] + ROC[11])

When ROC = [(Close – Close n periods ago) / (Close n periods ago)] * 100

Where n is the number of time periods.

In the classic scenario, 11 and 14 time periods. Be sure to make separate ROC calculations.

As you can see, the basic setup is very simple – On a moving basis, I program my mechanical trading system to calculate the percent of change in a given index (say the S&P or DJIA) from fourteen months ago.

Then, my mechanical trading program calculates the percentage change in the same index from eleven months ago. Next, the mechanical trading system adds together the two different percent changes. Then, it calculates a 10-period weighted moving average of the above total.

It’s important to note that you can use different time periods for the ROC calculations and the WMA calculations. I sometimes program my mechanical trading system to use the classic 11- and 14-month time periods for ROC while using time periods for the WMA which are shorter than the classic 10-month period.

So, I often use using a 2-month or 3-month WMA (instead of 10 months) while the ROC is calculated using the 11- and 14-month prices.

Or, you can modify your mechanical trading system to employ shorter time periods for some or all of the calculations, i.e. use daily or hourly prices instead of monthly price charts. It generates more signals, but in my experience they’re less reliable unless you add additional filters, as discussed below.

As well, you can add additional embellishments to suit your own needs. In any event, the general method remains the same. When charting the basic inputs, you’ll see that the output is a fairly smooth arc, hence the name of this indicator.

In any event, the classic Coppock Curve equation for programming a mechanical trading system can be stated as: The sum of the 14-month rate of change and the 11-month rate of change, with smoothing by applying a 10-month weighted moving average.

The Coppock Curve “buy” signal

On Coppock Curves, the zero line is the trigger. When the price line rises from below the 0 line it signals a low-risk buying opportunity. My mechanical trading system executes a buy when the Coppock indicator is first below 0, then heads upward from the trough.

Since this is most effective as a bullish indicator, I ignore the opposite (“sell”) signals. Still, some traders, especially those using short time frames, use Coppock Curves with algo trading systems to generate sell signals and execute trades that close out long positions. Active traders can both close long trades and open shorts when the Coppock Curve crosses below the zero line.

The figure below shows the classic Coppock Curve trading strategy using monthly time periods. The buy signal came in 1991. The sell signal came ten years later, in 2001. Note that this long time frame helped me avoid the slump in late 2001 and 2002.

The next buy signal came in 2003 and the sell signal was in 2008. This helped me escape the slump in 2008 and into 2009. Note, also that the current “buy” position, signaled in early 2010, continues to remain open, at least through the date of this chart.

Coppock Curve on S&P 500 monthly chart

The Coppock Curve on an S&P 500 monthly chart

Next, for more-active traders here’s a screenshot showing the strategy applied with shorter time periods, as shown on a daily S&P 500 chart. Of course, many more signals are generated, although in general they are less likely to be winners.

Coppock Curve on a daily S&P 500 chart

Coppock Curve on a daily S&P 500 chart

Importantly, the longer the time period, the safer the buy signal. Since my mechanical trading system based on Coppock indicators is a trend-following system, I don’t necessarily capture the immediate gains from the exact moment of a trend reversal. Instead, my mechanical trading system gets me “long” just before the beginning of a profitable advance in a bull market.

Adjusting and filtering signals from Coppock Curves

I’ve found Coppock Curves to be highly reliable when used for monthly time periods. In my experience, using weekly, daily or hourly time periods usually means that my entries and exits aren’t as “tight” as I would like, meaning that I don’t capture all the gains I had hoped for, and I also have more losses.

However, active traders can decrease the ROC variables, which has the effect of increasing the speed of fluctuation in Coppock Curves and will therefore generate more trading signals. Of course, even though monthly time periods are my favorite, an ultra-long-term trader could also increase the ROC time periods to slow fluctuations even more, thus generating fewer signals.

As I’ve said above, in order to receive earlier entry signals, I usually decrease the WMA downward from 10 months, sometimes to 6 months, and often to as little as 2 months. By programming my mechanical trading system carefully with just the right WMA period, and filtering the signals, I maximize my profitability in a given market.

If you want to use Coppock indicators for active trading, I recommend that you filter the trade signals generated by your mechanical trading system so that you only accept trades which are in the same direction as the current dominant trend. You’ll find this mechanical trading strategy to be the most profitable, since you can avoid many losing trades by filtering the signals.

Which markets show reliable Coppock Curves?

I use my Coppock curve-powered mechanical trading system to trade a range of indexes, especially those based directly on stocks, such as:

  • Dow Jones Industrial Average
  • S&P 500
  • NASDAQ Composite
  • EURO STOXX 50
  • FTSE 100
  • Nikkei 225
  • Hang Seng

As well, if you’re focused on ETFs you’ll find that a mechanical trading system using Coppock Curves will allow you to catch the beginning of trends in specific market niches, such as biotechnology, energy, and international or regional equities niches.

The key is to make sure you trade only the liquid indexes. Otherwise, you may run the risk of being shaken out during “fake” trend changes.

Trading Coppock Curves in non-equity indexes

As well, for the sake of diversification and to avoid issues with correlation, I also program my mechanical trading system to spot and trade Coppock Curves in non-equity indexes as well. Again, I focus on markets which have sufficient liquidity.

There are some profitable non-equity indexes, including iShares and ETFs, which can be traded using Coppock indicators:

  • Bloomberg US Treasury Bond Index
  • Bloomberg Canada Sovereign Bond Index
  • Bloomberg U.K. Sovereign Bond Index
  • Bloomberg US Corporate Bond Index
  • Bloomberg GBP Investment Grade European Corporate Bond Index
  • Bloomberg EUR Investment Grade European Corporate Bond Index
  • Bloomberg JPY Investment Grade Corporate Bond Index
  • iShares Barclays 7-10 Year Treasury Bond Fund
  • iShares Barclays 20 Year Treasury Bond Fund
  • Schwab Short-Term U.S. Treasury ETF
  • Vanguard Short-Term Government Bond ETF
  • PIMCO 1-3 Year U.S. Treasury Index ETF

I’ve seen reliable signals from Coppock Curves when trading all the above-listed non-equity indexes. As always, the key is to use a mechanical trading system in only those markets which are highly liquid, so that the algorithms are reasonably sure that a confirmed signal is legitimate before trading it.

Coppock Curves show a straight line to success

In recent years, Coppock Curves have been drawing renewed interest from traders who are turning once again to this tried-and-true trading tool. See, for example, these recent mentions of Coppock indicators in the financial press: Jay On The Markets, and the follow up article, as well as in various trader musings.

In summary, I can say that Coppock Curves can lead you straight to success, as long as you have the patience to let your mechanical trading system do the work for you. If you use the length of variables’ time periods which are most appropriate for your chosen markets, you should do very well with Coppock Curves.

Filed Under: Trading strategy ideas Tagged With: Coppock curve, Coppock curves, Coppock indicator, Coppock indicators, expert advisor, mechanical trading, ninjatrader, system, trading

Gap Trading Made Easy

April 8, 2014 by Eddie Flower 2 Comments

Gap trading with a mechanical trading system offers independent traders a relatively easy method to capitalize on sudden market moves.

Gaps are often seen in the stock and fund markets. They are somewhat less common in the forex markets, which are usually more liquid and trade overnight.

In gap trading stocks, funds, futures and forex, a price “gap” refers to the open space seen on a chart when the price moves sharply up or down with no appreciable trading in between price points.

In its simplest form, gap trading involves buying based on the rise of a gap-up, and selling on the fall of a gap-down. Put differently, gap trading means buying when a price moves beyond the high of the previous time period without trading through that high. Likewise, gap trading means selling/shorting when the price moves below the previous time period’s low without touching it.

I use mechanical trading systems to program my way toward gap trading success by following some basic gap-trading rules and algo trading strategies.

Why do trading gaps occur?

Gaps can occur for a variety of reasons, such as sudden buying or selling pressure, especially by large players. And, they may result from earnings announcements or fundamental news. In fact, gaps can follow any sudden change in investors’ perceptions about a stock, fund, future or currency.

A gap can happen for either fundamental or technical reasons. For example, if a particular company announces higher earnings than expected, its stock price may gap up during the next trading session, if not overnight. Likewise, unfavorable corporate news can spark a gap down.

Gap trading

Or, a stock, fund or future setting a new all-time or long-term high may gap up for technical reasons. That is, a price move past a certain point may trigger institutions’ buying programs, which sense those new highs and spur even more buying.

Likewise, a stock or fund whose price moves below a threshold point may trigger investors’ rush for the exits and thus push its price further downward. Down gaps tend to accelerate more sharply than upward gaps.

And, in the forex markets, any report or other news may greatly widen the bid-ask spread. This creates a tradable gap either up or down.

In any case, you can program a mechanical trading system to recognize and respond profitably for gap trading.

Classification of trading gaps

For study purposes, gaps are usually classified as one of the four types listed below. It’s important to remember that these classifications will only be confirmed in retrospect, after the gap has occurred.

Once I’ve seen the follow-up movement, these labels are useful for categorizing which type of gap has occurred. These classifications help me to better understand how a given stock, fund or currency reacts under certain market conditions.

Fortunately, when using a mechanical trading system for gap trading I don’t need to know what will happen after the gap, only the circumstances which arise just before the gap.

Common gaps are defined as gaps which cannot be otherwise classified in terms of ending one trend and beginning another. They’re very “common,” hence the name. Usually, they’re uneventful and they simply represent an unexplained price gap from one day to the next. The volume during a common gap is often low and this type of gap is generally “filled” quickly. (See below.)

Exhaustion gaps happen at or near the end of a long or strong price run-up or price drop. They signal a final push toward new highs or new lows before the price movement reverses or begins moving sideways. For me, they’re a warning that the recent move is at its end.

Exhaustion gaps are characterized by higher volume and wide price difference between the price at the previous day’s close and the next day’s opening price. Using my gap trading strategies, it’s fairly easy for me to trade and profit from this type of gap. Higher volume is the key to recognizing them.

Continuation gaps can arise in the middle of any price trend. They are sometimes also referred to as “measuring gaps” or “runaway gaps.” Continuation gaps often happen around the midway point of a strong trend.

I interpret them as showing that on a particular day an exceptionally large number of buyers or sellers chose to move into or out of their positions. Perhaps they represent buyers who didn’t get aboard the trend earlier, but who are now piling in.

As well, this type of gap shows higher-than-average volume both during and immediately after the gap. Still, the volume typically isn’t even as high as it would be with an exhaustion gap.

Breakaway gaps occur at the completion of one trend or chart pattern. They mark the start of a new trend. Breakaway gaps offer great gap trading opportunities for me. From a technical viewpoint, they occur when a price manages to break out of its mid-term trading range – say a period of several weeks — or an area of congestion.

A congestion area represents a zone between resistance and support. To break out from a congestion area, a stock, fund, future or currency must receive a significant amount of new buyer interest (on the upside) or negative attention (on the downside).

A true breakaway gap will show a very large increase in volume, whether on the upside or downside. The volume should be larger than with any other type of gap.

In any case, this represents a major turning point in price direction and in my experience the move is likely to continue for the mid-term or long-term.

I account the breakaway point as the new resistance or new support level. With my mechanical gap trading system, I look to harvest substantial gains from this type of breakout.

Most importantly, I avoid falling into the trap of assuming that a breakaway gap will retrace. Once my position is secured, I stay aboard for the ride. I’m confident that the new trend will continue for a reasonable period of time, at least until the next reversal on very high volume.

Gap fills

One other term-of-art often used to describe trading gaps is the word filled. When a gap is “filled,” it means the price has quickly returned to its pre-gap level.

Gap fills typically happen because buyers decide they were over-optimistic or over-pessimistic. Or, the news which triggered the gap is quickly proven false or overblown.

When prices move above or below technical resistance or support levels, I rely on my mechanical gap trading system to determine whether the gap is likely to be filled, and proceed accordingly.

For example, since exhaustion gaps show the end of a trend, they are likely to be filled:  The price gaps, then retraces. So, my gap trading system uses data from the previous trend to determine the appropriate entry and exit points to take advantage of both sides of this fairly predictable move.

Gap fading

Gap fading described when a price gap is filled during the same trading period when it occurs. The gap movement “fades away.” It occurs when investors’ exuberance or despair is quickly proven unfounded. This scenario often arises during earnings season.

I and other short-term traders use mechanical gap trading systems to recognize and harvest gains from these quickly-reversed moves in stocks, futures and forex markets.

General gap trading strategies

In markets that I’ve been watching closely, I use several gap trading strategies. In order to profitably trade gaps, I need to keep several things in mind.

First, it’s important to realize that when the price begins to fill its gap, it usually continues until the fill is complete. This is because a gap doesn’t have any nearby support or resistance. Otherwise, that gap wouldn’t have occurred in the first place.

Second, I keep in mind that continuation gaps and exhaustion gaps are predictors of price movements in opposite directions. So, I make sure that my mechanical trading system considers gaps in relation to the recent trend which precedes them. If not, I might trade in the wrong direction.

Also, I ensure that my gap trading system makes decisions based on volume as well as price. To help classify a trading gap for purposes of programming my algo trading system, I make a distinction between high volume, medium volume and low volume.

For a successful breakaway gap, very high volume must be present. And, exhaustion gaps are characterized by somewhat lower volumes, although still higher than usual.

I often watch stocks and funds that trade mostly during daytime sessions. Then, I program my mechanical trading system to buy their shares in after-hours trading when positive earnings are unexpectedly released.

If I’ve done my homework correctly, at the beginning of the next daytime trading session there will usually be a gap up when institutional investors crowd into the stock. As well, I use my mechanical trading system to spot and act on technical factors that signal a likely gap the next day.

This gap trading strategy also works well with currencies. My mechanical trading system tells me whether to buy or sell when a currency gaps up on low liquidity and there is no nearby overhead technical resistance. This works especially well during geopolitical events which seem likely to continue for more than one or two days.

Likewise, I use gap trading tools to profit by fading the gaps in the opposite direction. For example, if the price gaps up based on speculation when there’s nearby resistance, I fade the gap with a short order. So, I ride the price from its failed gap-up level while it goes back down to its normal price range.

Gap trading in the forex markets

The forex markets are open twenty-four hourly except for a weekend closing. So, for charting purposes forex gaps are visible as large candles when the market reopens.

Here’s the gap trading strategy that I use in forex markets. By programming my mechanical trading system with the following basic rules, I’m able to harvest satisfactory gains.

First, the direction of my trade must always be in the same direction as the current hourly price. My mechanical trading system watches for the currency to gap above or below its calculated resistance level according to a thirty-minute price chart.

Next, my system looks for a price retracement back to the calculated resistance or support level. This shows the gap is being filled — The price is returning to its previous resistance-turned-support or support-turned-resistance level.

From a charting perspective, I look for a candle showing price continuation in the same direction as the gap. My gap trading system takes this as a confirmation of continuing support or resistance at the indicated level, and trades accordingly.

Double check volume before trading

With help from my mechanical trading system including the appropriate algorithms, I’ve been enjoying good results in trading gaps in the prices of stocks, ETFs, futures and currencies.

I’ve found that volume is the most important qualification when determining the type of gap and assessing the likelihood that the price move will continue.

To avoid becoming emotionally caught up in any price move, I rely on my gap trading system to quantify and verify the volume before sending any buy or sell orders. I set my algo trading parameters to check a variety of pricing sources before generating orders.

If my mechanical trading tools detect high-volume resistance that is preventing the marketplace from filling a gap, then my system double checks the volume and price data to ensure that my trading premise is correct before proceeding.

Of course, I always program my gap trading system with appropriate stop-loss orders. Some traders believe that gap trading is risky. Yet, with the right mechanical trading tools it offers plenty of opportunities for fat gains.

In fact, gap trading by using mechanical trading systems is currently a hot topic:  A book regarding ETF gap trading has recently been published, and there are many academic reports and quant-focused articles about how to trade gaps.

I recommend that you explore the possibilities of gap trading with a good mechanical trading system. With the right tools, gap trading can be both predictable and profitable.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: breakaway gaps, ETF trading, exhaustion gaps, forex trading, gap trading, mechanical trading, resistance, support, trading gaps

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

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.