A trend filter does not tell you whether enough room remains for a scalp. This model selects one two-bar pullback, asks for one contained recovery candle, and keeps a target built from earlier prices. A later rise in ADX or a smaller position cannot repair a failed signal or insufficient net reward. All examples are invented research cases.
1. What is different about this hypothesis?
This model studies a contained recovery after two counter-direction candles inside an existing EMA context. Unlike the frozen H1 range breakout, it does not wait for a consolidation box to break. Unlike the EMA/RSI model, it has no oscillator reset or RSI midpoint crossing. Its price target comes from six candles before the pullback, not a projected multiple of the entry risk. No edge, optimized setting or ready Expert Advisor is claimed.
EMA provides direction; ADX measures strength without selecting BUY or SELL. Here a decline in ADX during the pullback is deliberately required while its level remains above a floor. This is a separate hypothesis from a rising-ADX entry model, not a universal instruction to trade falling ADX. Use continuous scheduled M5 Bid OHLC, completed data and actual paired Ask history for real SELL levels. The fictional EURUSD contract is pip=0.0001; point=tick=0.00001.
2. Declare the finite indicator reference
Seed EMA20 and EMA50 with their first 20 and 50 closes, then apply EMA_n(k)=[2×Close(k)+(n−1)×EMA_n(k−1)]/(n+1). For k starting at 1 use u=High(k)−High(k−1); v=Low(k−1)−Low(k); TR=max(High−Low,abs(High−PreviousClose),abs(Low−PreviousClose)). Positive DM is u only when u is positive and strictly greater than v; negative DM is v only when v is positive and strictly greater than u. Ties give both zero.
At k14 seed the smoothed TR and both DM means from k1–k14; then W(k)=[13×W(k−1)+raw(k)]/14; DI_plus=100×W(DM_plus)/W(TR); DI_minus=100×W(DM_minus)/W(TR); DX=100×abs(DI_plus−DI_minus)/(DI_plus+DI_minus). With positive smoothed TR and zero DI sum, DX is zero; zero smoothed TR makes the decision unavailable. Seed ADX at k27 with the mean of DX14–DX27, then ADX(k)=[13×ADX(k−1)+DX(k)]/14. Compare full values and actual timestamped buffers before claiming platform parity: the label ADX14 alone is insufficient. MT4 MODE_MAIN is ADX, not a DI line. Shift 0 is forming; store closed-bar timestamps as shifts move.
3. Select the first A–P–S pattern once
Define BUY context F+=[EMA20>EMA50 AND EMA50(k)>EMA50(k−3)] and SELL context F−=[EMA20<EMA50 AND EMA50(k)<EMA50(k−3)]. A context segment starts when its condition becomes true after false and ends immediately when it fails. Equality is outside. A, P and S are three consecutive closed bars in one segment: A has a trend-direction body, followed by two strict counter-direction bodies P and S. Doji bodies do not satisfy the pattern.
For BUY, A closes above its open and P/S below theirs; SELL reverses those comparisons. Consume the first such structural pattern in the segment at S, before any quality, ADX, time or execution checks. A failed first pattern cannot be replaced by a prettier second one. Track context even outside entry hours; a clock boundary does not rearm it. After restart, reconcile exposure and replay consumption without sending historical orders. Unknown segment or ownership state holds new entries.
4. Qualify a cooling but still strong pullback
Require ADX_A>=30; ADX_P<ADX_A; ADX_S<ADX_P; ADX_S>=25. BUY also needs A's close above EMA20 and both P/S Bid lows strictly above their respective EMA20 values. SELL needs A's close below EMA20 and both P/S Bid highs strictly below it. DI values are calculation diagnostics, not an additional crossing gate. Indicator agreement is not independent evidence because the inputs overlap.
Use combined P/S body size 2<=body_P/pip+body_S/pip<=15, with range(P)<=12 pips; range(S)<=6 pips; body is absolute close-minus-open and range is high-minus-low, not true range. The six completed bars ending at A must also belong to the same context. Both S and C must close within [07:00,10:00) UTC. Check the broker-to-UTC offset for the date. These are research thresholds, not a news-free or daylight-saving-adjusted session claim.
| UTC time | EMA20 | EMA50 | ADX |
|---|---|---|---|
| 07:50 / A | 1.10213468 | 1.10008908 | 94.840440 |
| 07:55 / P | 1.10223614 | 1.10021108 | 92.603698 |
| 08:00 / S | 1.10228984 | 1.10031260 | 89.066867 |
| 08:05 / C | 1.10236224 | 1.10041995 | 85.782667 |
5. Freeze both exits from completed prices at S
Let the six-bar reference end at A and exclude P/S. Freeze BUY: T_bid=floor_tick(max(BidHigh[A−5..A])−0.2 pip); SELL: T_ask=ceil_tick(min(AskLow[A−5..A])+0.2 pip). This is a historical lookback extreme, not a future-confirmed swing pivot. At S require BUY P/S Bid highs strictly below T, or SELL P/S Ask lows strictly above T: an already visited objective rejects the setup.
Freeze protection at BUY: S_bid=floor_tick(min(BidLow(P),BidLow(S))−0.2 pip); SELL: S_ask=ceil_tick(max(AskHigh(P),AskHigh(S))+0.2 pip). Round stops outward and targets inward on the actual executable tick. Real SELL needs the observed paired Ask highs and lows; current spread added to historical Bid is not a reconstruction. The fixture's constant 0.8-pip offset is invented. Neither exit is moved by C, the quote, later indicators or the fill. Missing required data consumes the raw candidate and blocks execution.
| Side | Stop | Target | Body midpoint |
|---|---|---|---|
| BUY | 1.10273 | 1.10408 | 1.10300 |
| SELL | 1.10345 | 1.10210 | 1.10310 |
6. Only the next inside candle can confirm
C must close exactly five minutes after S. First cancel if C has touched either frozen exit: BUY uses Bid low at or below S or Bid high at or above T; SELL uses Ask high at or above S or Ask low at or below T. Then require the same EMA context, valid hours, ADX_C>=25 and BidHigh(C)<=BidHigh(S); BidLow(C)>=BidLow(S). Inside-range equality is allowed. A missing scheduled C is not replaced by a later candle.
Define mid(S)=[BidOpen(S)+BidClose(S)]/2. BUY C must have a bullish body, close above its own EMA20 and BidClose(C)>mid(S); SELL must have a bearish body, close below its own EMA20 and BidClose(C)<mid(S). Midpoint equality fails. ADX need not rise on C. This is a contained price recovery, not a breakout above S's high. No pending order, second C or later confirmation is permitted.
7. Decide on the first observed quote
At the first observed symbol quote after C's scheduled close, process C once. If completed C data are unavailable then, consume the candidate. Require positive ordered Bid/Ask, spread<=1.0 pip; abs(Bid_ref−BidClose(C))<=0.5 pip and own-symbol receipt age <=250 ms. Age is verified elapsed time since local receipt, not network latency inferred from an MT4 server timestamp. A rejected first quote cannot be replaced by a later favorable one.
Send at most one initial market request by C+1 second, inclusive; no timely quote means expiry. Before sending, recheck current prices, age, costs, exposure, margin, minimum lot, permissions and broker stop limits. The same fixed S, T and first-sized volume must still satisfy net-ratio and cash-risk gates at the current price with the adverse entry allowance. If attached fixed SL/TP cannot be submitted with the request, skip. Never widen a stop, resize while waiting or use a pending-order fallback to repair failure.
8. BUY: fixed objective before the entry quote
The fixture has A at 07:50, P at 07:55, S at 08:00 and C at 08:05 UTC. ADX is 94.840440 / 92.603698 / 89.066867 / 85.782667: it is declining as required, still above the floor. S opens at 1.10320 and closes at 1.10280, so mid(S)=1.10300; BidClose(C)=1.10305. C's high/low 1.10315/1.10278 stay inside S's 1.10325/1.10275.
The earlier six-bar high is 1.10410, giving S_bid=1.10273; T_bid=1.10408. First quote 08:05:00.100; Bid/Ask=1.10305/1.10313 plans an adverse entry at F_plan=Ask_ref+0.2 pip=1.10315. The calculations below allow 0.49 lots. A protected request at .300 has receipt age 200 ms; server fill is 1.10314 at .450 and acknowledgement at .500. Those are separate events; volume is not rewritten after the fill.
9. SELL: mirrored candles, actual Ask protection
The independent SELL construction reverses Bid candles and indicator direction. S's body midpoint is 1.10310; C closes at Bid 1.10305 below it, with a bearish inside body. ADX has the same nondirectional values. The actual paired Ask reference gives S_ask=1.10345; T_ask=1.10210. Indicators still use Bid, while these are Ask exit thresholds.
The first Bid/Ask is again 1.10305/1.10313. SELL plans at F_plan=Bid_ref−0.2 pip=1.10303 and actually fills at 1.10304. Its planning loss and reward match BUY only because the data were deliberately mirrored. The later Ask target 1.10210 corresponds to Bid 1.10202 under the fixture's constant spread. Do not infer equal live directional performance or a reliable historical Ask path from this engineered symmetry.
10. Keep failed signals consumed
In midpoint_equal, C closes at 1.10300=mid(S). The later 08:10 close at 1.10320 is too late. In outside_confirmation, C's high is 1.10326>1.10325, so it fails containment even though its close recovers. Both branches send nothing. In weak_strength, S's ADX is 7.142857, and the earlier/cooling gates also fail. ADX reaches 26.286281 at 08:40, but the original pattern remains consumed.
In bad_first_quote, Bid 1.10305 and Ask 1.10316 give spread 1.1 pips. Net ratio happens to equal 1.50, but the spread cap still fails. The better 0.8-pip quote at .200 does not revive it. These are separate invented branches, not successive events in one trade. Rejected cases have no transmitted entry, traded volume or realised P&L. Their diagnostic references and sizes are counterfactual, not fills or zero-return trades.
11. Price room after costs decides eligibility
Assume a USD account, EUR 100,000 per standard lot and pip_value=$10/lot; equity=$10,000; new_risk=0.25%=$25; aggregate_risk<=0.50%=$50. Reserve 0.2 pip adverse entry inside F_plan, plus 0.2 pip remaining exit slippage and a linear 0.7-pip round-trip commission without minimum or other charge. Remaining cost is c=0.7+0.2=0.9 pip. BUY uses L=(F_plan−S_bid)/pip+c; W=(T_bid−F_plan)/pip−c; SELL uses L=(S_ask−F_plan)/pip+c; W=(F_plan−T_ask)/pip−c. Spread is already represented by entry/exit quote sides.
Require positive L and W and W/L>=1.50. The normal quote gives L=5.1; W=8.4; W/L=1.6470588. With no other exposure, lots=floor_step(min(25,50−existing_risk)/(L×10),0.01)=0.49, planned loss $24.99 and net target $41.16. An alternative first Bid/Ask 1.10310/1.10318 passes spread and the 0.5-pip displacement boundary but gives L=5.6; W=7.9; W/L=1.4107143: reject at any size. Unknown aggregate risk blocks entry; hold only one owned position, without adding or hedging. Allowances are reserves, not guaranteed fills or actual fees.
| Quote | Loss, pips | Reward, pips | Net W/L | Result |
|---|---|---|---|---|
| 1.10305 / 1.10313 | 5.1 | 8.4 | 1.6470588 | Pass |
| 1.10310 / 1.10318 | 5.6 | 7.9 | 1.4107143 | Fail |
12. Manage price exits and a fifteen-minute limit
Close the full BUY on Bid<=S_bid OR Bid>=T_bid or the full SELL on Ask>=S_ask OR Ask<=T_ask. If still open, seek a full exit on the first valid quote at or after min(C+15 minutes,10:00 UTC), counted from C, not the fill. Reconcile an already executed broker exit before another close request. Management does not wait for entry spread, EMA or ADX conditions. No trailing, partial close, target extension or indicator exit is included.
The target branches reach their correct-side target at 08:10:10, yielding 9.4−0.7=8.7 net pips; $42.63. Unused slippage reserves are not charged as fees. The gap branch jumps from Bid 1.10320 to 1.10230 and actually exits there: −9.1 net pips; −$44.59, beyond the $25 plan. The time branch first receives a due quote at 08:20:00.200 and fills at .350 at Bid 1.10300 for −2.1 net pips; −$10.29. Stops, planning budgets and reserves do not cap realised loss.
| Result | Net pips | Net USD |
|---|---|---|
| BUY / Target | 8.7 | 42.63 |
| SELL / Target | 8.7 | 42.63 |
| BUY / Gap | -9.1 | -44.59 |
| Exit / 15 min | -2.1 | -10.29 |
| Request / 128 | 8.7 | 42.63 |
13. Unknown entry outcomes require reconciliation
Timeout does not prove that an entry failed. In timeout_reconciled, the request goes at 08:05:00.300, fills on the server at .450, reports error 128 at 08:05:01 and is found protected at 08:05:02. Hold new entries; reconcile owned positions, pending orders and history by identifiers, symbol, direction and volume. An order comment does not guarantee idempotency. Do not send a blind replacement entry.
If a verified owned fill has missing or incorrect fixed protection, the predefined fault response is one full market-exit request on a valid quote when permissions allow; then alert and reconcile any rejected or unknown result. Do not blindly repeat closes or touch unrelated positions. Entry holds do not disable existing position management. After restart restore ownership, accepted protection, unresolved requests and the segment's consumed state before considering another candidate.
14. Failure regimes and separate variants
Cooling ADX can precede a genuine trend reversal. Two counter-direction candles can start a larger sell-off, while an inside recovery can be temporary. EMA ordering lags; a historical six-bar extreme is no promise of a revisit. Costs can erase the remaining target room even when the spread is small. Sparse quotes, missing Ask history, broker limits and gaps can invalidate an attractive Bid-only picture.
This baseline has no automatic news blackout, and its UTC hours are not a news filter. A news-aware variant must predeclare the full blackout, spread-recovery and fresh-signal policy, including how consumed patterns are handled. Compare missed trades and costs as well as losses. Different EMA seeds, ADX smoothing, body limits, hours, target lookbacks or exits are separately declared variants, not changes made after observing a result.
15. Reproduce the ten independent teaching branches
The three CSVs contain 1,238 bars and 2,001 events, including complete indicator warm-up, five rejected branches and five alternative entry branches. They are constructed mechanics, not historical observations, simultaneous positions, a portfolio or a win-rate sample. After entry, the declared one-second feed and explicit endpoint quotes define all executable observations. Analytical close markers are not claims of executable quotes at those instants. The fixture has no financing or extra fee.
Recompute both EMA seeds, TR, DM, DI, DX and ADX, then replay the context and first-pattern flag before applying quality gates. Check the earlier-price target, correct-side protection, containment, strict midpoint recovery, first quote, net ratio, fixed sizing and chronological exits. Include zero/tie cases, equality boundaries, out-of-window consumption, a missing C, old quotes, expiry, unknown exposure, restart and timeout. Performance research needs unseen periods and actual Bid/Ask execution records with broker constraints; these CSVs establish mechanics only.
Download fictional M5 bars (CSV)
16. A short execution checklist
Establish complete closed data, the real EMA segment and its consumed state. Select the first A–P–S pattern; validate cooling strength, price quality, hours and the six earlier bars. Freeze S and T. Validate only scheduled C, with visited exits first, then containment, context, ADX and strict body-midpoint recovery. Evaluate the first quote once, calculate net room and fixed volume, recheck execution constraints, and send at most one protected request within the deadline.
Reconcile the request and manage the confirmed position with frozen levels and the time limit. After rejection, wait for a new EMA segment and its own full pattern. Keep rejected candidates, unknown outcomes and costs in the research log. This finite policy makes the hypothesis testable; it does not prove positive expectancy, guarantee a loss ceiling or establish settings suitable for live trading.
Frequently asked questions
Does falling ADX mean the strategy should sell?
No. ADX does not select direction. EMA context selects BUY or SELL, and a precisely defined decline in ADX is studied as part of a pullback while strength remains above its floor.
Must C break above the setup high for a BUY?
No. C must remain inside S's Bid range and close with a bullish body above S's body midpoint and its own EMA20. Requiring a high breakout would create a different entry model.
Is the target a confirmed swing or a fixed R multiple?
Neither. It is built from the six completed candles ending before the pullback, with an inward tick-rounded buffer. No future pivot confirmation or entry-based R projection is used.
Can a smaller position rescue insufficient target room?
No. Reducing volume changes cash amounts, not the planned net reward/loss ratio. The dearer first quote fails 1.50 even though its spread and displacement pass.
Does later ADX improvement revive a rejected pattern?
No. The first structural A–P–S pattern consumes the EMA segment before qualification. Later strength, confirmation or a better quote cannot restore it; a new segment and pattern are required.
Are the examples verified trading results?
No. The branches are independent fictional inputs for checking mechanics and accounting. They are not market observations or a backtest; even the planning budget can be exceeded by the illustrated gap.
Sources and research notes
Official documentation describes moving averages, ADX buffers and order parameters. The finite initialization, pattern, thresholds, hours, risk and prices here are declared research assumptions, not vendor recommendations or evidence of profitability.
- MetaTrader 4: moving average definitions
- MQL4: ADX buffers and historical shift
- MQL4: protected market-order parameters
Educational research hypothesis. Invented prices and execution; no verified performance, live settings or guaranteed loss limit.