**The R Trader » R**, and kindly contributed to R-bloggers)

There is no holy grail in trading instead there are strategies that work for a while or in a specific market environment. The role of the analyst is therefore twofold. First find a good trading strategy, second find the right environment for this strategy. The present post focuses on the latter. More specifically it aims at estimating good entry/exit point for mean reverting strategies in the FX market. Obviously this does not guarantee good performance but it does guarantee to raise the odds in the trader’s favour. This is what quantitative trading is about.

As I advocated in a previous post, it always starts by knowing what you’re trading. In that respect, I’ll gather here the necessary stylized facts to design a systematic action plan.

**Daily range completion**

The graph below shows the cumulative probability of hitting the high and low by hour within the day for the EURUSD future contract from October 7th 2009 to September 14th 2011. The obvious point is that after 3:00 PM (timezone GMT+1) the probability of the daily range being completed is higher than 60% (grey line).

**Price distribution**

In the context of intraday trading, it’s key to understand where the current price fits in the daily price distribution. Two elements are needed to define the position of the last price. First, a proper estimate of today’s range, second, a synthetic measure of position within this range.

Regarding the former using an ATR (Average True Range) over the past 20 days is a good generic metric. It doesn’t rely on a single day and doesn’t look too far back in the past. Obviously this has to be tailored to individual needs.

The price position within the daily range is expressed in percentage term relative to the day high and low. I named this indicator **LRTDR** (Last Relative To Daily Range) and it’s inspired from the QUSMA blog. The exact calculation is:

As this indicator is used at any point in time during the day, high and low are not the final high and low for the day but the highest and lowest prices up to the calculation time. As such LRTDR constantly adjusts itself during the day and oscillate between 0 and 100%.

Let’s take an example: On September 15^{th} 2011 (chart above) the ATR is 179 pips. At 09:00 AM, the daily range is 55 pips (1.3749-1.3694) and . This means that 31% (55/179) of the ATR has been completed so far that day and the last price stay in a well bounded range relative to recent history. All in all, no exciting news at 9:00 AM.

Now let’s do the same calculation at 3:30 PM. The daily range is 160 pips (1.3854-1.3694) or 89% (160/179) of the ATR have been completed so far, and . In a nutshell, the last price stands at an extreme and the majority of the daily range has been completed. This sounds like a good entry/exit point for someone’s playing the reversal.

**Volatility**

The volatility level gives a confidence intervale around the price forecast. If current volatility is high then the 3:00 PM cut off defined above might be less reliable than in a low volatility environment. I’m going to use the ATR as a measure of volatility.

There are many possible improvements for the volatility estimation: GARCH modeling, Garman-Klass etc…but for the purpose of this post a simple ATR is good enough.

**Putting all the pieces together
**

Assuming I’m trading a mean reversion strategy, by now you should see where I’m heading to! Let’s get back to the example above. It’s 3:30 PM , the probability of range completion is above 60%, EURUSD has completed 89% of the average daily range, price stands at an extreme for the day and historical volatility is high but not at an extreme. No maths is required to realize that all indicators (but volatility) are pointing toward a high probability reversal. I deliberately chose an example where not all metrics where pointing toward a reversal as this is what to expect in real life trading: reality comes in shades of grey not black and white.

The good thing about approaching the problem from the perspective above, is that you get a reversal probability that is constantly updated along the day. Essentially this approach systematizes what a lot of (professional) traders do manually.

The data used in this post is the 5min bars for the EURUSD future contract. High and low prices are mid range values (average of bid and ask). The timezone considered is GMT+1.

Any comments welcome

**leave a comment**for the author, please follow the link and comment on his blog:

**The R Trader » R**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...