NextGen Premium
- Эксперты
- Версия: 1.2
- Активации: 5
NextGen Premium is a fully automatic Expert Advisor built around a two-sided pending order grid. It uses no indicators and makes no attempt to forecast direction. Instead it keeps a ladder of Buy Stop orders above the market and a ladder of Sell Stop orders below the market at all times, so it is ready to join a move in either direction the moment price travels far enough to reach a level.
The EA was developed and tested on Gold (XAUUSD). All grid distances are entered in price units, so the default values match the price scale of gold.
What the EA does well
- No forecasting. There is no indicator, no trend filter and no market condition in which the EA has to guess. Price either reaches a level or it does not.
- Exact, repeatable spacing. Each side keeps a fixed price lattice. Every level the EA can ever use is a whole number of grid steps from that lattice, so the distance between consecutive entries stays exact even after the grid has been moved many times.
- One position per direction. As soon as an order fills, the rest of that side's pending orders are removed. There is no averaging down and no lot increase after a loss.
- The grid follows the market. Two independent rules move an idle grid back into range instead of leaving it stranded far from price.
- Risk stated in money, not points. The stop loss and the trailing stop are entered in account currency and scale automatically with position size, so the same settings behave the same way on a small account and a large one.
- Survives restarts. Changing the timeframe or the settings does not disturb live orders. The EA detects the orders already on the server, recovers the grid spacing from them and carries on.
- You stay in control. Daily limits, a weekend filter and a one-click CLOSE ALL button are all built in.
How the EA works
1. The two grids
On startup the EA places a set of Buy Stop orders above the market and a set of Sell Stop orders below it. The first order of each side sits at a chosen distance from the current price, and the remaining orders follow at a fixed step. Both sides are live at the same time, all the time.
2. The price lattice
When a side is laid for the first time, the EA fixes a lattice origin for that side. From then on every level it uses is that origin plus a whole number of grid steps. When the grid is moved, the EA can only choose which level to start from; it can never place an order at a price in between. This is what keeps the distance between two consecutive entries exact, no matter how many times the grid has been re-laid.
If the broker's minimum stop distance makes the requested starting level impossible, the EA moves to the next valid level on the same lattice rather than inventing a closer price.
3. When an order fills
The moment a pending order becomes a position, the remaining pending orders on that side are removed. That side now holds one trade and nothing else. The opposite side is untouched and stays armed.
4. Refresh after a loss recovers
An open trade that goes against you leaves the opposite grid sitting where it was. This rule brings it back.
The EA watches the floating loss of each open trade. When a trade has been deeper in loss than the trigger amount and then recovers back up to that amount, the opposite grid is deleted and re-laid starting at a set offset from that trade's own entry price. The losing trade itself is not touched and keeps its normal stop loss.
The trigger is the recovery, not the level. A trade that simply sinks past the trigger amount refreshes nothing, and a trade sitting quietly below it refreshes nothing. Each trade is entitled to one refresh of its own.
5. Refresh after a reversal
This second rule covers the case where one side holds a trade and the other side holds none. The EA remembers the price at which the empty side last closed a position and uses it as a reference. Each time the market travels a set distance further away from that reference, the empty side's grid is re-laid from the current market and the reference moves forward to the new price.
Because the reference moves forward each time, a long run in one direction keeps pulling the opposite grid along with it, instead of firing once and then falling behind.
6. When refreshing stops
While both sides hold an open trade, nothing is refreshed and no new order is placed between the two positions. The same applies while both sides are open and both are in floating loss. A trigger that occurs during this pause is not discarded; it can still act once the pause ends, for example after one side has been closed by its stop loss.
7. Closing a trade
Two rules close positions.
- Stop loss. A position is closed when its floating loss reaches the configured amount for its size. The loss is read from the broker's own figure for that position, so a delayed fill, a restart or a rejected close cannot shift the level. A rejected close is retried on the following ticks rather than abandoned.
- Trailing stop. Once floating profit reaches the activation amount, the EA records the highest profit the position has reached and closes it as soon as profit gives back the chosen amount from that peak.
Both are handled inside the EA, so no stop loss line is sent to the broker's server.
8. Daily limits
At the start of each trading day the EA records account equity. If equity then falls by the chosen percentage, or rises by the chosen percentage, trading stops for the rest of that day: pending orders are removed and losing positions are closed, while positions already in profit are left to the trailing stop. Everything resets at the start of the next day.
9. Weekend filter
At a chosen time on Friday the EA removes all pending orders, closes all positions and stops trading until a chosen time on Monday. A short lead time can be set so the closing routine starts a few minutes early and the account is already flat when the stated time arrives.
The schedule is calculated from GMT with a fixed offset that you set yourself, so neither the broker's server time zone nor the clock of your VPS affects it.
10. Restarts, timeframe changes and settings changes
If you change the chart timeframe or edit the inputs, the EA does not wipe the grid. It detects the orders still on the server, recovers the lattice spacing and the base lot from them, and continues. Pending orders are only deleted when the EA is genuinely removed from the chart.
On-chart panel and manual control
A compact panel in the top left corner shows, at a glance:
- Market mode and session
- Number of pending orders on the buy side and the sell side
- Number of open trades
- Running floating profit or loss
- Current spread
- Whether algorithmic trading is actually enabled in your terminal
A CLOSE ALL button sits in the top right corner. One click deletes every pending order of the EA, closes every position of the EA on that symbol, retries anything the server rejects, reports anything it could not remove, and then unloads the EA from the chart.
Requirements and recommendations
- Symbol: Gold (XAUUSD) is recommended. The default distances are matched to the price scale of gold. The EA will run on any instrument, but on instruments priced differently the distance inputs must be adjusted to that instrument's own price scale.
- Timeframe: any. The EA works from ticks and does not read bar data to decide entries.
- Account type: a hedging account is required, because both sides can hold a position at the same time. A low, stable spread matters more than anything else for this strategy.
- Always-on terminal: the stop loss, the trailing stop, the daily limits and the weekend filter all live inside the EA. They only work while the terminal is running, so a VPS is strongly recommended.
- Deposit: size the account around the stop loss, not around the lot. See the risk section below.
- Multiple charts: give each instance a different magic number.
Getting started
- Attach the EA to an XAUUSD chart on any timeframe and enable algorithmic trading.
- Check the panel: the Bot line must read Active, and Pending B/S should show orders on both sides within a few seconds.
- Set the GMT offset so the Friday and Monday times match your own time zone.
- Set the lot size, or enable dynamic lot and set the balance per lot step.
- Set the stop loss amount to a share of your balance you are comfortable losing on a single trade.
- Run it on a demo account with your own broker for at least a week before going live. Spread and execution differ between brokers, and this strategy is sensitive to both.
Suggested starting points
| Parameter | Lower risk | As shipped | Wider grid |
| UseDynamicLot | false | true | true |
| BalancePerLotStep | — | 500 | 2500 |
| StopLossDollars | 25 | 50 | 50 |
| GridStepDollars | 10 | 10 | 15 |
| InitialOrderDistance | 1 | 1 | 2 |
| ReversalRefreshDistance | 5 | 5 | 8 |
| DailyLossPct | 10 | 50 | 20 |
These are starting points for your own testing, not recommendations. Optimise them against your own broker's history.
Input parameters
General settings
| Parameter | Default | Description |
| MagicNumber | 20251113 | Identification number written to every order and position of this EA. Use a different value on each chart so instances do not manage each other's trades. |
| ShowVerboseLogs | true | Writes detailed messages to the Experts journal: every grid build, refresh, stop loss and trailing close. Switch off for a quieter log. |
Lot size settings
| Parameter | Default | Description |
| LotSize | 0.01 | Base lot size. It is also the size of one increment when dynamic lot is enabled. |
| UseDynamicLot | true | Grows the base lot with account balance. When switched off the EA always trades LotSize. |
| BalancePerLotStep | 500.0 | Balance needed for one lot increment. Base lot equals LotSize multiplied by the whole number of steps contained in the balance, with a minimum of one step. With a lot size of 0.01 and a step of 500: a balance below 1000 trades 0.01, a balance of 1000 trades 0.02, a balance of 1500 trades 0.03. |
Stop loss settings
| Parameter | Default | Description |
| UseDollarSL | true | Enables the money-based stop loss. |
| StopLossDollars | 50.0 | Loss in account currency, per 0.01 lot, at which a position is closed. The amount scales with the traded volume, so a 0.02 lot position closes at twice this figure. |
Trailing stop settings
| Parameter | Default | Description |
| UseTrailingStop | true | Enables the money-based trailing stop. |
| TrailingStartDollars | 9.3 | Floating profit in account currency at which trailing becomes active for that position. |
| TrailingStopDollars | 0.2 | How much profit a position may give back from its highest point before it is closed. A small value takes profit quickly; a larger value gives the trade more room to continue. |
Risk management
| Parameter | Default | Description |
| UseDailyLossLimit | true | Enables the daily loss limit. |
| UseDailyProfitLimit | true | Enables the daily profit limit. |
| DailyLossPct | 50.0 | Fall in equity, in percent of the equity recorded at the start of the trading day, that stops trading for the rest of that day. |
| DailyProfitPct | 10000.0 | Rise in equity, in percent of the equity recorded at the start of the trading day, that stops trading for the rest of that day. The default is deliberately unreachable, which leaves the limit effectively off until you set a figure of your own. |
Pending order and grid settings
| Parameter | Default | Description |
| GridStepDollars | 10.0 | Distance in price between two neighbouring grid levels, and therefore the distance between two consecutive entries on the same side. |
| InitialOrderDistance | 1.0 | Distance in price from the current market to the first order of a newly laid grid. If the broker's minimum stop distance is larger, the EA starts at the next valid level instead. |
| PendingOrdersPerSide | 5 | How many pending orders are kept on each side. |
| PendingRefreshDistance | 3.0 | Distance in price from a losing trade's entry at which the opposite grid starts when that trade triggers a refresh. |
| RefreshTriggerLoss | 1.0 | Floating loss in account currency that arms a refresh. The refresh happens on the tick where the loss, having been deeper than this figure, recovers back to it. |
| ReversalRefreshDistance | 5.0 | Distance in price the market must travel away from the empty side's last closing level before that side's grid is re-laid at the current market. Each further move of the same distance re-lays it again. |
| OrdersPerBatch | 25 | Number of orders in one lot batch. Each further batch adds one LotSize increment to the order volume. Keep this larger than PendingOrdersPerSide if you want every order in the grid to be the same size. |
| MaxOpenTradesPerDir | 10 | Upper limit on orders and positions per direction. Because a side holding an open trade carries no pending orders, the practical limit is one open position per direction. |
Weekend restriction settings
| Parameter | Default | Description |
| UseWeekendFilter | true | Enables the weekend stop. |
| FridayStopTime | 23:00 | Time on Friday, in HH:MM, at which the EA goes flat and stops trading. |
| MondayResumeTime | 05:00 | Time on Monday, in HH:MM, at which trading resumes and a fresh grid is laid. |
| TimeZoneGMTOffset | 5 | Offset in hours from GMT applied to the two times above. The schedule ignores both the broker's server time zone and the local computer clock. |
| PreShutdownMinutes | 1 | How many minutes before the Friday stop time the closing routine begins, so the account is already flat at the stated time. |
Risk information
Please read this before buying.
The stop loss is not on the server. The stop loss and the trailing stop are calculated and executed by the Expert Advisor. If your terminal is closed or loses its connection, open positions are unprotected until it is running again. Use a VPS.
The default settings risk about ten percent of balance per trade. The base lot grows by one increment for every 500 of balance, and the money stop loss grows with the lot at the same rate, so the two move together at every account size:
| Balance | Base lot | Stop loss per trade | Share of balance |
| 500 | 0.01 | 50 | 10% |
| 1 000 | 0.02 | 100 | 10% |
| 5 000 | 0.10 | 500 | 10% |
Both sides can hold a position at the same time, so twice that figure can be exposed at once. If you want a smaller share of the account at risk per trade, raise BalancePerLotStep, lower StopLossDollars, or switch dynamic lot off and choose a fixed lot.
The profit target is much smaller than the stop. With the shipped settings a winning trade is closed after a modest gain while a losing trade is allowed to run to the full stop. That combination needs a high proportion of winning trades to stay ahead, and a single stop-out cancels several wins. Test it long enough to see that pattern for yourself before committing real money.
General. Trading carries risk of loss. Results obtained on historical data do not guarantee future results. Test in the Strategy Tester, then on a demo account with your own broker, before using real money.
Questions and answers
Does the EA use martingale or grid averaging?
No. It holds at most one position per direction and never increases lot size after a loss. The lot only changes when account balance crosses a step, and only if you enable dynamic lot.
Why can I not see a stop loss line on the chart?
The stop loss is measured in money and executed by the EA, so nothing is sent to the broker as an order-level stop. The journal records every stop loss close with the amount.
Can I run it on pairs other than gold?
Yes, but the distance inputs are entered in price units and the defaults are matched to gold's price scale. On an instrument priced very differently you must scale those inputs to that instrument before the grid can work.
What happens if I change the timeframe or edit a setting?
Nothing is lost. Live pending orders stay on the server, and the EA recovers the grid spacing from them and continues.
Can I run several instances?
Yes. Give each chart a different magic number so they do not manage each other's orders.
How do I stop everything immediately?
Click CLOSE ALL. It removes every pending order, closes every position of the EA on that symbol and unloads the EA from the chart.
What deposit do I need?
Work backwards from the stop loss. Decide the largest single loss you accept as a share of your balance, then set StopLossDollars and the lot to match. The table in the risk section shows what the shipped defaults imply.
Support
If you have a question about the settings, or want help choosing values for your broker, send me a private message through my MQL5 profile. Please include your broker name, account type and the symbol you are trading, and I will reply as quickly as I can.
