Actually I don’t know if this is the right section to ask this question, not even if this is the right forum for this kind of technical questions…
Anyway, this is my problem: I’m trying to code a simple backtester by myself, so that I can freely customize and tinker with it. But a problem came up when I considered how to test bar data instead of actual tick data: how can I in some way “extract” tick data from a OHLC bar?
Obviously I understand that it is not possible to obtain the actual tick data, but I wanted to obtain something that would in some way resemble true forex data, so to avoid biases in the backtesting results.
Could you describe an algorithm for doing this, or just tell me where to find about it?
Not sure if I understand your question but in MT4 for backtesting purposes they use the smallest time frame available (ideally 1 minute data). Many forex brokers offer 1 minute data, so if you want to have a better “tick data simulation” you should get 5 seconds or even 1 second data.
For the algorithm part you should ask this on MQL4 forums (or similar web sites) as this is a very technical problem. Remember that the quality of your backtesting depends on the quality of your data.
First of all I want to eliminate ambiguities by specifying what I mean by “[B]OHLC data[/B]” and “[B]tick data[/B]”:
-[B]OHLC data[/B]: history data relative to a specific timeframe; I call it “OHLC data” or “bar data” because it must tell the open, high, low and close prices of all timeframe units.
-[B]tick data[/B]: history data that contains information for each tick. Differently from OHLC data, it only specifies ask and bid prices (or just one of them, if the spread is known beforehand).
It is true that most history data available is in the form of OHLC data and that true tick data are more difficult to find, but this is the very reason of my question.
The fact is that backtesting softwares generally don’t use OHLC data directly, but they take this data and transform it into “simulated” tick data before the actual test.
It it is clear why this is necessary: if you only have the OHLC data for a test, how could you tell which ask and bid prices to use for your orders?
For example, MT4 has three models of backtesting: “Every tick”, “Control points” and “Open prices only”. The first two, when used with non-tick data, actually first generate tick data (saved in .fxt files), and then use it to perform the backtesting. “Open prices only” doesn’t take this step, and instead uses OHLC data directly. But this last method is very crude, as it is stated in MT4 itself.
Before asking this question I’ve done some research about how MT4’s built-in backtester addresses my problem, and I’ve found some information about it. It turns out that it somehow uses Elliott waves to simulate the tick data.
Anyway my problem is not MT4-related, even if certainly MT4 gives some interesting hints about its solution.
But I thought that just “copying” that idea without having a better picture and understanding of the possibilities wouldn’t be the best to do, so maybe I can get some help here.