This is the fourth part of a series. Part 1 tests whether an incremental calculation matches a calculation from scratch. Part 2 measures how much history a recursive indicator needs. Part 3 checks that the value of a closed bar never changes when later bars arrive. Those three parts make sure the signal is right. This part tests what happens next: the Expert Advisor that consumes the signal has to turn it into a trade request, and a request that is wrong in a small detail is refused by the server. The usual refusals are 10016 (invalid stops), 10014 (invalid volume) and the close errors 10036 , 10038 and 10025 .
Indicators cannot call trade functions, so this part is an Expert Advisor. It does not need an indicator to test: it tests the order layer that every indicator-driven EA depends on, and it does it as a regression suite. The same 20 requests are built from the current symbol rules and checked with OrderCheck() , which validates a request on the server without sending it. No order is placed, no position is opened, closed or modified.
Every row has a prediction that comes from the documented rules and not from the server:
The verdict of a row compares the retcode of OrderCheck() with the prediction:
| Verdict | Meaning |
|---|---|
| PASS | A valid request was accepted (retcode 0 or 10009), or an invalid request was refused with one of the listed codes. |
| FAIL | A valid request was refused, an invalid request was accepted, or it was refused with a different code than predicted. Either your request builder or the server rules changed. |
| INCONCLUSIVE | The server could not judge the request: market closed (10018), trading disabled (10017), no money (10019), no quotes (10021), too many requests (10024), algo trading disabled (10026, 10027), frozen (10029) or no connection (10031). The row is neither good nor bad. |
| n/a | The row cannot be built for this symbol or account, for example the inside-the-limit rows when the stops level is 0, or the close rows when there is no open position. n/a rows are never counted as a pass. |
The 20 rows are fixed:
| # | Row | Prediction | What it catches |
|---|---|---|---|
| 1-2 | BUY and SELL market, no stops | accept | Controls. If these fail, the other rows say nothing (filling mode, account, symbol). |
| 3-6 | BUY SL, BUY TP, SELL SL, SELL TP exactly at the stops level | accept | Code that adds a safety point, or a server that treats the level as exclusive. |
| 7-10 | The same four stops one point inside the stops level | 10016 | Code that rounds the distance in the wrong direction. n/a when the stops level is 0. |
| 11-12 | BUY SL above the price, SELL SL below the price | 10016 | Swapped Bid and Ask, or a swapped sign for the order direction. |
| 13-15 | Volume below the minimum, above the maximum, off the step grid | 10014 | Lot normalization that is missing or uses the wrong step. Row 15 is n/a when the step is 0. |
| 16 | Close the position, full volume | accept | Control for the close path (opposite order type, position ticket, opposite price). |
| 17 | Close a volume larger than the position | 10038 or 10014 | Partial close arithmetic that is not limited to the open volume. |
| 18 | Close a ticket that does not exist | 10036 or 10013 | Stale tickets after the position was already closed. |
| 19 | Modify with the current stop loss and take profit | 10025 | Trailing code that sends a modification on every tick. |
| 20 | Modify with the stop loss on the wrong side | 10016 | Trailing code that moves the stop to the wrong side of the price. |

Fig. 1. Example result of a run in which the server refuses stops placed exactly at the stops level: rows 3 to 6 are FAIL (white), all other rows PASS, and the digest differs from the baseline. The dashed and dotted lines are the four stops-level limits. Black and white screenshot, per the Code Base image guidelines.
| Input | Default | Purpose |
|---|---|---|
| InpSymbol | "" (chart symbol) | Symbol to test. The symbol is added to Market Watch if needed. |
| InpVolume | 0.0 | Base volume in lots for the rows that need a valid volume. 0 uses the symbol minimum. A value is moved onto the volume grid and limited to the minimum and maximum. |
| InpUsePosition | true | Use an open position for the close and modify rows (rows 16, 17, 19, 20). When false these rows are n/a. The position is only read. |
| InpPositionMagic | -1 | Only use a position with this magic number. -1 uses the first position of the symbol. |
| InpFallbackStopPoints | 50 | Distance in points used by the "at the limit" rows when the stops level is 0 (dynamic stops level). The "inside" rows are n/a in that case. |
| InpWrongSidePoints | 100 | How far the wrong-side stops of rows 11, 12 and 20 are placed from the price. |
| InpRunOnStart | true | Run the matrix when the EA starts (as soon as the symbol has quotes). When false it waits for the R key. |
| InpAutoRepeatSec | 0 | Repeat the matrix every N seconds. 0 turns it off, values from 1 to 4 are raised to 5. |
| InpLogResults | true | Print every row and the summary to the Experts journal. |
| InpBaselineDigest | "" (off) | Digest of a known-good run. The panel shows MATCH or CHANGED against it. Case is ignored. |
| InpShowPanel | true | Show the result panel. |
| InpShowLevels | true | Draw the four stops-level lines on the chart. |
| InpTextColor | clrSilver | Panel text color. |
| InpFailColor | clrWhite | Color of FAIL rows and of a failing summary line. Set it to a red color if you do not need black and white. |
| InpFontSize | 8 | Panel font size (Consolas). The line height follows the size. |
| InpPanelX , InpPanelY | 8, 14 | Panel offset from the upper left corner of the chart, in pixels. |
Trailing Stop and Break-Even Manager (points or ATR)
Utility EA that moves the stop loss of positions you already have open: break-even with locked profit and trailing stop in points or ATR. It never opens trades.
Close All at Total Profit or Loss (money)
Utility EA that closes all positions (and optionally deletes pending orders) when the total floating profit reaches your target or the total floating loss reaches your limit, in account currency. It never opens trades.
Accelerator Oscillator (AC)
The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.
MACD Signals
Indicator edition for new platform.