This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Tick Forge
Build custom backtesting symbols in MetaTrader 5 from **your broker's own history**:
shift the timestamps, rescale or reshape the prices with a typed function, and test your
Expert Advisor on the result in the normal Strategy Tester.
Free and open source (MIT). No DLL. No internet access. It reads your terminal's downloaded
history and writes one custom symbol - nothing else.
## Why
An EA that works on one stretch of price history may only work because of that stretch's
price level, volatility or calendar. Tick Forge lets you ask the question directly:
- *Does it still work if the same market is 6 hours earlier or 3 days later?* (time offset)
- *Does it still work if gold costs 1,000 instead of 4,000?* (price scale)
- *What if the moves were twice as big, or the trend ramped up over the period?* (price function)
Run the original and the changed data side by side. If the result only exists on the original
data, you have learned something before it cost you money.
## Quick start
1. Install (below), attach **Tick Forge** to a chart.
2. Pick a source symbol. Leave the name (`<symbol>_TF`) or type your own.
3. Pick a date range (or **Use full range**), a data type, a time offset and a price function. Press **Preview**.
4. Press **GENERATE SYMBOL**. When it says DONE, the symbol is in Market Watch (group "Tick Forge").
5. In the Strategy Tester choose the new symbol. Real-tick data pairs with the model *Every tick based on real ticks*,
M1-only data with *Every tick* / *1 minute OHLC* / *Open prices only*.
Do a **control run first**: generate with function `p` and offset 0, test your EA on it, and only then test the changed
data. Differences are then caused by your change, not by the pipeline.
## Install
**From the MQL5 Market:** install the free product, then drag **Tick Forge** from the Navigator onto a chart.
**From source:**
1. Copy `Tick_Forge.mq5`, `TF_Engine.mqh` and `TF_Expr.mqh` into one folder under
`MQL5\Experts\Tick_Forge\` of your terminal (File > Open Data Folder).
(`market/Tick_Forge.mq5` is the same program as one file with the two headers inlined; that is what the Market compiles.)
2. Compile `Tick_Forge.mq5` in MetaEditor (F7).
3. Drag **Tick Forge** from the Navigator onto any chart. It is a utility Expert: it never trades,
so AutoTrading can stay off. (MetaTrader's window library only works in Experts and indicators,
which is why it is not a script.) Closing the window removes it from the chart.
The window needs a chart of at least about 1070 x 640 pixels; if the chart is smaller you get a message on the chart.
It does nothing when loaded in the Strategy Tester.
**Close MetaTrader normally** after generating (File > Exit, not a task kill): the terminal saves the list of custom
symbols on a normal exit.
## Using the window
| Field | What it does |
|---|---|
| Source symbol | Any symbol in your Market Watch. Its history is the raw material. |
| Custom symbol name | Name of the symbol to create. An existing *custom* symbol asks before it is overwritten. A real broker symbol is refused. |
| Broker data available | First and last M1 bar your broker serves. "Scan tick availability" lists the months that have ticks. |
| From / to | Date range (inclusive). "Use full range" fills the whole M1 history. |
| Data type | **Real ticks**: every broker tick is transformed and written, M1 bars are rebuilt from them. Use with the tester model "Every tick based on real ticks". **M1 bars only**: the tester synthesizes ticks (models "Every tick", "1 minute OHLC", "Open prices only"). |
| Time offset | Moves the raw timestamps by hours or days. Weekends and sessions move with the data (the clock is shifted, not re-aligned). |
| Price function | The new price as a function of the old one. See below. |
| Spread follows the price factor | Spread is multiplied by the same factor as the price, so the relative trading cost stays the same. Untick to keep the broker's absolute spread. |
| Add digits when prices shrink | If prices become much smaller, digits and tick size are increased so the spread is still resolvable. |
| Preview button | Draws the whole date range: the source prices on top, the result below (after the time shift and the function), each on its own price axis, with dates along the bottom. Check the shape before generating. |
| Bars / Ticks stored in | Where the generated data sits on disk (read-only fields you can copy). |