Grid Ultimate Oscillator EA
- Experts
-
AL MOOSAWI ABDULLAH JAFFER BAQER
To trade successfully we need to go through the proven path that others had gone and reached!
Here are 17 quotes from such successful investors:
1- Limit your size in any position so that fear does not become the prevailing instinct guiding your judgment.
Joe Vidich - Versione: 3.15
- Attivazioni: 5
Try it for free before anything else: load Grid Ultimate Oscillator EA in the MetaTrader 5 Strategy Tester, switch on visual mode, and watch three clocks vote on every turn.
THREE CLOCKS MUST AGREE BEFORE THE FIRST ORDER.
Most oscillators read one window, so they flatter whatever just happened. Larry Williams built the Ultimate Oscillator to fix that: he measured buying pressure over a short, a middle and a long window, then blended them 4:2:1 into a single 0-100 line. The weakness is in that blend. A loud fast window can drag the line over a level while the other two have not moved. Grid Ultimate Oscillator EA opens that blend back up. It starts a grid cycle only when the line returns from a real stretch, moves with force on the closed bar, and enough of the three windows agree. A full management engine then reduces the oldest exposure through group closures and partial slices.
At a glance
- A BUY cycle can begin only when UO rises back through the buy level (40) on a closed bar; a SELL needs the mirror move through the sell level (60). Closed bars only, so an accepted signal does not repaint.
- UO is calculated inside the EA from the bars' highs, lows and closes, with Williams' 7/14/28 windows and 4:2:1 weights. No custom indicator file and no DLL.
- New in this product: the Accord Guard. It counts how many of the three windows moved toward the trade and refuses the signal when too few did.
- The Depth Guard wants a real stretch beyond the level first, so a shallow dip does not count.
- The Snap Guard wants UO to move with some force on the signal bar itself.
- The EMA 200 filter is on by default, so a cycle starts as a pullback on the side of the slow trend. You can switch it off or use it to fade.
- Past crossings are marked on the live chart candles: a small arrow when one passed, a grey dot when it was refused.
- No stop loss and no forced close-all. A reached limit refuses new levels while the book keeps being managed, which also means the EA does not cap your losses.
START HERE
Begin on EURUSD H1 with the default 0.01 lot and the additive ladder. Switch RunMode to Scan only for the first session: the panel shows every plan and no order is sent, and one button moves it to Armed when you are ready. Then repeat the runs below on your own broker's data, because spreads, swaps and commissions differ. The inputs are the defaults, so nothing needs to be typed in to reproduce the method.
What our tests showed, and what they did not
Default inputs, Strategy Tester, 1 minute OHLC model, leverage 1:100, 2025.01.01 to 2026.09.30, one broker's demo data:
- EURUSD H1, $10,000 deposit: net result +1,578.05, maximal equity drawdown 1,215.90 (11.28%), 432 trades, no stop-out and no margin refusals.
- EURUSD H1, $1,000,000 deposit: net result +1,578.05, maximal equity drawdown 1,215.90 (0.12%), 432 trades, no stop-out and no margin refusals.
- XAUUSD D1, $10,000 deposit: net result +26.28, maximal equity drawdown 19.49 (0.19%), 8 trades, no stop-out and no margin refusals.
- XAUUSD D1, $1,000,000 deposit: net result +26.28, maximal equity drawdown 19.49 (0.00%), 8 trades, no stop-out and no margin refusals.
Read these as simulations of one past period, not as a forecast. The drawdown in money is the same at both deposits because the lots do not grow with the balance: 1,215.90 is about 11% of $10,000 and would be a far larger share of a small account. Deposits under $10,000 were not tested. The 8 XAUUSD trades are far too few to prove anything.
Two things we changed or compared, stated plainly. Our first levels were 35/65. They were also clean, but gave only 51 EURUSD trades (net +95.54, drawdown 0.76%) and 4 XAUUSD trades, too few to judge, so the defaults were widened to 40/60. That raised activity and raised drawdown as well; nothing was optimised beyond this. We also ran EURUSD H1 at $10,000 once with the Accord Guard off: net +920.49, drawdown 8.76%, 349 trades. So with the guard on, that one run earned more and also dug deeper. One run on one symbol does not show that the guard is better or worse, and you can compare it yourself.
Not verified: netting accounts (the code has a netting cap, but we did not confirm a netting run, so treat netting as untested), the hedge cycle and the margin timeframe safety (both off in every run), the panel with live open positions and the Hedge Vault card on screen (no positions and hedge off at our screenshot), and any live trading.
Why the blend needs opening
Ordinary oscillators go wrong in strong trends: they reach an extreme early and stay there. Williams' answer was to compare the close with the true low on three time spans at once, so that a short burst is weighed against the bigger picture. That is a sound idea. But the weights also mean the fast window carries more than half the line, and a blend hides which part did the moving. For a person reading a chart this matters little. A grid is different: it has no stop to take back a poor start, so a false turn stays on the book until the engine works it off. Better to ask the extra question before the first order.
The improvement in this release
The Accord Guard is this EA's own addition. At each crossing it looks back three bars and asks each window separately: has buying pressure risen for a BUY, or fallen for a SELL? Two of three are required by default. Set the minimum to 3 for full agreement, or 0 to switch it off. The panel shows the live count as ACC 2/3 with OPEN or HOLD, so the vote is never hidden. Margin-level timeframe safety is included and is off by default.
One cycle, step by step
1. The read. On each closed bar the EA works out buying pressure and true range, sums them over the three windows, and blends the results into UO.
2. The crossing. UO must come back through your level on the signal bar: up through the buy level, or down through the sell level.
3. The Depth Guard. In the bars before the crossing, UO must have gone far enough beyond the level.
4. The Snap Guard. UO must move toward the trade by your minimum on the signal bar.
5. The Accord Guard. Enough of the three windows must have moved the same way.
6. The trend filter. By default the close must sit on the trade's side of the slow EMA. Switch it off, or set it to fade.
7. The rhythm. A quiet gap of bars separates accepted signals, and a signal stays valid for a few bars if a level cannot be placed at once.
8. The ladder. Levels are spaced by fixed points or by ATR, with a floor, an upper limit and an option to freeze the distance. BUY and SELL grids can run together or in one direction only.
9. The harvest. The closer searches for groups of the oldest and newest orders and closes a group once its combined result, after swap and commission, beats your target. If the oldest order is still too heavy, only a slice of it goes.
10. The safety checks. A reopen guard blocks a closure that would put the same level straight back on. Every leg is checked against the deal history, failed legs wait in a retry queue, and a plan is dropped if the book changes before sending.
11. The optional hedge cycle. Off by default and not exercised in our tests. When on, it holds a balanced pair on a symbol you choose and retires it in equal slices, funded by a small surcharge on closures the grid is already making.
The panel
The panel sits on the left and keeps the right side and the price scale clear. It shows the symbol and magic number, a status pill, grid mode, lot step, spacing, banked result, the book, the closing plan for each side and the order list. The UO PULSE row shows UO on the last closed bar and the bar before it, your levels, the favoured side, and how many bars ago the last crossing happened. The UO GUARD row shows DEEP, SNAP and ACC, each with OPEN or HOLD, then the EMA side and filter mode. Buttons switch Armed / Scan only, Pause / Resume, chart marks and slicing. The Hedge Vault card is built to dock under the main panel; it was not on screen in our screenshot because the hedge is off by default. The panel draws nothing in a non-visual backtest, so optimisation stays fast.
Protection you control
No stop loss and no forced close-all. A reached limit stops new levels; it never dumps the book at a bad moment.
Before each order the money check asks one plain question: is there enough free margin, with a safety buffer, for this order?
Limits on levels per grid, orders per side and lot per order keep the ladder bounded.
The code caps the margin of a merged position on netting accounts as a percentage of equity; this has not been verified by our tests, so try it first in the tester on your own netting account.
Optional margin-level timeframe safety moves the signal and the spacing to a higher timeframe when the margin level falls to your chosen levels, and moves back after margin recovers past a cushion. Off by default and not tested by us.
Every copy isolates itself by symbol and magic numbers, so several charts do not touch each other's orders or saved state.
Scan only mode shows every decision without sending any order.
Who it suits, and who it does not
It suits traders who want to see why a cycle began, who like a classic oscillator read with more care, and who will size the lot for their own account. It does not suit anyone who needs a stop loss on every order, a promised monthly figure, or a set-and-forget robot on large lots and a tiny balance.
Quick answers
Does it repaint? No. By default signals come from closed bars, and a closed bar's values do not change.
Why can it sit idle for days? The guards are strict and the trend filter removes one side at a time. On a slow chart that means few cycles, as the XAUUSD D1 test shows.
Can I change how often it trades? Yes. Levels closer to 50 and lower guard minimums give more cycles and, in our one comparison, deeper drawdown. Levels further from 50 give fewer.
Is this Williams' original method? The formula is his. His own rules used divergence; this EA uses level crossings with its own guards, so treat it as our reading, not his system.
Do I need to attach an indicator? No. Crossings are marked on the live chart and the readings are shown as numbers on the panel, with no sub-window.
Every setting explained
Grid - how levels are opened
TradeMode - dual grid by default (BUY and SELL side by side), or one direction only.
GridSpacePoints - fixed distance between levels in points when ATR spacing is off (25).
GridSpaceMultiplier - 1.0 keeps levels evenly spaced; a higher value spreads deeper levels further apart.
MaxGridLevels - the most levels one grid may hold (1000).
UpDirectionIsBuy - decides which side an upward move belongs to.
EAMagicNumber - the ID written on this EA's grid orders (9754390).
GridOrderComment - the comment on each grid order (GUOS).
OneOrderPerBar - no more than one new level per bar.
Lot ladder
InitialLotSize - volume of the first level (0.01).
LotSizingMode - additive by default, or multiply.
LotMultiplier - in multiply mode, each level is the previous lot times this value (1.25).
LotAddStep - in additive mode, the volume added at each level (0.01; 0 means the starting lot).
MaxOrderVolume - the largest lot any single order may use (1.0).
UseAutoLot - scales the starting lot with the balance (off).
AutoLotBaseBalance - the balance that matches the starting lot (1000).
AutoLotAllowDecrease - lets auto lot go below the starting lot (off).
ATR spacing
GridSpacingMode - ATR by default, or fixed points.
ATRTimeframe - the timeframe volatility is measured on (current chart).
ATRPeriod - ATR length (14).
ATRSpacingFactor - spacing equals ATR times this value (1.0).
ATRBarShift - 1 uses the last closed bar.
ATRMinSpacingPts - the smallest allowed spacing in points (50; 0 means none).
ATRMaxSpacingPts - the largest allowed spacing in points (5000; 0 means none).
ATRFreezeOnStart - keeps one spacing for the whole cycle (off).
Profit target
DesiredProfitPerClosure - the base target in account currency (2.0).
ProfitMultiplier - scales the final target between 1.00 and 2.00.
ProfitTargetMode - scaled by default, so a bigger and deeper book must earn a bigger result.
ProfitVolumePower - how strongly closing volume lifts the target (1.0; 0 turns it off).
ProfitDepthBonus - extra target for each additional open level (0.10).
ProfitMaxMultiple - the cap on the scaled target as a multiple of the base (50).
ProfitMaxReachFraction - keeps the target within a fraction of one grid step so it stays reachable (0.50).
Fragment scanner
UseMultiLegScan - tests combinations of several orders before the simple pair (on).
MaxOldestLegs - the most oldest orders allowed in one closure (3).
MaxNewestLegs - the most newest orders allowed in one closure (6).
ScanPriority - how qualifying groups are ranked; most orders first by default.
NeverBankLessThanPair - a group must also beat the plain pair target (on).
RequireCloseVolumeExceedsTarget - the newest volume must outweigh the oldest volume (on).
MinCloseVolumeRatio - minimum ratio of closing volume to target volume (1.5).
Target slicing - partial closes
EnableTargetSlicing - closes a slice of the oldest order when the whole lot cannot be paid off yet (on).
FragProfitWeightPower - how profit is weighted per closing lot (1.5).
FragMinSlicePercent - the smallest slice as a percent of the target order (20).
FragAllowMultiCloser - lets several newest orders pool their profit to pay for one slice (on).
FragPreferFullClosure - a full closure wins over a slice whenever both qualify (on).
Reopen guard
ReopenGuard - blocks closures that would immediately reopen a level (step based).
ReopenGuardCushion - the safe distance as a fraction of one grid step (0.90).
Account protection
MinMarginLevelPercent - no new levels below this margin level percent (0 = off).
MaxAccountRiskPercent - no new levels above this floating loss as a percent of balance (0 = off).
NetMaxMarginPercent - on netting accounts, the largest margin of the net position as a percent of equity (5.0).
MaxTotalOrders - absolute cap on grid orders per side (1000).
Execution and verification
RunMode - Armed or Scan only; Scan only is the gentle first step.
CloseSequence - the order in which legs are sent; oldest first by default.
MaxSlippagePoints - maximum slippage (30 points).
MaxSpreadPoints - trading pauses above this spread (7500 points).
MinSecondsBetweenClosures - minimum pause between two closures on the same side (5 seconds).
CloseAttemptsPerLeg - send attempts before a leg moves to the retry queue (3).
VerifyTimeoutSeconds - how long a stuck leg keeps being checked (90 seconds).
DeferWhenMarketClosed - waits for the session instead of halting when the market is closed (on).
MarketClosedRetrySeconds - retry interval while the broker refuses orders (30 seconds).
AutoResumeAfterSeconds - clears a halt by itself after this many seconds (300; 0 waits for the panel button).
NoPartialRetryMinutes - tries partial closes again this many minutes after a broker refusal (15; 0 never).
AbortIfBookChanged - drops a plan if a leg changed between the scan and the send (on).
UseFullCommission - counts commission for both sides of a trade (on).
CommissionPerLot - fallback commission when history has none (0 reads it from history).
CloseOrderComment - the comment on closing deals.
Hedge cycle
EnableHedgeCycle - off by default.
HedgeSymbols - comma-separated list of hedge symbols; repeating one gives it more turns (XAGUSD).
HedgeSymbolRotation - how the next cycle's symbol is picked (per cycle).
HedgeMaxSymbolsInTester - limits rotation in the Strategy Tester only (2; 0 means no limit).
HedgeCycleLots - lots on each side of the balanced pair (0.01).
HedgeSliceLots - lots retired from each side per slice (0.01).
HedgeFragmentBonus - extra amount added on top of the slice cost (100).
HedgeBonusIsPercent - the bonus is a percent of the slice cost; false makes it a fixed amount (on).
HedgeMaxSurcharge - money cap on what one closure may be surcharged (0 = no cap).
HedgeMaxSurchargePercent - the most the hedge may raise any closure target, in percent (50).
HedgeMagicNumber - the hedge legs' ID; it must differ from the grid's (9754391).
HedgeReopenOnFinish - opens a fresh cycle when one finishes (on).
HedgeStartRequiresTrade - waits for the grid to open something before the first cycle (on).
HedgeIntegritySeconds - how often both legs are checked to be equal (5 seconds).
HedgeAutoRepair - repairs a lone leg automatically (on).
HedgeNakedAction - what to do with a lone leg; re-hedge by default.
HedgeMaxSpreadPoints - no hedge orders above this spread (0 = off).
HedgeSlippagePoints - maximum slippage on hedge orders (30 points).
HedgeAttemptsPerLeg - send attempts per hedge leg (3).
HedgeVerifyTimeout - how long a stuck hedge leg keeps being checked (90 seconds).
HedgeCommissionPerLot - fallback hedge commission (0 reads it from history).
HedgeOrderComment - the comment on hedge deals.
Weekly cash day
WeeklyCashDay - no new hedge cycle and no slice during your withdrawal window (off).
CashDayOfWeek - 0 Sunday, 1 Monday and so on (1).
CashCutoffHour - server hour after which no new slice is fired (21).
Panel and chart
ShowPanel - shows or hides the panel.
PanelX and PanelY - panel offsets from the chart edges (12 and 15).
PanelFontSize - base font size (9).
ShowArabic - adds an Arabic line under the English on the panel (on).
ShowChartMarks - draws plans and levels on the chart (on).
MaxTableRows - order rows shown per grid (13).
PanelCorner - the chart corner the panel is anchored to.
Entry trigger
EntryTriggerMode - the Ultimate Oscillator strategy arms the first level by default.
SignalBarShift - 1 means the last closed bar.
SignalBarsDelay - bars that must pass between accepted signals (30; 0 accepts every signal).
SignalValidBars - a signal stays usable for this many bars (3).
SignalAllowBuy and SignalAllowSell - turn each direction on or off separately.
SignalReverse - inverts the direction (off).
Ultimate Oscillator - the signal
InpUOPeriodFast, InpUOPeriodMid, InpUOPeriodSlow - the three window lengths in bars (7, 14, 28; each 2 or more).
InpUOWeightFast, InpUOWeightMid, InpUOWeightSlow - how much each window counts in the blend (4, 2, 1).
InpUOBuyLevel - UO must rise back through this level for a BUY (40).
InpUOSellLevel - UO must fall back through this level for a SELL (60).
InpUODepthPts - Depth Guard: points UO must have gone beyond the level (5; 0 = off).
InpUODepthBars - Depth Guard: bars checked before the crossing (10; 0 = off).
InpUOSnapMin - Snap Guard: the smallest UO move toward the trade on the signal bar (1.0; 0 = off).
InpUOAccordBars - Accord Guard: how many bars back each window is compared (3).
InpUOAccordMin - Accord Guard: how many of the three windows must agree (2; 0 = off).
InpUOTrendFilter - 0 off, 1 trade with the EMA side, 2 trade against it as a fade (1).
InpUOTrendMAPeriod - the trend EMA length (200).
InpShowSignalArrows - arrows on the candles where a cycle was armed (on).
InpShowUOOnChart - marks recent level crossings on the live chart candles, arrows for passed and grey dots for refused (on; no extra sub-window).
Debug
DebugMode - detailed journal logging (off).
Margin timeframe safety
UseMarginTFSafety - off by default.
Level1MarginPct and Level1TF - at or below 6000 percent margin level, work on M15.
Level2MarginPct and Level2TF - at or below 5000 percent, work on H1.
MarginTFHysteresisPct - how far margin must recover above a level before stepping back (500).
Honest expectations
A grid manages a position; it cannot see the future, and it can lose a large part of an account. Three windows agreeing is a condition, not a forecast, and a clean turn can fail a few bars later. With no stop loss the book then stays open and grows while the move runs, up to the limits you set. Choose a lot your account can carry through that, test on your own broker first, and let the Strategy Tester show you how it behaves before you trade it live. It runs on any symbol and timeframe, and needs no DLLs and no extra files.
If you use it, a short and honest review of how it behaved on your account, good or bad, helps other traders make their choice.
