Saturday, February 11, 2012

USDJPY inside bar backtest - 2001 to 2008

I just compiled a backtest of inside bars for the USDJPY pair between 2001 and 2008, using a 21 EMA to measure the trend. I'm completely fatigued. This took around eight hours to complete, a great way to spend my Saturday, but I think it's a good indication of my seriousness.

The results of the USDJPY backtest are comparable to the EURUSD, which is excellent, as the USDJPY and EURUSD are one of the least correlated currency pairs. Trading inside bars would be profitable, as seen below.


Trading with the trend
187 trades initiated

Risk:reward ratio = 1:3
Expected return per trade = 19.79%

Risk:reward ratio = 1:2
Expected return per trade = 13.9%

Risk:reward ratio = 1:1
Expected return per trade = 17.65%

Trading against the trend
182 trades initiated

Risk:reward ratio = 1:3
Expected return per trade = 16.48%

Risk:reward ratio = 1:2
Expected return per trade = 13.74%

Risk:reward ratio = 1:1
Expected return per trade = 9.89%


It's good to see positive results for a different currency pair. It means that inside bars can be traded beyond the EURUSD. Trading with the trend seems to yield slightly better results, which is expected. Scalping with the trend seems like a safer way of trading with a 1:1 risk:reward ratio.

I'm very pleased. This strategy is looking solid.


  1. hi there. Very good post, and very interesting indeed. Yes, this shows how these set ups have a high probability of success. I use inside bars to trade, but my exit strategy is more of a trailing stop. I just wanted to ask a few questions:

    You mention exp return/trade. how much % of account do you risk to make that number?

    What trading costs are assumed in this back test? Swaps I imagine will be negligible but I just wondered about spreads.



  2. Hi Ciaran. This backtest is kinda old, and I was still very new to trading back then (and still am, relatively speaking). I checked my spreadsheet and I don't seem to have factored in spread. Or if I did, it was done manually on a calculator before I punched in my individual trades into the spreadsheet.

    Lets assume spread wasn't factored in. The average stop loss for the USDJPY was 76 pips, according to my spreadsheet. If the average spread was 1.4 pips, then the cost per trade would be 1.4 / 76 = 1.84%. So you can subtract this % from our expected return per trade. For example, with risk:reward ratio of 1:3 and trading with the 21EMA trend, our expected return per trade would now be 19.79% - 1.84% = 17.95%. Hope this makes sense!

    The expected return per trade is in terms of pips only. The formula is win rate * win size (in pips) - lose rate * loss size (in pips). Position size (% of your account to risk) determines the $ you win or lose per pip. Maybe I should've clarified in the post, but yeah, expected return per trade is in terms of pips. What % of your account to risk is up to the trader. Again, I hope this makes sense! If you have anymore qs I'll try my best to answer.


  3. Hello Kevin

    Thanks for answering those questions for me. I have so far back tested the inside bar strategy with trailing stop for the last 2 years on EURUSD (Jan 2011 - Present). The results look quite good, but I am unsure if this is enough and will probably test it for a longer period like you have.

    From what you have said about you being new to trading, I assume you have perhaps gone on to test better strategies since then. I, like you, have spent hours testing strategies on the Forex market. I think that one of the main challenges is overcoming trading costs, but I believe this type of trading does that by being selective in the market.

    I wanted to ask though (since you have tested longer than I have), do you think inside bar breakouts are viable set ups for long term profits? I wish to go live soon, so I was wondering if you could give me the hard truths. (I have already found a much longer term strategy with brings 25% average annual returns with 8% average annual drawdowns, but the problem is that strategy holds positions for months).

    Thanks again


  4. Hey Ciaran. Are inside bars viable? I believe so. It helps if you take your questioning one level further, though. What do inside bars represent, for example? Since the range of an inside bar is less than its predecessor, an inside bar suggests falling volatility. But are there better ways of measuring volatility than looking for inside bars? When I was backtesting inside bars, I noticed there were small bars that seemed to trade well, but breached the high or low of the preceeding bar. While these smaller bars suggested falling volatility, they couldn't be classified as "inside bars".

    Additionally, there are inside bars that are only marginally smaller than preceeding bars. The fall in volatility would be unremarkable, but with an inside bar system, we'd be forced to trade them.

    That was when I decided to move on from inside bars and use Average True Range (ATR) to measure volatility. There's a blueprint of a system on this blog that uses ATR, called "Hermes". I'm still optimising this system but so far it's looking very profitable for a mechanical system.


  5. I have read the "Hermes" system and results look great. Its always good to see other mechanical systems working. I think that simple systems work better, but have to be smart (robust). I can see you have really thought about the way the behaves(I'm guessing you have spent lots of time in front of charts!). I manually back test, so sometimes when I do a 20 year of the EURUSD, it is like reading an old book! I think it is great to use the ATR, as not only does it help for spotting changes in volatility, it gives you a tool to adapt to the market, which IMO is one of the most overlooked concepts of a profitable strategy. (its frustrating to see strategies that say: "back tested 20 years of data for break out of fixed 20 pips with stop loss of 10". What ends up happening is that they optimise the values for that 20 year period and when they live trade it it will start to breakdown.

    Can I ask how long you have been trading for? I have been trading for 16 months now, and I have learnt so much since the beginning! I lost money on my first live account, but I am going live next year for the second time, with a completely different mind set. Get rich slow...

  6. I completely agree with what you said in your first paragraph. Ideally, a system should have rules that self-adjust to market conditions.

    I still consider myself a newbie trader. I've been learning forex since late last year, and began trading live for the first time back in Jan 2012? I bought a course on price action and lost a huge chunk of my account within a month, around 25%. I swore never to trade again until I designed a system that I had created for myself and thoroughly backtested it. I started trading live again in late August / early September? My account has remained in the green since then so I think I'm doing something right (so far!).

  7. Congratulations! I have been profitable on my demo account since April (that is when I changed my strategy). I plan to go live Jan 2013. So far I have been trading 2 bar high low breakouts. I stumbled across Inside Bars, and then realised that if I only took 2 bar breakouts with decreased volatility, I would have a lower risk entry with higher probability of success. I am still working on my exit strategy, as I think that personally it is better to ride the breakout until it turns (use a technical analysis based moving stop). I prefer this method, although I don't doubt that take profit targets could work even better.

    Good luck for the future! I am sure you will be able to maintain consistency. Keep it up!

    1. That's an interesting system, if I understand it correctly. So you enter on the break of the high or low of the last 2 bars? If so, I like the high frequency of trades that this system would generate.

  8. yes that is right. After this, we move to 15 min chart and place our stop at the nearest low (if it is a long position) or nearest high (if it is a short position). If a new high is broken (for long position) or a new low is broken for short position), we move our stop again to the next low/high. We continue to do this until we are stopped out. As you might imagine, we end up losing small losses most of the time, but occasionally (once or twice a month), we catch a very large trade which can bring us up to 10 times our initial risk. For example, during the summer there was a breakout on EURUSD in which I set an initial stop loss at 26 pips. This trade lasted 2 whole days without being stopped out even on the 15 min chart, and the end result was 210 pips profit. So I made 8 times my initial risk. There a problems with the strategy though:

    1. Although we effectively have an infinite profit potential, in order to catch these trades we have to endure a lot of losing periods.
    2. Since the strategy isn't picky about which breakouts to take, it ends up taking quite a lot of bad ones as well as good ones.
    3. I feel with this strategy that I am over trading, as the brokerage costs do begin to add up when trades are taken on most days.
    4. 15 min filter is great for limiting losses, however on this time frame you are very much affected by intra day volatility and it stop out some good entries too

    Possible solutions:

    1. Looking at a basic take profit exit strategy
    2. Filtering for good entries, such as Inside bars, double dojis (clues for decreasing volatility prior to breakout)
    3. Again, this would be solved with filtering
    4. Again, either basic take profit or using a higher time frame for moving stop

    Do you have any suggestions?

    One of the fantastic things about this strategy is, I tend to find that the periods where the the strategy doesn't work it still tends to produce about break even. I think this is because it is excellent at limiting losses on bad trades. Another thing I would say is that although most traders say "cutting losses short and letting profits run isn't classified as an edge". I would a agree with them in a sense, however if you think about it using that style of money management in a market like FX will most likely help your profits grow, just looking at a daily chart of a major pair over the last decade you can see how large the trends are. (a strong trend on a 15 min TF on a Daily chart will look like a strong breakout essentially, it will show a series of large bars one after the other) In essence, this is what I want to achieve. I am sure you have probably noticed that the big moves in the intraday charts tend to happen in a very short space of time (usually you will have a couple of large bars surrounded by smaller ones).

    1. Hi Ciaran. I meant to reply to you sooner!

      I have noticed that smaller timeframes provide potentially better R:R ratios. By focusing on the 15M TF, for example, you can provide a laser-like focus on your stop loss. Hitting 8:1 R:R in two days is very good, and quite difficult to achieve on larger timeframes in the same time period (2 days).

      It's been my observation that larger timeframes tend to be more range-friendly, which is probably why I drifted over to using fixed R:R ratios, rather than trailing stop losses. A fixed R:R can allow you to duck into a trade and grab some profit before the market turns. This is my preference, as it would allow for small but steady gains, and thus a smoother equity curve. The equity curve of a trend-following system, on the otherhand, may be slightly downward-sloping, puncuated by the occasional large spike where you hit a big R:R trade.

      I don't think either way is "better", but psychologically, I am more comfortable with using fixed R:R ratios. It's much easier to backtest and I can build a large sample size to build my confidence, and ideally I should make profit whether the market is ranging or trending. However, a trend-following strategy does technically allow you for infinite profit. :)

      Regarding suggestions, that's kinda difficult as I don't have much experience with the lower timeframes. What pairs do you focus on? I know that the AUDUSD has the most uniform volatility throughout the day since it is one of the most actively traded pair during the sleepy Asian session.

    2. I definitley agree with you, your equity curve will be smoother. I was going to ask though, if your trade is 1:3 risk reward and the price is nearly at your target do you still have your stop loss in its original position? It seems you would be quite exposed at that point, should a trade turn against you. However, you have done the back test and it has been succesful, so I guess it doesn't really matter.

      The difficulty I am having is deciding whether the 15 min filter is worth it in the long run. To be profitable in the long run, I may have to re enter trades serveral times on the same set up to ensure I catch the majority of the move. The problem with this is potentially "overtrading". I think that minimising the brokerage costs is one of the most important factors in trading. Any edge in a market tends to be a fairly small one, so to be exploited profitably it needs to have minimum costs.

      I have looked at Asian trading hours, however I live in Scotland so it isn't really feasible to trade on an intraday basis. I could however trade it if I was using your style of money management. I have back tested EURUSD inside bars with my MM from April 2010 to present. The total net profit was around 2000 pips after trading costs, with a profit factor of about 1.5 I think. I was harsh on the trading costs as well, I said basically 3 pips per trade, 1 for spread, 1 for slippage and 1 for swaps, even though I hardly ever carry trades overnight. The reason I couldn't go back further than April 2010 is the 15 min chart on MT4 doesn't have data previous to that. There were about 80 IB set ups in that time, and I took 180 trades (That includes re entering the breakout when stopped out).

      I was wondering if you could compare your results if you still have them. I know my sample size small but it would be good to see the differences.


    3. In my backtest, I kept my stop loss static so if price moved within a few pips of my profit target before reversing, I would lose the trade. In RL, though, I would most likely move it to breakeven.

      RE my results, according to my backtest on EURUSD from 2009 to 2011, if I traded inside bars and used a 1:2 risk:reward, my profit factor was 1.42. I don't believe this includes costs. And I'm kinda hesitant about trusting these results from so far back as they were from Go Market's MT4 feed (my previous broker). These days I use Forex Tester 2, which allows much clearer analysis than MT4. FT2 also provide 1M data for all the major pairs + crosses back to 2001. Since you're using MT4 to backtest, I recommend Forex Tester 2. It's around $200 (or less if you can find a discount code over the internet) but I see it as exchanging a future $200 loss for software today. Just my thoughts.

    4. Your profit factor of 1.42 is good, seems like a healthy margin. Mine is 1.59 after costs, but my sample size is small so that time period may have been favourable. However, I am pretty sure the results would have been even better for 2008, given that huge downtrend during the finanical crisis at the end of that year, there must have been a few great short positions off of inside bars then.

      I tended to manually back test and simply record paper results. I will consider getting a software platform for back testing as it is very time consuming to do it manually.

      What I do like about doing it manually is the confidence it gives me, since I am doing it myself I can be sure that the results are correct as long as I am honest about the hypothetical trades taken. I think that confidence in your strategy is probably one of the most important things to have, as it ensures you can stay disciplined during the drawdown periods, and for a trend follower like me, that is key! There is the nice side of it, where you have 8:1 ratio trades like I was talking about, but what I didn't mention was, I had a period where I had about 8 losses in a row!

      I try not to set too many goals for trading, as I don't really know what hand the market will show me. I just aim to manage risk well, and try to stay profitable. I don't think i'll ever actually do this as a full time job due to the lack of consistency in the gains. However, it is definitely a great long term savings option, and I plan to build up an account over the next 10 years or so.

      Good luck with your trading, let me know how it goes!


Note: Only a member of this blog may post a comment.