How to backtest forex?

Fish

Member
Messages
79
Likes
3
I want to backtest a strategy in Forex, but am not quite sure about how to go about it. There are a number of ways that spring to mind.

1. Export data to Excel and analyse it by means of self written functions ( could be difficult to construct the correct functions, and may well be reinventing the wheel)
2. Get some charts for the last 3 months or so and visually mark exits and entries, and take a note of profit/loss in Excel or
3. use some form of Platform Strategy tester such as the one in MT4 (which I guess means you need to be able to code your strategy into an expert, and understand how to write in MQL).

Before I go down any of these routes, has anyone any pointers/experiences that I should bear in mind? or any preferences as to which route to take? and how far back would provide a representative sample? Are there any handy references anywhere that explain in simple language how to write in the MT4 language?
 
Last edited:
I've exported the data into Excel, but suspect that the pattern recognition functions are difficult to mimic. Which looks like it leaves options 2 or 3.

Are there any good sources on the web for describing the use of the MT4 language?
 
Forget backtesting in MT4. It is quite useless and will lead you to think that you will be a millionaire in weeks.

Can't comment on other platforms like Tradestation or e-Signal.

G-Man
 
Fish said:
I want to backtest a strategy in Forex, but am not quite sure about how to go about it. There are a number of ways that spring to mind.

QUOTE]

Which ever method you use split the data in half, develop a strategy on one and test on the other half. Never ever develop and test on the same set of data.

Never miss out the spread. There are fantastic results to be had if you do this and you will waste time. (Slippage on forex is not so bad as equities, I ignore it ).

Keep the original data safe, get it from a good source. Ideally get the data from whoever you are going to trade with so you know their prices. Yahoo, Dukascopy and Oanda are all different.
Don't mess with it.

Think about how you are going to apply this, if it is an api then learn to program in a language that will let you use that api and back test with the same code.
 
Backtesting in MT4 is not useless, you just have to know the limitations of the system (of which there are a few). Obvously any system which makes billions is exploiting flaws in the MT4 backtester.
 
you need at least a couple of hundreds trades to make any backtest trustworthy, depends on the time frame you trade, that could mean a few year's reliable historical data to find.

then write a program that tests the trades for you. if you use MT4, make sure that you test with "open prices" only. then manually check every trade the program has done for you.

then you should forward test your system for at least a couple of months. open 2 or 3 demo accounts with different brokers, let the program test trading your system for you.

if you can't find any broker that supports your program, you have to do this manually,

make sure you don't miss any trades. design a alarm/notification system that helps you to do this. for example, let your trading program test you or dial your mobile phone when there is a signal.

if your tradig system is well designed, its signals and money management method should be programmable. a testing program could make backtsting a lot easier. but even if you use a program to backtest, you still have to manually check every trade. find out the common features of your most profitable winning trades. that's the most important thing of backtesting.
 
I don't know how to code an EA for MT4, but there's a great EA called VHands which allows you to replay market action! Basically, you download the data for the pair, in the timeframe you want, and then control the speed of action. You can pause the data and put indicators on the chart as usual.

I've only been playing with it for a few weeks, but to download it and find out all the info you need, follow this link:

VHands Trading Simulator

This is the best way of backtesting any trading strategy, as you can play out market action as though were watching it for the first time. Takes away all the bias of looking at a completed chart and saying 'oh yeah, i'd have got in there and exited there'.

Have fun!
 
you can also test your strategies in ninja trader, the program has a "strategy wizard" that makes coding really simple.
 
I think it's also worth taking a look at TradeStation, since you can now backtest the fx market with them and develop using Easylanguage...
 
I have just started to use a program called Forex Tester. If you search the web you will find it no problem. Cost for the professional package is $85, this also provides you with data to test. Check it out it may meet your needs.

Cheers

Nut
 
testing something on historical, static data may prove to yield slightly different results than initially expected, as to when you run your strategy in real time with moving prices.

In my experiences you need to have realizations first of how the market really acts so you can identify commonalities in price behaviors, patterns and structure. you will only get this from putting in the relevant screen time. if you cant do this then i would suggest you get some sort of simulator where you can reply the markets action at your own time.

once you start having realizations you will gain a certain knowledge and understanding to identify specific setups which present themselves over and over and over again, from here, you are probably in the best position to test your ideas and strategies.

identify a setup, test the setup on various periods of data, have a large enough sample size, run the strategy in real time, review the outcome, analyze the initial idea, implement your conclusions. then start this process all over again with your new found beliefs.

this is how you should go about back testing,

excel is good for statistical analysis, e.g finding out the average daily range of a currency pair, months that close higher on aggregate, etc.......

but the real testing is done when you run forwards. good luck
 
Hi
when I am doing the beck test so the modelling quality is not coming s 90% could some one guide me that how can I make it 90% I am using meta trader 4 platform
 
Actually, i find the "If" function on spreadsheet is very good way to backtest any system, as long as you have the past data. I have done some back-testing on Forex, doing forward testing now, which I post my calls in my blog.
 
eSignal On Demand

You can use eSignal On Demand to Back Test Forex and for charting. Comes with the software and Forex data plus covers stocks and futures all for one low price.

eSignal OnDemand

Chuck
 
Go to Youtube.com and type in this question! You will find some very nice guides.
 
When you backtest your system (or EA) do not forget this.
1.Borders between markets (day trading)
2.Financial news, holidays.
3.Break between Fri-Sun ( your indicators doesn't know it and will give you false results)
That's way bucktest results so far away from reality.
As A protrader i can recommend FOREX ROBOT REVIVER learnig soft concern not only ea but strategy.

Artforextrading team
 
Actually, i find the "If" function on spreadsheet is very good way to backtest any system, as long as you have the past data. I have done some back-testing on Forex, doing forward testing now, which I post my calls in my blog.

Hi Hiei, I was just wondering if you could explain how you construct your spreadsheet for a back-test? I can generate the buy/sell signals according to rules, but am having a little trouble in calculating the P/L according to the signals. Could you please advise?

Thanks.
 
Top