Forex Expert Advisor Generator: Set the Bar Count and the Pip First
A forex expert advisor generator writes MQL5 only after the bar and the price unit are already named. Twenty completed daily bars are not twenty hourly bars, and on a five-decimal EURUSD quote one point is 0.00001 while a 0.0001 pip is ten points. Pineify can draft that MQ5, and you still compile it in MetaEditor and test it on the broker symbol.
How Pineify Helps
State the bar size, the pip-to-point rule, and the session before you ask for code. Pineify drafts and revises the MQ5 for those forex rules. Download it, read the diagnostics, compile in MetaEditor, and test in MT5. Strategy Optimizer and Backtest Deep Report are TradingView workflows. They do not check this MT5 expert advisor.
Start with a specification that distinguishes time and price
"Buy a 20-day breakout on an hourly chart" is incomplete. The lookback could mean 20 daily bars or 20 hourly bars, and the trigger could be an intrabar price crossing or a completed hourly close. Specify these choices before asking for an implementation.
- For an illustrative test, define the reference as the highest high of the previous 20 completed broker daily bars, excluding the current daily bar.
- Define the signal as a completed H1 close above that reference and state when a request may first be sent. Record the broker daily-bar boundary and time zone.
- Specify one-entry-per-signal behavior, treatment of an existing position and whether an opposite signal exits or reverses it. This example makes no performance claim.
Make forex-specific assumptions explicit
State which broker symbol and account currency the EA uses. Price precision, contract size, volume step, spread and financing affect behavior and cost. A pip distance in a description must be mapped correctly to that symbol; do not substitute points without checking the convention.
- For a conventional five-decimal EURUSD quote, one point is 0.00001 and a 0.0001 pip is ten points. This convention is not a universal definition for metals or indices.
- Specify sizing and the assumed loss per unit at the planned exit. Include the applicable currency conversion and volume rounding.
- State session time zone and daylight-saving treatment. Decide what the EA should do when data or trade permission is unavailable.
- A stop level is an instruction, not a guaranteed loss cap. Gaps, rejected orders and costs can change realized loss.
Check the 20-bar rule and the pip inside the MQ5
Pineify returns editable MQ5, so you can see whether the lookback is the previous 20 completed daily bars and whether a 0.0001 pip was coded as ten points on a five-decimal quote. Other software may give you source or only an EX4 or EX5. MQL5 Market products are compiled EX4 and EX5 files. You can test them and read documented inputs, but you cannot inspect a pip mapping that the source does not show. An accepted request is still not a completed fill.
- Keep the specification, including the daily-bar boundary and the pip-to-point rule, with that MQ5 version. Read the conditions instead of a comment that says 20-day breakout.
- Compile in MetaEditor. Ask for a correction when the diagnostic or the chart disagrees with the H1 close or the point size.
- Read the broker return code and the account state. A signal on the pair does not prove the order filled.
Test the frozen daily-bar and pip rules before adding filters
In a visual MT5 test, confirm the order waits for a completed H1 close above the highest high of the previous 20 completed daily bars, that a second signal does not add another entry, and that the exit matches the spec. Save the dates, tick mode, costs, account, and MQ5 version. Then run those same pip and bar rules on a wider window and on a later window you did not use to choose them. No standard two-year history or 30-day demo makes the expert advisor reliable.
- If you add a confirmation filter after inspecting losses, record that as a new research choice. It is not evidence that the original strategy was simply implemented incorrectly.
- Use MT5 for EA parameter search. Searching more settings can increase selection bias; optimization does not automatically reduce overfitting.
- Keep historical, demo-account and live results separate. An observed difference does not identify its cause without order and cost comparisons.
- A separately written Pine Script version has different data and execution assumptions. Matching a few signals is not proof of equivalent behavior.
This page is educational and does not provide investment advice. Examples describe test requirements, not proven strategies. Automated trading can result in substantial loss.