Unisciti alla nostra fan page
- Visualizzazioni:
- 233
- Valutazioni:
- Pubblicato:
-
Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance
Session Range Desk MT5 — version 4.01
Session Range Desk is an educational, source-available session-range breakout Expert Advisor for MetaTrader 5 hedging accounts. It combines a range filter, stop-distance position sizing and a chart panel. Copies on different symbols can display a shared desk view through terminal global variables. It uses no grid, martingale or averaging scheme.
Trading sequence
At the first eligible tick at or after the configured server start time, the EA takes the highest high and lowest low of the previous LookbackCandles completed bars on the chart timeframe. This is a trailing-bar range, not a continuously accumulated opening session. If its width is outside the configured ATR band, that day's signal is skipped. Otherwise, price touching the boundary or a completed bar closing beyond it can trigger a market order. The opposite range edge is supplied as the stop. The intended limit is one successful entry per symbol per server day during uninterrupted operation.
Optional management includes an R-multiple target, break-even and partial close. R refers to the initial entry-to-stop distance. At the configured end time, the EA attempts to close its matching position on an incoming tick. Execution remains subject to the broker and available prices.
Inputs
- StartHour / StartMinute: server time after which the completed-bar range is established. EndHour / EndMinute: same-day forced-close attempt time. Use a start earlier than the end; overnight sessions are not implemented.
- LookbackCandles: number of previous completed chart bars. BreakoutMode: touch or completed-bar close.
- ATR_TF / ATR_Period: ATR timeframe and period. Min_ATR_Mult / Max_ATR_Mult: accepted range-width interval relative to the last completed ATR value.
- RiskPercent: target entry stop-distance risk as a percentage of balance. MaxDailyRiskPct: shared desk commitment threshold used before entry; it is not an account equity stop or a guaranteed daily loss limit.
- SkipOnMinLot / MinLotTolerance: whether to skip an entry when the broker's minimum volume would exceed target risk beyond the allowed percentage overshoot.
- UseTP / TP_R: enable and set the fixed R-multiple target.
- UseBreakEven / BE_Trigger_R / BE_Target_R: enable break-even, its trigger and the new stop relative to entry in R. A stop at entry does not cover commissions or guarantee a zero-loss fill.
- UsePartialTP / PTP_Trigger_R / PTP_Percent: enable partial close, its R trigger and percentage. The partial close is skipped when the volume cannot be split within broker limits. Place a partial-close trigger below the fixed target if it should occur before that target.
- MagicNumber / DeskName: matching identifiers for participating copies in the same terminal. Use one copy per symbol, identical desk settings and a dedicated magic number. Coordination does not extend across terminals.
- ShowPanel / PanelCorner / PanelX / PanelY: panel visibility, corner and offsets. ShowChartLevels independently controls range and trade drawings. Both drawing paths are disabled during optimization and nonvisual testing.
Installation and initial checks
Place SessionRangeDesk.mq5 under MQL5/Experts and compile it in MetaEditor. Only the standard Trade, PositionInfo, SymbolInfo and Canvas include files supplied with MetaTrader 5 are needed. Begin in the Strategy Tester and on a hedging demo account. The supplied screenshot illustrates the panel on a USDJPY M15 custom-symbol test; it is not a recommended production preset or proof of profitability. No optimized set files are distributed.
Important limitations
This release is a programming example, not a certified account-protection system. The desk bus is not an atomic cross-chart risk reservation: simultaneous signals, stale heartbeats, volume rounding and execution costs can make actual exposure differ from the threshold. It does not enforce account-wide equity or third-party prop-firm rules. Single-symbol optimization does not validate multi-chart coordination.
The day-end close is a tick-driven attempt. Version 4.01 marks the day-end action complete even if the broker rejects that close, so it must not be relied upon as a guaranteed flattening mechanism. Restart recovery does not establish a persistent once-per-day entry lock for all situations. Test these failure modes before considering unattended use. Netting partial-close behavior is not supported by this release.
Local regression tests compared trade records with graphics enabled and disabled, and the stored standalone compilation log reports zero errors and zero warnings. These checks are not live or real-tick performance validation. Earlier synthetic cost assumptions were corrected during research; no historical profit, drawdown or speed claims are made in this publication. Broker-specific spread, commission, swap, slippage, volume steps and stop restrictions require separate checks.
AI tools assisted code revision, research review and preparation of this description. The source and limitations are provided for inspection and testing; no return, safety or platform acceptance is guaranteed. 
Change in State of Delivery
Concept: Identifies market microstructure turning points based on ICT/SMC principles.
Order Block Detector
Detects order blocks — the last opposing candle before an impulsive move that breaks market structure — and draws them as zones that extend live until price returns and mitigates them. Structure breaks and mitigation are both evaluated only on closed bars, so nothing repaints.
Position Peak Logger - how far your trades actually travelled, in R
Records the maximum favourable and adverse excursion of every position in R multiples and writes one CSV row per closed trade.
TradeHistoryLogger
Exporting your deal history is easy and a dozen scripts already do it..