Algorithmic and Mechanical Forex Strategies | OneStepRemoved

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

Bearish Butterfly Harmonics and Win Rate

June 9, 2013 by Rupert Hadlow 1 Comment

Butterfly harmonic patterns are high probability trade setups that identify reversals in trends. As discussed in our previous post on harmonics, the butterfly is created when price points reach exhaustion levels. Unlike the ABCD and the 3 Drive, this pattern starts with a long pullback, and is followed by a price rise and a breakdown in the continuation.

Execution speed is critical as the butterfly can identify quick breakdowns in the price. Some of the rules that govern the pattern are highlighted below.

Bearish Butterfly Specifics

Bearish butterfly pattern

A bearish butterfly pattern

• Point A to D is 127% / 161.8% greater than X to A
• X must be less than D
• Butterfly requires an ABCD formation
• Extension greater than 161.8% between X and D will make the pattern void

Although widely recognized as having a high probability of success (70-85%), trading this pattern requires adequate risk management and the use of secondary indicators for confirmation purposes. It is important to utilize trend and regression based indicators as these compliment price action systems like harmonics.

Confirmation Indicators for Bearish Butterfly

ITrend

The ITrend is a unique technical indicator that identifies strength in buying or selling pressure within a trend. Very useful during periods of heightened volatility, the ITrend can be used effectively with harmonic patterns, particularly the butterfly, as it paints a picture of whether buying pressure has been exhausted.

The only drawback with the ITrend is the degree to which it gives whipsaw signals during flat periods of trade. If the market is trending without volatility, this indicator should not be used. It can be downloaded at http://codebase.mql4.com/441

Linear Regression

Using linear regression with the bearish butterfly can paint a clearer picture of where the price is within the long term regression channel. For example, if a pattern is triggered indicating a reversal in the price, however the price is sitting towards the lower standard deviation channel, then the probability of reversal is less than if the price was sitting in a top linear channel.

The main drawback with using linear regression as a confirmation indicator is its adaptability to sharp price movements. If the linear lookback period is too short or too far, then the indicator will either whipsaw or it will not adjust accordingly.

Moving Averages

One of the most important confirmation indicators to use with the bearish butterfly is moving averages. This provides the trader with a specific entry point, once the price crosses below the shorter moving average. A stop loss can then be set at a the level of the longer term moving average.

Moving averages may not adjust quickly enough to short term bursts of volatility.

Example – Using MA for Confirmation

Bearish butterfly example

A sample chart showing a bearish butterfly

In the GBPUSD diagram, we can see that the bearish butterfly formation develops when the price reaches new highs. The trader is supplied with the confirmation signal, when the price retraces and breaks out of the grid. Although this is a text book scenario, in many cases the currency may not retrace and could continue on its trend (hence the breakdown in the pattern).

In this example, we added the moving averages. Our entry point was when the price punctured the moving average at 1.51730. As we only added a short term moving average, we set out stop loss at 70 pips from the entry.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: bearish butterfly, harmonic patterns

Harmonic Trading Patterns: What Are They?

May 24, 2013 by Rupert Hadlow 14 Comments

Price action and high probability pattern trading are two defining characteristics of Harmonics. Based on the geometrical shifts in Fibonacci angles, Harmonic trading patterns have long been used to identify reversals in a trend.

Depending on the distance from the previous high or low point within a range, the change in price can be predicted with almost 60-70% accuracy. Please note that this was the estimate given by website harmonic-trader.com. These percentages can be greatly exaggerated and are subject to a variety of factors including risk and money management.

Fibonacci

The important questions that need to be asked when analyzing the viability of harmonics is how they are calculated and why are they assigned a high probability label. One of the key components of harmonic trading is Fibonacci.

“The Fibonacci sequence of numbers is as follows: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, etc. Each term in this sequence is simply the sum of the two preceding terms and sequence continues infinitely.” (Investopedia,2013)

The traditional mathematical formula has been adapted to trading to identify levels of support and resistance within a given range. Harmonics use the sequence to calculate whether there is potential for reversal in the price.

Different Types of Patterns

Harmonic trading patterns

Harmonic trading patterns are mathematically based and have different probabilities of success

Source:  http://fib618.wordpress.com/fx-strategy/harmonic-patterns/

  1. AB=CD
  2. Bat
  3. Butterfly
  4. Crab
  5. Gartley
  6. Shark
  7. 50
  8. Three Drives

Each of the above patterns will be analyzed in detail in follow up posts.

Advantages

  • High Probability

With a high success rate, Harmonic trading is increasingly becoming popular with retail traders. As it utilities mathematics and geometry to determine entry and exit points, there is little room for error. It is important however to choose the right pattern and not overtrade. Although there are a number of different setups, the high probability patterns include the Gartley, Crab, Shark and AB=CD.

  • Trend Reversal Forecasting

Another key advantage of Harmonic trading is its trend reversal forecasting capability. In essence, a trader can see whether or not a price movement is at its beginning or end. Once again it is dependent on the choice of harmonic pattern. Traditionally hedge funds that trade on exhaustion (overbought or oversold) situations will use harmonics as one of their many tools to identify reversals.

Disadvantages

  • Complex

Setting up a chart to identify harmonic patterns can be quite complex. As they are based on mathematical and geometrical calculations, a normal trader would not be able to identify a pattern without using an indicator or overlay chart.

  • High Risk

Harmonic Trading can involve significant risk if not managed effectively. As the patterns attempt to identify reversals in a trend, they can sometimes be too early or incorrect. This can lead to the trader betting against the market and momentum. It is always important to impose strict risk and money management rules.

  • Curve Fitting Results – Back test

Hindsight can be a beautiful thing in most cases, however when it relates to harmonics it is not. Curve fitting can occur when back testing harmonic patterns. This is due to the fact that a trade setup may have existed at the time, however the trigger will not show in the back test, as the trend has continued and broken down.

To reduce such risk, it is important to stress test using out of sample data. This can be done by choosing random and specific data ranges, and testing the performance for that period. If the success rate or figures are completely different, then it is curve fitted.

Charting

Following on from our previous comment pertaining to high risk and complex, charting harmonic patterns can be challenging for most traders. It is almost impossible to identify trade setups without using a predefined layover chart or indicator. Remember, timing and execution efficiency are key in harmonic trading, hence the requirement for a mechanised system.

For a harmonic indicator and expert advisor, please contact one step removed.

Risk Management

A common risk management technique to adopt when trading harmonics is the 1 to 2 risk reward. The reason for this choice is the level of risk. Harmonics can be great at picking reversals in price, however when they breakdown, they can be very ugly indeed, and can cause significant losses. Once again an automated system that sets specific stop loss and take profit levels would reduce this risk.

Filed Under: How does the forex market work?, Test your concepts historically, Trading strategy ideas Tagged With: bat, crab, Fibonacci, harmonic

Pairs Trading – Entry Point Confirmation Using Technical Indicators

May 23, 2013 by Rupert Hadlow Leave a Comment

Trading pairs without adequate confirmation is like building a house without a structural engineer. In the short term the design may be stable and safe, however over a longer period of time, the sensitivity to weather conditions and other factors could be hazardous.

Systems that are based on one factor alone will invariably have a shelf life and will need to be retrained to accommodate shifts in market conditions. As discussed in our previous article on cointegration, the degree to which a trader does not adhere to these strict guidelines, can greatly affect his/her profitability.

Technical indicators for entry signals on a pairs trade

Some of the key technical indicators and patterns that can work well for confirming entry signals include the Relative Strength Index (RSI), Market Facilitation Index (MFI) and Candlestick charting. Each has a unique attribute, and can assist in defining key entry and exit points.

Relative Strength Index (RSI)

Although this is a relatively common indicator that does not stand the test of time by itself, the RSI can be an effective tool in pairs trading. Defined as the change in momentum, this technical indicator will range from 100 (extremely overbought) to 0 (extremely oversold). Traditionally the trigger points are 70 for a short and 30 for a long. With respect to pairs trading, this strength index allows the trader to confirm overbought and oversold scenarios.

RSI technical indicator

RSI shows how a technical indicator can be used to spot entry opportunities

  • Example:

The sppread between Gold and Silver is considerable, with the cointegration still above the required 80 mark (according to catalyst corner). The relative strength index has confirmed that silver is trading in the oversold bracket (at 75), providing the trader with a valid entry for a short position.

Market Facilitation Index (MFI)

Invented by technical analyst Bill Williams, the MFI identifies the momentum of a movement based on the volume. Depending on the strength of the buying and selling pressure, the indicator will price in an estimate of whether the trend is strong or weak.

Commonly used with longer time frames, the Market Facilitation Index is calculated by using the high, low and volume bars. Unlike RSI, the indicator is represented by a bar graph with coloration. Green highlights strong volume and momentum, whilst blue, brown and light brown indicate indecisive volume reactions. In pairs trading, the MFI can identify long term momentum patterns and which cross to buy or short.

Included below is a table from Wikipedia, which visually highlights the degree to which an adjust in volume can influence the market facilitation index.

The money flow index shows stuff

The money flow index uses basic bar information to create a colored graph

Source: Wikipedia,2013

  • Example:

Gold has crossed below silver on a linear regression basis. The Market Facilitation Index however has indicated that volume and momentum are rising, and there will be a rebound in the price. The trader would look at going long gold and short silver.

Candlesticks

Candlesticks are an extremely efficient way of determining the trend of a price. Different patterns defined by the open high low and close price can supply the trader with efficient entry and exit points. From a pairs trading point of view, it is important to only open a position based on a strong buy or sell pattern. Bullish signals include a piercing pattern, inverted hammer, morning star and abandoned baby. For more information on each of these patterns it is recommended to visit www.stockcharts.com

  • Example:

During the month of April, the spread between Gold and Silver is relatively tight. A morning star formation appears on the Gold price, indicating a potential bullish reversal. The trader in this case, would open a Long Gold, Short Silver to capitalize on a sudden breakout in the price.

Filed Under: Trading strategy ideas Tagged With: candlestick charting, cointegration, market facilitation index, pairs trading, RSI

Pairs Trading Case Study: Gold / Silver

May 20, 2013 by Rupert Hadlow 3 Comments

Finding a pair of currencies or commodities that can stand up to the cointegration test on both a short term and long term basis can be quite difficult. It is common for pairings to have some degree of distance or long term deviation away from the linear regression and this can greatly affect performance.

Several high profile market neutral hedge funds have been victim to this regression breakout. Long Term Capital Management (LTCM) is the most famous example. The fund lost several billion dollars in 1998 during the Russian financial crisis. Nearly every position in its bonds and derivative pairings went off the rails all at the same time.

Trading pairs is not full proof and strict risk management and cointegration retraining must be implemented. As discussed in our previous posts on correlation and cointegration, we are looking for the degree to which two variables will return to their common mean. This will determine our entry and exit strategy, and where we will place our stops.

In one of our previous articles – ‘Analysing Pairs with Correlation and Cointegration’, we identified Gold and Silver as a good potential trading pair due to its statistically high long term percentage levels. We calculated the cointegration using a free tool from the website – Catalyst Corner www.catalystcorner.com.

Download the tools for MetaTrader 4.

30 Day Correlation: 94.98%
2 Year Correlation: 26.99%
13 Year Correlation: 95.3%
2 Year Cointegration: 85%

Pairs trading with silver and gold

Silver (Black) Gold (Orange Green) 30 Minute Chart

Setting up Charts

Setting up a pairs template in MetaTrader is relatively simple and requires two free indicators (these have been included with the tutorial). The first indicator is that of the FX Correlator and the second is the overlay chart. Highlighted below are the step by step instructions on adding each to your chart.

1. Open Metatrader and Choose Chart
2. Drag the Overlay Chart onto the open chart window, and specify default settings. Click OK.
3. Attach the FX Correlator to the chart, click INPUTS and change all currencies to FALSE except for USD and AUD. The reason why we are keeping these two as TRUE is outlined in the trade setup section. Click OK.

Trade Setup

You will now see two indicators positioned on the chart window. The top overlay chart will highlight the price of silver in comparison to gold. You will notice that the general trend direction is quite similar (correlation), however there are points along the timeline where the prices widen and then regress (cointegration). These are the points that we are looking to profit from.

The FX correlator is a unique indicator that calculates a spread between the main chart window and specified other crosses. When we added the indicator to the chart, we only specified the AUD and USD currencies. Hence we can only see two coloured linear regression points along the time line. The reason we chose the Aussie dollar, was because of its susceptibility to commodity prices movements and the US dollar is the natural base cross with Gold and Silver.

Trading Opportunities:

• Long Gold and Short Silver when the USD crosses above the AUD on the FX Correlator.
• Short Gold and Long Silver when the USD crosses below the AUD on the FX Correlator.

In the diagram above, we have circled a number of trade setups. On the 14th of May at 4:00, the USD crossed higher than the AUD, triggering a potential Short Silver/Long Gold scenario. According to the chart, Silver regressed back to the mean and overlapped Gold at 12:00. The second possible trade scenario occured on the 15th of May at 20:00. As the AUD crossed above the USD, a Long Silver / Short Gold trade was triggered with the spread widening.

Risk Management

• Tight Stops on both crosses
• Calculate the correlation and cointegration of Gold and Silver regularly (daily basis). If the cointegration breaks down (below 80%) do not trade.
• Position size should be based on underlying value and may not be equal.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: cointegration, fx correlator, overlay chart, pairs trading gold silver

Charting a Linear Regression

May 16, 2013 by Rupert Hadlow Leave a Comment

Linear Regression can be an effective tool when defining the overall momentum or trend of a series of prices. It can be adapted to all data. Fields outside of trading, including risk management and statistics, use the same statistical technique. Insurance providers will commonly plot the relationship between claims and age groups to determine premium levels.

To put it into perspective, if there were five people in a group who each owned two television sets, one person who owned no tv and two people that owned four tv sets, then the linear regression on a rough basis would indicate the trend is just slightly above the two sets. The standard error or deviation in this case would be the two outside samples of no tv and four televisions.

Can regression be an effective tool for trading on a longer term basis or is it too susceptible to market volatility and future pricing? To understand how linear regression really works, we need to chart the channel and its standard deviation levels.

The first tutorial below looks at a scatter graph in excel and how to plot a linear regression. Please note that it does not include the standard deviation channels.

Charting a Simple Regression in Excel

  1. Open your Metatrader platform and click on TOOLS, HISTORY CENTER.
  2. Choose the relevant pair for your regression analysis. Once you have chosen the time frame, click on EXPORT and SAVE the spread sheet.
  3. Open the spread sheet and highlight the two relevant columns you would like to use in the scatter chart. In the diagram above we used time (minutes) and price.
  4. Click INSERT and choose SCATTER. A drop down menu will appear. To get a true reflection, click on SCATTER WITH ONLY MARKERS.
  5. A chart will appear with dots representing the distribution of pricing data. To decipher the linear regression, highlight the chart and click on LAYOUT in the excel menu.
  6. Navigate to TREND LINE. A drop down menu will appear with several options. Choose LINEAR TREND LINE. The regression line will now appear.
Excel linear regression on EURUSD M5 data

Excel draws a linear regression of the EURSUD prices using data from MetaTrader M5 charts

As discussed previously, the excel chart will only give a basic trend and will not supply the user with detailed standard deviations. It is also recommended that you do not highlight too much data for a realistic short term interpretation.

We specified eight hours of five minute data on the EURUSD cross in the above diagram.

Charting Linear Regression in Metatrader

  1. Open the desired chart and time frame in Metatrader
  2. Click on INSERT and CHANNELS. You will then be provided with a list. Choose LINEAR REGRESSION.
  3. Hold down your left mouse button and drag the linear regression over the desired time period. In the above diagram, we chose a linear regression with a starting date of the 13th May at 10:30.
  4. You will notice that the regression line will appear and adjust according to the data. One standard deviation will also appear.
  5. If you would like a second deviation channel on your chart, navigate back to the top of the terminal menu and click on INSERT – CHANNELS and choose Standard Deviation. You will then need to drag the standard deviation channel using your left mouse button and specify the same time period.
A linear regression of the EURUSD

MetaTrader interprets the price movements and draws a liner regression

Recommendation

It is recommended when trading using regression, that you specify a shorter range so as to manage the volatility. As prices shift, so will the channel, and profit potentials could quickly turn to losses.

It is important to always keep stops tight in case of violent swing backs in the price.

Filed Under: How does the forex market work?, Trading strategy ideas Tagged With: charting standard deviations, cointegration, correlation and pairs trading, linear regression

Analyzing Pairs with Correlation and Cointegration

May 10, 2013 by Rupert Hadlow Leave a Comment

Pairs Trading or Market Neutrality have long been seen as complex hedge fund style strategies with limited application for the retail trader. As part of our series on Correlation and Cointegration, we thought it would be beneficial to look at how both regression patterns can be used effectively to identify pair trading opportunities and scenarios, and how to reduce possible pitfalls.

The mystery that surrounds Cointegration and its complexity from a formulation point of view has somewhat put off many traders. Funnily enough, even as I write this post the spell check does not identify Cointegration as a word, which gives you an indication of how often the term is referenced.  

Identifying Good Pairs Trades

Although there are a number of formulas or tests that can be used, one of the most widely adopted is that of the Augmented Dickey Fuller (ADF) Test. Formulating a p-value, the test allows the trader to identify how cointegrated two series are over a specified period in an efficient and simplified way.

To put this into context, if the prices for currency A and currency B are inputted into the model and the p-value comes out at 0.02, then this identifies that 2% of the time the two variables are not stationary or 98% of the time they are cointegrated.  Make sure that you use a good number of values (eg 3 years on a daily chart), otherwise the calculation may not give you the most accurate indication.

There are a number of sites where you can download an excel version of the ADF test including www.quantcode.com

The next part in the calculation process is to work out the correlation. It is recommended that multiple time frames are used to also paint a picture of the cycle of the linear regression. To highlight how much of a discrepancy there can be, we ran scans on the EURUSD/GBPUSD and Gold/Silver Pairings. Results were very interesting.

  • Example 1:          EURUSD and GBPUSD                              

30 Day Correlation:         73.46%
2 Year Correlation:         64.89%
13 Year Correlation:        89.20%
2 Year Cointegration:     13%

The long term correlation indicates that the pairs track a very similar path. However on a short term basis, they will gradually move apart. On a cointegration basis, only 13% of the time over the last two years have the pairs reverted back to the same mean.

  • Example 2:          Gold and Silver

    30 Day Correlation: 94.98%
    2 Year Correlation: 26.99%
    13 Year Correlation: 95.3%
    2 Year Cointegration: 85%

The two year interval highlights how the prices are statistically out of their long term and short term ranges. According to the cointegration figure, the prices of both Gold and Silver reverted back to the same mean 85% of the time.

Conclusion: Gold and Silver is a better pairs trade than EURUSD and GBPUSD.

Cointegration and Correlation Technicals

Now that we determined that gold and silver show the highest correlation and cointegration, we need to analyse the technicals for specific entry and exit points. In the below example, there are three specific graphical representations (top chart is the gold price, middle chart is the regression correlation, and the bottom chart is the Silver price). The linear regression period is 360 days with no look back.

Gold Silver Correlation

A chart showing gold, silver and their correlation

The diagram had two possible entry and exit points over the one year period. In August, the 360 regression channel indicated that the linear value would revert to its mean after a period above the 3rd standard deviation.

According to the chart, a Short Gold and Long Silver pair signal would have been triggered. The second trade came in December, with the linear line breaking back through the bottom standard deviation channel.  

Pitfall

With reference to the above example, we can see a number of issues that could greatly impact performance. Curve fitting as it is commonly known is best described as a specific series fitting a time variable without giving a true and clear picture of performance.

Strategies that require definitions from future pricing or large historical data are usually curve fitted. On paper it may look great, but in real trade scenario, the results may be completely different.

The 360 regression channel chart did not pass the out of sample (curve fitting) test. As can be seen below, when the look back period is amended to 162 Days, the signal would be completely different.    

A moving window for the regression channel provides fewer opportunities for curve fitting

A moving window for the regression channel provides fewer opportunities for curve fitting

Solution

One of the solutions for curve fitting in pairs trading is to reduce the linear regression period to a shorter window or time frame. Although this can result in sensitivity to volatile movements, this reduces the potential risk to forward looking scenarios. Traders should also be aware of changes in the correlation and cointegration values of the pair, as these can shift quickly due to market mispricing or global economic and political events.  

Filed Under: How does the forex market work?, Test your concepts historically, Trading strategy ideas Tagged With: augmented dickey fuller test, cointegration calculations, correlation pairs, curve fitting

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.