A return inside a moving band is not enough. This strategy requires the first return past a previously frozen edge, a fresh Stochastic cross on that same bar and enough executable room to the frozen middle after costs. Each qualification permits one entry decision.
1. Freeze the complete first-return model
Use EURUSD · M5 · Bid OHLC · Close and a USD account. Bollinger Bands define relative location and dispersion; Stochastic supplies a timed crossing. Both reuse overlapping prices and can remain extreme during a trend. This is a reproducible research candidate, with no claimed win rate, optimum settings or expected profit. A band touch alone is not an entry.
Allow one owned position or unresolved entry request per symbol. No averaging, pyramiding, hedge, partial exit, trailing or break-even adjustment. Ignore new origins while pending or invested; after a verified exit, wait for a later independent outside event. Missing required bars terminate an observation: rebuild contiguous history before another origin. The fixed UTC and execution policies match the preceding EMA–RSI strategy to make their specifications easier to compare.
2. Define bands and the exact Stochastic calculation
From k19 use M=mean(C[k−19...k]); V=mean((C−M)^2), with population denominator 20. Set L=M−2sqrt(V); U=M+2sqrt(V). Stochastic14/3/3 uses completed Bid highs and lows: A=C−LL14; B=HH14−LL14, K=100*sum(A[k−2...k])/sum(B[k−2...k]) and D=mean(K[k−2...k]). This ratio of sums is not an average of three raw percentages when denominators differ. A zero summed denominator gives our convention K=50.
K begins at k15, D at k17 and fresh crossings at k18. Read completed buffers with shift=1 and predecessors at shift=2; chart displacement is zero. The reference keeps exact rational moments and K/D, and compares band thresholds through equivalent squared inequalities; square roots are only for display. Another history or platform implementation can change values, so terminal parity is not established. Two standard deviations do not guarantee a future containment probability.
| Component | Declared reference | Role / assumption |
|---|---|---|
| Price and inputs | EURUSD · Bid · M5 · Close | BB20/2 · Stochastic14/3/3 |
| Bollinger Bands | SMA20 · V=Σ(C−M)²/20 · 2σ | 8...30pip · |ΔM_3|≤2pip |
| Stochastic | 14/3/3 · Low/High · SMA | K=100ΣA/ΣB · D=SMA3(K) |
| Contract and grid | pip=0.0001 · tick=0.00001 | 100000 EUR · 10 USD/pip/lot |
| Account limits | 0.25% · 1% · 2 | Per-entry budget · daily equity floor · requests/day |
3. BUY: freeze the prior context and consume the first return
Require the previous bar’s G=[8≤(U−L)/pip≤30 AND abs(M(k)−M(k−3))/pip≤2], assessable from k22. A fresh outside origin P needs C(P−1)≥L(P−1) AND C(P)<L(P−1) AND K(P)≤20. Freeze L_ref, M_ref, U_ref from P−1 and Z_buy=L_ref−(U_ref−L_ref)/2. Reject a close at or below Z. G is frozen at P−1, not retested using a more convenient later band.
On each later completed bar first cancel if C≤Z_buy, next expire if k>P+2, then inspect the first strict return. It needs L_ref<C<M_ref and a fresh K_prev≤D_prev AND K>D on that same bar. Only P+1 and P+2 are eligible. A first return lacking the cross, or already at the middle, consumes P as rejected. Additional outside closes never replace P or extend its deadline.
4. SELL: mirror the signal and specify executable exits
A fresh SELL origin needs previous G and C(P−1)≤U(P−1) AND C(P)>U(P−1) AND K(P)≥80. Freeze the same prior-bar reference and Z_sell=U_ref+(U_ref−L_ref)/2. Reject or cancel at C≥Z_sell, expire after P+2, then require the first M_ref<C<U_ref with fresh K_prev≥D_prev AND K<D. No later cross can repair an earlier rejected return; no same-bar rearming is allowed.
After cancellation or expiry while still outside, keep the episode locked until a completed close recovers its frozen edge. That recovery only releases the lock for a future independent origin. BUY enters Ask and exits Bid; SELL enters Bid and exits Ask. SELL’s numerical Ask stop comes from completed Bid highs, not an observed Ask swing high. Bid OHLC alone cannot establish an Ask path or intrabar exit order.
5. Gate the session, account and daily exposure
Accept qualification times only at 07:00≤q UTC<09:30; flatten at 10:00 UTC. These fixed UTC hours are model choices, not a claim about a daylight-saving-adjusted London session. Record the broker-to-UTC mapping. Require bar detection within 1s, candidate quote timestamp at or after q and quote age at most 250ms at send. Millisecond checks require suitable recorded timestamps and a monotonic clock, not invented precision from second-resolution server time.
At most 2 transmitted entry requests/day, including rejections and timeouts. A preflight skip consumes q without using a transmitted attempt. Record verified day-start equity Eday; block new entries and close owned exposure at the first available valid quote when equity reaches 0.99*Eday. Unknown baseline, cash flows or unresolved account state pauses the model. Reset the day only when flat and reconciled. No automatic news filter is included in this specification.
| Stage | Deadline / window | Action |
|---|---|---|
| q | 07:00 ≤ UTC < 09:30 | Qualification times |
| q+1s | ≤1000ms | Latest first bar detection |
| q+2s | ≤2000ms · age≤250ms | At most one request |
| q+4×M5 / 10:00 | min(q+20min, 10:00 UTC) | First available quote to exit |
6. Freeze the middle target and an executable-side stop
Use d=abs(E0−S)/pip with 3≤d≤12. BUY stop is the lowest completed Bid low from P through q minus one pip, rounded down; SELL stop is the highest Bid high plus one pip, rounded up, as an Ask-side threshold. BUY target is T_bid=floor_tick(M_ref); SELL target is T_ask=ceil_tick(M_ref). Rounding brings the target inward when the frozen mean lies between ticks. Freeze all levels from the episode and first quote; never move them with subsequent bands or the actual fill.
Plan adverse entry tolerance 0.2pip=2points. BUY worst entry is Fmax=Ask_ref+0.2pip; SELL is Fmin=Bid_ref−0.2pip. Add round-trip commission 0.6 pip and exit-execution reserve 0.4 pip once to planned loss, subtract them from target reward, and require net reward/planned loss≥1.30. Entry tolerance is already in F; the reserve covers exit only. Fixed levels violating broker constraints cause a skip, never a wider stop.
| Reference entry | Fixed stop | Fixed target | |
|---|---|---|---|
| BUY | E0=Ask_ref | S_bid=floor_tick(min BidLow[P..q]−1pip) | T_bid=floor_tick(M_ref) |
| SELL | E0=Bid_ref | S_ask=ceil_tick(max BidHigh[P..q]+1pip) | T_ask=ceil_tick(M_ref) |
7. Consume the first quote and send at most once
At the first detection of q, capture the first candidate Bid/Ask. Require spread ≤1.0pip and absolute Bid deviation from q’s completed Bid close ≤1.0pip. Complete preflight and transmit no later than q+2s, inclusive. Recheck current quote validity, age, costs, risk, permissions, margin and protection before send; any failure consumes q. A changed quote must remain inside the original entry tolerance and pass these checks; original levels and reference stay frozen.
Use one request with attached stop and target; skip if the execution environment cannot support this protected entry. No entry retry follows rejection, stale data, a bad spread, missed deadline or timeout. In bad_quote the first spread is 1.5 pip and later narrows to 0.8; no request follows. In late_request preflight finishes at q+2.5s: the deadline fails before any send. A later favourable quote does not revive either qualification.
8. Follow the accepted BUY from origin to target
The constructed buy_target history has prior width about 18.6376 pips, L_ref≈1.09909812; M_ref=1.10003. At P=k44 / 08:00 UTC, close is 1.09900 and K≈6.1069. The next close 1.09901 remains outside. The first return at q=k46 / 08:10 UTC closes 1.09915; K≈4.9645 exceeds D≈4.4870 after the previous nonpositive difference. K need not cross above 20: this model requires the fresh K/D event.
First Bid/Ask at q+250ms is 1.09916 / 1.09924, with S_bid=1.09886; T_bid=1.10003. Worst entry 1.09926 gives loss 5.0 pips, net target 6.7 and ratio 1.34. Independent equity 10000 USD gives a 25 USD budget: 0.50 lots / 25.00 USD planned risk. Request at +400ms, verified fill 1.09925 at +550ms, target Bid at 08:15:20: gross 7.8 less actual commission 0.6 equals 7.2 pips / 36.00 USD. The reserve is not charged as a fee.
| Side | Bid / Ask | S / T | Loss (pip) | Net target (pip) | Ratio | Lots | Risk USD |
|---|---|---|---|---|---|---|---|
| BUY | 1.09916 / 1.09924 | 1.09886 / 1.10003 | 5.0 | 6.7 | 1.34 | 0.50 | 25.00 |
| SELL | 1.10076 / 1.10084 | 1.10114 / 1.09997 | 5.0 | 6.7 | 1.34 | 0.50 | 25.00 |
9. Follow the SELL with an Ask-side frozen target
The independent sell_target Bid prefix reflects the BUY prefix around 2.20000. Its origin K≈93.8931 is above 80; the return has K≈95.0355 below D≈95.5130 after previously K≥D. These values can remain above 80 while satisfying the downward cross. First Bid/Ask is 1.10076 / 1.10084, with S_ask=1.10114; T_ask=1.09997. The target is the frozen middle rounded up, not a later recalculated mean.
Worst Bid entry 1.10074 produces the same 5.0-pip planned loss, 6.7-pip net target, 1.34 ratio and 0.50-lot size. Verified fill is 1.10075; Ask reaches 1.09997 at 08:15:20, net 7.2 pips and 36.00 USD. The execution chart uses Ask candles while Stochastic still uses Bid OHLC. This engineered symmetry verifies quote-side arithmetic; it is not evidence of equal BUY and SELL performance.
10. Keep rejected returns and cost failures separate
In early_return the first return at k45 / 08:05 UTC has K≈12.3457 below D≈16.8343 and is rejected. The fresh cross at k46 has no active P. In moving_only, the current lower band falls below price while price still falls; the frozen edge is not recovered. The actual return and cross at k47=P+3 arrive after expiry. breakout_cancel instead closes below its depth boundary at k45; recovery at k46 merely releases the lock. All retain Q=0.
cost_reject preserves the guide’s original timely signal through q, so Q=1. First Bid/Ask 1.09970 / 1.09978, stop 1.09916 and frozen middle target 1.10002 give planned loss 7.4 pips but net target only 1.2 pips: ratio 0.1622 fails 1.30. No request follows. The accepted example uses a separately constructed wider context and shallower excursion; it does not rewrite the original signal or demonstrate optimized market settings.
11. Use fixed exits, a four-bar limit and actual fills
After a verified fill, new bands and oscillator reversals neither move protection nor close the trade. BUY barriers trigger on Bid≤S_bid OR Bid≥T_bid; SELL on Ask≥S_ask OR Ask≤T_ask. Follow chronological quotes and actual fills. A candle containing both barriers without tick order cannot identify the first exit; do not select the favourable result.
Time exit is the first valid quote after min(q+4 completed M5 slots, 10:00 UTC), unless already closed. The four slots correspond to 20 scheduled minutes. time_exit uses 08:30:00.200, Bid 1.09918, net −1.3 pips / −6.50 USD. buy_gap exits at 1.09871, 1.5 pips worse than its fixed stop: net −6.0 pips / −30.00 USD, exceeding the budget. Stops and reserves do not cap actual losses; outages can delay flattening.
12. Reconcile unknown outcomes and failed protection
A request acknowledgement must match the owned symbol, side, volume, stop and target. Log a unique attempt identifier and reconcile the actual order book and fill history. A timeout means unresolved≠rejected≠flat; pause new entries, do not resend, and do not infer a fill or PnL. unknown_request deliberately leaves those fields blank because the account outcome is unavailable.
If reconciliation finds a fill outside the planned adverse bound or missing/wrong protection, attempt an emergency close of the verified owned ticket and halt new entries. Verify the close result and continue risk reconciliation if uncertain; never widen the fixed stop to repair the trade. Emergency risk actions are separate from the entry-attempt cap. No instruction here authorizes interference with unrelated account positions.
13. Size cash risk and distinguish reserves from fees
Use B=min(0.0025*equity, equity−0.99*Eday), requiring positive headroom. With assumed 10 USD/pip/standard lot and 0.01 lot step, lots=floor_step(B/(planned loss pips*10)). Skip below minimum lot or on failed maximum-volume, margin or contract checks. Recompute quote-to-account conversion when needed; EURUSD and a USD account make the fictional pip value direct.
For BUY planned loss is (Fmax−S_bid)/pip+1.0 and net reward (T_bid−Fmax)/pip−1.0; SELL mirrors the distances from Fmin. Spread is already represented by executable sides and must not be added again. Actual net PnL uses actual entry/exit and actual fees; the 0.4-pip exit reserve is not a fee. The target fixture’s actual 36.00 USD and the planning reward answer different questions.
14. Rebuild all bars, events and nullable outcomes
The public bar file has 12 independent cases ×64 bars=768 rows, with scheduled UTC closes beginning at 2026-02-03 04:20 UTC. Four diagnostic branches retain the earlier guide’s history through q. The accepted BUY uses a distinct constructed prefix; SELL reflects it. All indicators use each case’s Bid OHLC. Pre-q Ask is explicitly constructed as Bid+0.8 pip; post-q OHLC aggregates listed quotes, not a recovered live feed.
The event file supplies chronological quotes, requests, known acknowledgements, exits and the unresolved timeout. The ledger separates frozen references, worst planned entry, actual fills, fees and unknown results. The time-exit quote at q+20min+200ms belongs to the next open bar k51, not to the completed k50 candle. Later market quotes do not imply another trade. Recalculate moments, Stochastic, first returns, protection, size and PnL independently.
Download fictional M5 bars and indicators (CSV)
15. Verify branch coverage before studying performance
The casebook contains 8 qualifications; 5 transmitted requests; 4 known closed fills; 1 unresolved request. Other cases exercise first-spread rejection, missed deadline, an otherwise valid signal failing the net ratio, first-return rejection, late recovery, depth cancellation and equality. Each case starts independently; they are not one day’s portfolio and do not bypass the two-request daily limit. No-order and unknown PnL remain blank, not zero-filled trades.
Freeze the specification and all parameter variants before testing suitable unseen Bid/Ask ticks, variable costs, gaps, rejected or unknown orders, outages and clock conversion. Compare net expectancy, drawdown, turnover, uncertainty and cost sensitivity. Test equity-floor breaches and protection failures in a controlled environment as well. These constructed successes and failures establish neither a market win rate nor live readiness or economic advantage.
| Independent case | Requests | Outcome |
|---|---|---|
| buy_target | 1 | Frozen middle; known fill |
| sell_target | 1 | Ask middle; known fill |
| buy_gap | 1 | Gap stop; −30.00 USD |
| time_exit | 1 | Time exit; −6.50 USD |
| bad_quote | 0 | First spread rejected |
| late_request | 0 | Send deadline missed |
| unknown_request | 1 | Unknown; reconcile |
| cost_reject | 0 | Net ratio rejected |
| early_return | 0 | First return lacks cross |
| moving_only | 0 | Return after expiry |
| breakout_cancel | 0 | Depth cancellation |
| flat | 0 | No strict context or signal |
16. Implement the same episode and order state machine
Keep the sequence explicit: complete inputs, prior context, fresh outside origin, frozen references, first return within two bars, same-bar fresh cross, consumed first-quote decision, one request, verified protection, fixed exit and reconciled flat state. A moving-band return cannot substitute for frozen-price recovery. Log every failed gate and its priority, including a valid signal rejected for inadequate net target room.
This is the second complete strategy in the scalping indicator-combination group. The Bollinger–Stochastic guide explains the signal foundation, while EMA–RSI uses a different reset sequence and target geometry. The related testing and sizing guides supply data and account checks. The next combination, EMA with MACD, needs its own rules and evidence. Audit this publication before extending the group; fictional outcomes cannot justify profitable-trading claims.
Frequently asked questions
Can a later Stochastic cross repair the first rejected return?
No. The first return consumes P. A cross must occur on that same eligible bar; after rejection, cancellation or expiry a later independent outside origin is required.
Must K leave the 20/80 zone to qualify?
No. K at the origin must be at or below20 for BUY or at or above80 for SELL. The return requires a fresh K/D cross, not an additional zone exit.
Does the target follow the current Bollinger middle?
No. Freeze the middle from P−1 and round inward to the tick grid. Subsequent indicator values and the actual fill never recenter it.
Why can a valid first-return signal produce no order?
The first quote must also pass spread, timing, distance, net-reward, account and protection checks. cost_reject has Q=1 but insufficient reward after costs, so no request is sent.
Does a timeout permit another entry request?
No. Pause and reconcile the actual owned order and fills. An unknown result is neither rejection nor evidence of being flat; its PnL remains unknown.
Do the examples establish profitability?
No. They are independent synthetic verification cases. Suitable unseen tick data, realistic execution and further controlled validation are needed to assess performance.
Sources and research notes
MetaQuotes documents indicator inputs and executable order sides; its Stochastic reference explains the oscillator. John Bollinger describes the limits of band tags and trend walks. Our finite formulas, episode, target, timing and risk settings are declared research choices, not optimized recommendations or broker guarantees.
- MQL4 Reference: iBands
- MQL4 Reference: iStochastic
- MetaQuotes: Stochastic Oscillator reference
- John Bollinger: Bollinger Band Rules
- MQL4 Reference: OrderSend
Educational research specification. Prices, quotes and outcomes here are fictional. Forex trading involves risk. Stops, slippage settings and planning reserves cannot guarantee execution prices, profitable returns or a maximum actual loss.