Write a complete MT5 Expert Advisor in MQL5 (not MQL4) for a time-range
breakout. Name it "RX Range Breakout". Use the standard library class CTrade.
No DLLs, no file access, no network access.

Rules. All times are broker server time. Use the symbol and timeframe of the
chart the EA is attached to.

1. Range: the highest high and lowest low of all bars that open from
   RangeStartHour (default 0) up to, but not including, RangeEndHour
   (default 8) of the current server day.
2. Entry window: bars that open from RangeEndHour up to, but not including,
   LastEntryHour (default 16). Decide once per closed bar, never on the
   unfinished bar. Buy at market when a bar closes above the range high.
   Sell at market when a bar closes below the range low.
3. At most one trade per server day. After a restart, find out from the
   account history whether today's trade already happened and do not trade
   again.
4. Stop loss at the opposite side of the range. Take profit at RewardRisk
   (default 1.5) times the stop distance, measured from the entry price.
5. Volume: risk RiskPercent (default 1.0) of account equity if the stop is
   hit. Compute it from the symbol's tick value and tick size and round down
   to the volume step. Below the minimum volume: skip the trade and log why.
   Above the maximum volume: use the maximum.
6. Skip the entry when the spread exceeds MaxSpreadPoints (default 30), when
   no bar exists inside the range window, or when stop or target is closer
   than the symbol's minimum stop distance.
7. If neither stop nor target was hit, close the position at CloseHour
   (default 21).
8. Only touch positions and deals with this EA's magic number (an input) on
   this symbol. It must work on netting and on hedging accounts.
9. Check the result of every trade request and log the return code. Do not
   resend a failed request in a loop.
10. Draw each day's range as a rectangle on the chart.
11. Log one line per decision: the range values, the signal, a skipped entry
    with its reason, the order result and the time exit.

First restate the rules in your own words and list everything that is
ambiguous, with the assumption you chose. Then give the complete source in
one file. Do not claim that you compiled or tested the code.
