New free code from MQL5: indicators, EAs, and scripts for traders.

Pending orders at the clicked price
| Action | Result |
|---|---|
| Ctrl + left click on the chart | Pending BUY at the price under the cursor (limit or stop, chosen automatically) |
| Shift + left click on the chart | Pending SELL at the price under the cursor (limit or stop, chosen automatically) |
| Key held, mouse moving | Crosshair previews the price and the order type |
| Price inside the broker's stops level | Order is not sent; a message is shown |
Strategy Tester and backtesting
The product can be tested in the MetaTrader 5 Strategy Tester in the following ways:
| Tester mode | Panel and tick chart | Demonstration rule | Typical use |
|---|---|---|---|
| Visual mode | Available (the DOM area is not available in the tester). Buttons can be clicked while the test runs. | On by default (input InpBtAuto); can be switched off to trade manually only. | Practise order handling on historical ticks at the speed you choose. |
| Non-visual mode | Not drawn (faster test). | On by default (input InpBtAuto). | Unattended test of order handling. |
| Optimisation | Not drawn. | On by default. Custom criterion from OnTester(): net profit relative to equity drawdown. | Compare input sets of the demonstration rule. |
| Live or demo chart | Fully available. | Never active. | Manual trading only. |
The demonstration rule waits for a number of consecutive ticks in one direction, opens one position with a fixed Stop Loss and Take Profit, and closes it by SL, TP or after a maximum holding time. Before each order it checks symbol trade mode, volume and free margin. It exists for testing and demonstration only and is not a recommendation to trade this rule. A session line on the chart shows closed trades, the share of winning trades and the net result since the start. For the most realistic result use the "Every tick based on real ticks" model. Tester results depend on tick quality, spreads, commissions, execution delay and broker conditions, and say nothing certain about future trading.
Input parameters
| Group | Parameter | Default | Description |
|---|---|---|---|
| Trading | InpLots | 0.01 | Default lot size |
| Trading | InpDeviation | 30 | Maximum slippage in points |
| Trading | InpMagic | 0 | Magic number (the demonstration rule uses this value + 1) |
| Trading | InpTPOn | false | Take Profit enabled at start |
| Trading | InpTPPoints | 50 | Take Profit distance in points |
| Trading | InpSLOn | false | Stop Loss enabled at start |
| Trading | InpSLPoints | 50 | Stop Loss distance in points |
| Trading | InpPendingClick | true | Ctrl/Shift + click places pending orders |
| Tick chart | InpTicksPerBar | 1 | Ticks per bar at start |
| Tick chart | InpMaxTicksPerBar | 4096 | Maximum ticks per bar for the + button |
| Tick chart | InpBarWidth | 2 | Width of each tick/bar in pixels |
| Tick chart | InpLineWidth | 2 | Line thickness in pixels |
| Tick chart | InpTimeMode | false | Time-scaled horizontal axis at start |
| Tick chart | InpPxPerSecond | 10.0 | Time mode: pixels per second |
| Tick chart | InpPadPercent | 5.0 | Vertical padding of the automatic zoom, in percent |
| Tick chart | InpSkipUnchanged | true | Ignore ticks where the BID did not change |
| Tick chart | InpPreloadTicks | 10000 | Ticks loaded from history at start (live charts) |
| DOM | InpDomShow | true | Show the DOM at start |
| DOM | InpDomWidthPct | 20 | DOM width in percent of the chart width (8 to 50) |
| DOM | InpDomRowsDefault | 10 | Rows (asks + bids) in the default and compact views |
| DOM | InpDomRowsDetail | 20 | Rows (asks + bids) in the detailed views |
| DOM | InpDomLowLots | 1.0 | Band lower limit in lots |
| DOM | InpDomMidLots | 10.0 | Band middle limit in lots |
| DOM | InpDomHighLots | 100.0 | Band upper limit in lots |
| DOM | InpDomVolDivisor | 100.0 | Feed volume units per lot (100 = 100 units is 1 lot; 0 = use contract size) |
| DOM | InpDomLineWidth | 2 | Thickness of the DOM level lines and diagonals in pixels |
| DOM | InpDomAutoResume | true | After a manual vertical zoom or pan, return to automatic zoom when a DOM line reaches the chart edge |
| DOM | InpDomFitScale | true | Automatic zoom covers the furthest displayed DOM lines |
| Display | InpDarkMode | true | Dark mode at start |
| Display | InpShowBidAsk | true | Show BID and ASK lines |
| Display | InpBidAskWidth | 2 | BID and ASK line thickness in pixels |
| Display | InpShowLevels | true | Show positions, pending orders, SL and TP |
| Display | InpColUp / InpColDown | green / red | Up and down colours (also DOM bids and asks) |
| Display | InpColBid | green | BID line and label colour (fixed) |
| Display | InpColAsk | red | ASK line and label colour |
| Display | InpColBuyLevel / InpColSellLevel | blue / orange | Buy and sell level colours |
| Display | InpRenderMs | 15 | Chart refresh interval in milliseconds |
| Backtest | InpBtAuto | true | Run the demonstration rule in the Strategy Tester (never on live charts) |
| Backtest | InpBtTicks | 4 | Entry: consecutive ticks in one direction |
| Backtest | InpBtTP | 40 | Take Profit in points |
| Backtest | InpBtSL | 60 | Stop Loss in points |
| Backtest | InpBtMaxSpread | 0 | Maximum spread to enter, in points (0 = off) |
| Backtest | InpBtMaxHoldSec | 60 | Close the position after N seconds (0 = off) |
| Backtest | InpBtCooldownSec | 10 | Pause after each entry in seconds |
How to start
- Attach the product to the chart of the symbol you trade.
- Allow Algo Trading in the terminal and on the product's Common tab.
- Set the lot size in the panel and use the buttons.
- Move the mouse over the word "Info" in the panel for a list of mouse actions.
Requirements and notes
- MetaTrader 5, hedging or netting accounts.
- The DOM needs a depth-of-market feed from your broker for the symbol (many brokers provide it only for some instruments).
- Works on the symbol of the chart it is attached to; position and order handling is for that symbol only.
- The product uses the chart area for its own drawing. Your original chart settings (chart type, grid, scales, colours, trade history display) are restored when the product is removed.
Risk warning
Trading leveraged products involves a high risk of loss. This product is a tool for order handling and chart display. It does not make trading decisions on live or demo accounts and does not promise or imply any profit. Test on a demo account first.
Grid trading done right – try the robust Grid Expert Advisor for controlled risk. Details here.
Support
Please use the comments section of this product page or MQL5 private messages. Include the product version (shown at the top of the chart), your terminal build and your broker's symbol name.
Build better strategies with RobotFX professional tools – check them out.
79151