Detecting extremely strong trends

I wrote an another indicator for Meta Trader for detecting extremely strong trends, that are supported by institutional traders. The indicator is based on the FX-Ed Trend technique described in the previously mentioned book Forex Patterns & Probabilities: Trading Strategies for Trending & Range-Bound Markets by Ed Ponsi. The technique makes use of a fact, that institutional traders are known to create support and resistance at the 10-day EMA. The indicator is intended to be used, and works only on a daily timeframe.

Strong trends are detected by checking if exponential moving averages are aligned in the proper order (as discussed in my other post), and the 10-day EMA acts as a support (for an uptrend) or resistance (for a downtrend) for a period of at least certain number of bars (specified by the external variable signalMinBars). It is 10 by default (as suggested by the author), but it can be changed. I have been experimenting with less restrictive filter (i.e. when the number of required bars is less than 10).

Uptrend conditions:

1. EMA(10) > EMA(20) > EMA(50) > EMA(200)

2. FOR each i = 0..signalMinBars – 1: Low[i] > EMA(10, i)

Downtrend conditions:

1. EMA(10) < EMA(20) < EMA(50) < EMA(200)

2. FOR each i = 0..signalMinBars – 1: High[i] < EMA(10, i)

where Low[i] and High[i] denote the lowest and highest prices of the bar i, and EMA(10, i) is the value of the 10-day EMA calculated for the same bar.

Once such trend is detected, a trade opportunity to buy or sell comes when the price falls to, or rises towards its 10-day EMA.

For every bar that satisfies either group of conditions, little arrow is shown pointing upward or downward depending on the trend direction. In addition, a bigger arrow is shown in the upper left corner that corresponds to conditions calculated for the current (zero) bar (see Fig. 1-3 below).

The indicator also shows a stop loss level for every bar (orange dots), either below or above the 10-day EMA (depending on the trend direction). The stop loss is based on volatility and calculated using the the following formulas:

EMA(10) – ATR(14, i) / 2 (for an uptrend)

EMA(10) + ATR(14, i) / 2 (for a downtrend)

where ATR(14, i) is the 14-period average true range calculated for the bar i, that is either substracted from or added to the 10-day EMA.

According to the above technique, the stop loss level should be updated when the current candle closes. The stop loss level shown by the indicator is intended to be used to determine the stop loss placement when opening a new position (using the stop loss level that corresponds to the zero bar), and also when updating the stop loss for the existing position – at the time when the current candle closes (using the stop loss level that corresponds to the closed candle).

Since the indicator (unlike a Meta Trader’s expert advisor) has no knowledge about when (or if) a position is opened, calculation of the stop loss level for the given bar doesn’t take this fact into consideration. This is the reason for which the stop loss level shown by the indicator sometimes may appear to be lowered in an uptrend or moved higher in a downtrend. It is important to remember that once a position has been opened, the stop loss level should be updated in the direction of the open position only, i.e. it should never be lowered for a long position or raised for a short postion.

The following (Fig. 1) is an example of  a very strong downtrend being detected on a daily EUR/USD chart (signalMinBars is 10):

MAStrongTrendDetector on a daily EUR/USD chart

The downtrend was detected 3 times (see 3 little arrows pointing downward). There are a few possible entry points shown for illustrative purposes. The first entry has quickly become unprofitable (with a 101 pips loss – assuming that a short position was entered exactly when the price touched the 10-day EMA). However, if a short position was entered at the 10-day EMA, just after the third time the downtrend has been detected (one bar after the third arrow), it would give a total profit of 600 pips 12 days later (1.3708 – 1.3108 = 0.0600).

Fig. 2 shows the same chart where signalMinBars was reduced to 5, and as a result more signals were given.

MAStrongTrendDetector on a daily EUR/USD chart

Fig. 3 shows a situation, where a strong downtrend has been detected for the current (zero) bar (signalMinBars is 1). Notice a bigger arrow in the upper left corner pointing downward.

MAStrongTrendDetector on a daily EUR/USD chart

Finally, another example (Fig. 4) illustrates that the indicator only works on a daily timeframe, where institutional traders are known to create support or resistance at the 10-day EMA.

MAStrongTrendDetector on a 4-hour EUR/USD chart

The source code of the indicator is available here.

Trend detection using moving averages

Recently, I have been experimenting with a trend detection technique based on moving averages. I read about it in a book Forex Patterns & Probabilities: Trading Strategies for Trending & Range-Bound Markets by Ed Ponsi, which I highly recommend. The technique attempts to detect a trend (either an uptrend or downtrend) by checking if exponential moving averages are aligned in the “proper order”, as determined by the following conditions:

EMA(10) > EMA(20) > EMA(50) > EMA(200) (for an uptrend)

EMA(10) < EMA(20) < EMA(50) < EMA(200) (for a downtrend)

I wrote an indicator for Meta Trader that visualizes this method. The above conditions are calculated for every bar in a chart, and if a trend is detected little arrows are shown pointing either upward or downward depending on the trend direction (as shown in Fig. 1 and Fig. 2 below). In addition, a bigger arrow or “No Trend” text is shown in the upper left corner that corresponds to conditions calculated for the current (zero) bar.

The following is an example of a downtrend detected on a daily USD/GBP chart:

MATrendDetector indicator on a daily GBP/USD chart

Another example illustrates how the indicator looks like when there is no trend detected for the current (zero) bar (“No Trend” is displayed in the upper left corner). The indicator also shows periods of an uptrend and downtrend that occured in the past.

MATrendDetector on a 4-hour NZD/JPY chart

To better visualize this concept, below is the same chart as in Fig. 2. overlayed with moving averages used to calculate the indicator.

MATrendDetector on a 4-hour NZD/JPY chart overlayed with moving averages

I found this trend detection method to be very useful, and the visualization of it helped me better understand the nature of trends in Forex.

If you want to try it yourself, the source code of the indicator is available here. Your thoughts and comments are very welcome.