Commit graph nyao_scalper_mt5/nyao_scalper.mq5
Author SHA1 Message Date
4e7bc7b855 update version and README.md 2026-06-11 14:19:47 +07:00
d24d844b8a feat: add risk reward tp sl 2026-06-11 14:13:05 +07:00
cd743b42fe fix(hedge): partial-close before closing older in reseed (clean failure)
If the reseed's partial close failed AFTER the older leg was already closed, the
hedge was released to loss management at full (un-reduced) size. Now the partial
close runs FIRST; on failure the chain is left fully intact and the caller
releases both legs cleanly via ReleaseChainToLossMgmt - never a half-dismantled
chain.
2026-06-03 02:03:53 +07:00
1aeca0a330 fix(hedge): floor graduated hedge SL at recovery level (no net give-back)
After COVERED closes the older leg, the hedge's break-even lock only floored the
SL at the hedge's OWN entry, so it could trail back down and the pair ended net
negative even though coverage hit HedgeRecoveryPct momentarily. The graduated
hedge now carries a hedgeLockProfit = coverNeeded (HedgeRecoveryPct% of the
older leg's locked loss); ManageTrailingTPSL floors the SL at that profit level
(independent of the trailing gate) so the pair can never net below the recovery
target, while HedgeTrailATR still rides the SL above it.
2026-06-03 01:34:11 +07:00
22ad19a4fe fix(meta): shorten license tag in description to fit 512-char limit
Drop the 'License' word from the BSD-3-Clause tag in the #property description block. The combined description exceeded MQL5's 512-char total cap, causing a compiler warning and truncation of the last description line in the compiled .ex5. Keeps the correct BSD-3-Clause SPDX name.
2026-06-03 00:26:25 +07:00
fefe8625df fix(hedge): trail graduated hedge at HedgeTrailATR (lot-independent)
A graduated/released hedge carries a large martingale lot. The dollar-based
TrailingDistanceValue converts to a near-zero PRICE gap on that lot, so the
trailing stop landed at market and closed the position instantly (or via the
emergency-close on a rejected too-tight modify) - cutting profit that could
have run. Graduated and released chain legs now trail at HedgeTrailATR x ATR
(default 1.0, lot-independent); set 0 to use the normal trailing settings.
Added HedgeTrailATR to all profiles.
2026-06-03 00:17:43 +07:00
ac1d66279e feat(hedge): gate chain start on reverse-direction signal (anti-spike)
A wick/spike that crosses HedgeTriggerATR intrabar no longer opens a doubled
hedge: the chain only starts when the reverse-direction signal score >=
HedgeMinSignalScore (HedgeRequireSignal, default on). If it was a spike the
position recovers; if the reversal is real the score builds and the hedge
fires on a later tick. Added the two inputs to all profiles (score matched to
each profile's entry threshold) and documented the gate.
2026-06-02 23:57:30 +07:00
1e6ac6bf01 fix(hedge): release exhausted chains to loss mgmt; exempt chains from basket stop
- Active hedge-chain legs are excluded from CheckBasketStop, so a chain's
  intentional transient drawdown no longer trips the portfolio basket stop;
  released legs are covered by it again.
- At max cycles / lot ceiling the chain is RELEASED to adaptive loss
  management (flagged noRehedge) instead of being force-closed.
- Hard chain loss cap (HedgeMaxChainLossPct) now defaults to 0 (off); the
  chain is bounded by cycles + max lot, then released.
2026-06-02 20:51:14 +07:00
d450356604 feat(hedge): add rolling martingale hedge chain recovery
Rolling reverse-hedge that recovers losing positions: auto-recovery lot
sizing (computed to cover the loss within an ATR move), cycle reseeding
(partial-close the deepest hedge instead of unbounded lot growth), and an
equity-% / fixed-$ chain loss stop. Opt-in via EnableHedgeChain. Chain legs
are excluded from normal trailing/loss-management while active.
2026-06-02 09:02:35 +07:00
3b251230be feat: v42 risk safety, signal quality, and profile consistency
Risk safety:
- Add max-spread entry gate (fixed or ATR-auto) in IsAllowedToOpenPosition
- Add portfolio basket stop: close-all + pause on aggregate floating loss
- Guardrail drawdown lot scaling (cap steps; disable during cooldown/basket loss)

Signal quality:
- New-bar entry gate (stable signals, honest backtests); mgmt still per-tick
- Dead-market filter: zero signal when ATR/AvgATR < MinVolRatioToTrade
- Multi-bar EMA slope via SlopeLookback
- Remove chop/volatility positive floor (low tiers default 0.0); recalibrate thresholds

Code & repo:
- Unify CheckBuy/SellConditions into direction-driven CheckEntryConditions
- Add .gitignore; stop tracking compiled nyao_scalper.ex5

Profiles:
- Unify SL units to percent-of-equity across all 5 profiles with a coherent
  per-trade risk ladder; wire in new safety inputs; recalibrate signal thresholds

Docs: README updated with new features, profile tables, and honest-backtest guidance
Bump version 41.0 -> 42.0 (compiles: 0 errors, 0 warnings)
2026-05-31 02:13:34 +07:00
a68b020385 refactor: optimize signal scoring for M1 scalping and update settings profiles
- Eliminate duplicate component extraction in GetSignalStrength (~135 lines removed)
- Add per-tick signal caching to avoid redundant calculations
- Remove unnecessary 30-bar buffer floor in ComputeRawScore
- Optimize default settings for M1: faster EMAs, shorter lookbacks, higher blend
- Update all 5 settings profiles (aggressive/safe-aggressive/default/balanced/safe)
- Update README with settings comparison table and account size recommendations
2026-03-12 16:34:56 +07:00
43d5d61859 feat: allow disabling MinBreakEvenProfit trailing by setting it to 0 2026-03-12 15:19:35 +07:00
5dbc4d71ce update version and settings 2026-03-10 16:43:00 +07:00
db20aafad0 fix: resolve unsupported filling mode error for XAUUSD 2026-03-10 16:23:39 +07:00
192fa19a55 update version and settings 2026-02-27 15:33:22 +07:00
ee32af04a1 feat: implement signal strength smoothing & health improvements
- Replace includeCurrentCandle boolean with blended weighted average
- Add ComputeRawScore() helper for per-candle scoring
- GetSignalStrength() now blends N closed candles + dampened current candle
- New inputs: SignalSmoothingCandles (default 3), CurrentCandleBlend (default 0.25)
- Update all 10 call sites to use unified smoothed score
- Dashboard shows smoothed score + raw closed-candle reference
- EvaluatePositionHealth: smoothed indicator inputs (EMA, RSI blended)
- EvaluatePositionHealth: graduated trend score with EMA slope awareness
2026-02-27 15:33:16 +07:00
ec0a4b27c9 update version and settings 2026-02-27 14:12:04 +07:00
5c02a4da19 feat: add profit offset SL tightening for losing positions
Track consecutive winning trades closed while a losing position is open,
then tighten SL to reduce max loss by accumulated realized gains.

- Add inputs: EnableProfitOffsetSL, ConsecutiveWinsRequired, MinOffsetProfit
- Extend ManagedPosition with per-position profit offset tracking fields
- Update SyncManagedPositions to accumulate/reset wins per open position
- Add Step 5 in ManageLosingPositions for profit-offset SL calculation
- Move SL to break-even when accumulated profit exceeds original risk
2026-02-27 14:04:41 +07:00
cf2d77ebd5 feat: add consecutive candle threshold escalation to prevent peak entries
- Add ConsecutiveCandleThresholdBoost and MaxConsecutiveCandleBoosts input parameters
- Track consecutive trading candles per direction (buy/sell independently)
- Raise minimum signal threshold progressively for each consecutive candle that opened positions
- Resets when a candle passes without opening any position in that direction
- Fix self-assignment bug: currentBarTime = currentBarTime -> currentBarTime = currBarTime
- Move SIGNAL DAMPENING comment to correct position after candle escalation block
2026-02-27 13:36:05 +07:00
b94a416a53 update version and settings 2026-02-27 00:42:58 +07:00
25a2cc7743 feat: add configurable MaxTradesPerCandle setting
- Replace hardcoded 1-trade-per-candle limit with MaxTradesPerCandle input

- Default 1 (same behavior), 0 = unlimited, 2+ allows re-entry after close
2026-02-27 00:34:52 +07:00
a3ffe9ce6c clean comments 2026-02-27 00:34:52 +07:00
aaf4f465de refactor: simplify lot sizing to equity-drop recovery only
- Remove signal strength-based lot increase

- Remove velocity boost from lot sizing

- Remove VelocitySizeWeight input parameter

- Gate equity-drop lot increase behind MinSignalStrengthForLot
2026-02-27 00:34:45 +07:00
64d0c6913e feat: add position-aware signal dampening to prevent compounding losses
- Add Signal Dampening Settings input group (6 new parameters)

- Add GetOpenPositionLossState() helper to scan open position P&L

- Hard-block new entries when N same-direction positions are losing

- Apply score penalty per losing same-direction position

- Raise signal threshold during equity drawdown

- Track consecutive losses and activate cooldown after 3+ losses

- Core GetSignalStrength() indicator logic remains untouched
2026-02-27 00:33:10 +07:00
f387c42b81 fix dashboard not updating status during paused states 2026-02-26 09:13:06 +07:00
f8da4ee9ae feat: enhanced loss management with partial close, SL tightening, break-even lock & re-entry (v36.0)
- Add scaled partial close (3-level signal decay: 75%/50%/25%)
- Add dynamic SL tightening proportional to health score
- Add break-even lock when profit exceeds spread cost
- Add virtual SL re-entry at better price after health exit
- Optimize defaults for M1 XAUUSD (MinHealthScore=0.40, MaxAdverseATR=1.5, GraceBars=2)
- Add PartialClosePosition and TryVirtualSLReentry helper functions
- Extend ManagedPosition struct with partialCloseLevel and breakEvenLocked
- Bump version to v36.0
2026-02-25 13:33:19 +07:00
470791a53e removed pyramiding positions feature 2026-02-25 12:47:15 +07:00
58cd21325d fix compute final lot size before SL/TP conversion to fix dollar/percent accuracy 2026-02-25 10:13:06 +07:00
61d23f8b73 fix high impact news start time being late 2026-02-20 19:53:17 +07:00
5474f70e13 initial commit 2026-02-10 20:35:56 +07:00