UPDATE INSTALLATION
Replace BOTH files together: PIPSWAY_Candle_M1.mq5 and CandleRules.mqh.
Remove the old EA from the demo chart while flat, copy both into the same
Experts folder, compile the .mq5 with F7 in MetaEditor, and attach again.
Verify Inputs: UseFixedRiskUSD=true, FixedRiskUSD=1.50, MaxSpreadATR=0.25,
AllowLiveTrading=false. Do not load an old settings preset over these values.
The name/magic is unchanged so an existing tagged position would still be
managed; prefer upgrading with no position open. Source compilation and broker
execution must still be tested in MT5. Website files have not been changed.

PIPSWAY CANDLE M1 — 1.001
Separate gold robot. Experimental source, not a proven strategy.

INSTALL
Remove PIPSWAY_Scalper and any older robot from the demo chart first.
Extract this ZIP. Copy BOTH PIPSWAY_Candle_M1.mq5 and CandleRules.mqh into
MT5 > File > Open Data Folder > MQL5 > Experts (same folder).
In MetaEditor (F4), open PIPSWAY_Candle_M1.mq5 and compile (F7).
Require 0 errors. Refresh Navigator > Expert Advisors and attach
PIPSWAY_Candle_M1 to XAUUSDm (Exness) or GOLD (XM), M1, on DEMO.
Leave AllowLiveTrading=false. Enable Allow Algo Trading in EA settings and
Algo Trading on MT5's toolbar. Keep PC awake, online, and MT5 running.
No DLL, broker password, website or external service required by the source.

RULES
Wait until the NEXT M1 candle after attachment, then read the completed
previous M1 candle. Close > open: buy; close < open: sell; equal: skip.
DojiPoints defaults to 0 (only exact equality). Raising it skips bodies no
larger than that many symbol points. No FVG, support/resistance, or trend filter.
Attempt one market entry on the first observed tick of the new minute, after
closing any expired position belonging to this EA. No retries of entry during
that candle. Skip if first tick/entry processing is >5 seconds after bar start,
or the previous candle is not consecutive (e.g. a market-session gap).
The M1 timeframe is fixed in code regardless of the attached chart timeframe.

EXIT
At the first tick of the NEXT M1 candle, attempt to close this EA's position,
whether winning or losing, even if the new signal is doji. A server-side
stop-loss may close it earlier. There is no take-profit; planned exit is time.
A failed/partial close blocks new entries; retry the close on later ticks.
Restarting MT5 does not discard an overdue tagged position: it is checked on
the first tradable tick. There is no guarantee of an exact 60-second hold.
No quote, disabled Algo Trading, disconnection, closed market, latency or broker
rejection can delay closure. Closing a trade manually does not disable the EA.
Disable Algo Trading to stop automated entries AND exits, and separately check
and manage any remaining open positions.

RISK / COSTS
Default UseFixedRiskUSD=true and FixedRiskUSD=1.50: size the trade so its
estimated price-to-stop loss is at most US$1.50, rounding volume DOWN to broker
steps. Fixed mode only opens trades on accounts with currency USD. It does NOT
convert ZAR or USC/cents to dollars. For non-USD accounts it skips entries;
management of already-open positions still runs.
RiskPercent is ignored in fixed mode. Set UseFixedRiskUSD=false to restore
percentage mode (default RiskPercent=0.5, valid range >0 through 2).
If fixed budget exceeds lower balance/equity, entries skip. At US$20, US$1.50
is 7.5% per trade; at US$10 it is 15%. Repeated losses can deplete funds quickly.
No daily loss cap exists. No live trading is enabled by this update.
Stop distance uses 1.0 x completed M1 ATR(14), widened for broker minimum stop
distance and spread. If the minimum lot risks more than the selected budget,
it still skips the trade. An earlier US$1.17 estimate could fit US$1.50, but
current conditions can change. This does not guarantee a trade or exact loss.
Stops do not guarantee a maximum loss: slippage, gaps, commissions, swaps and
execution conditions can increase loss. Margin buffer is checked.
Spread limit=0.25 x M1 ATR(14). Spread filtering only blocks entries, not exits.
One account position/order at a time including manual/other EA trades.
Use ONE instance per account; a terminal-local guard reduces repeated entries
on the same bar but does not coordinate separate PCs/terminals/VPS instances.
Distinct magic number=26102001. This EA does not manage other bots' positions.
No martingale, daily loss limit or daily trade cap. Frequent trades incur costs;
previous candle direction alone does not establish a profitable edge.

VALIDATION
Portable C++ tests passed for the actual shared candle direction/exit-time
rules (bullish, bearish, exact doji, threshold doji, same-bar hold, next-bar
exit and overdue restart exit). These do NOT test MQL5 trading integration.
This delivery has NOT been compiled in MetaEditor or backtested in MT5.
Compile first, then test with broker gold data in Strategy Tester, real ticks
when available, realistic spreads/fees, currency, leverage and deposit.
Check buys/sells, doji skips, SL, next-bar close, stop-out-before-next-bar,
close rejection/partial close, missing ticks, permissions, restarts, manual
positions and small-balance risk rejections. Forward-test on demo.
Experts tab reports skip reasons; compilation success is not profitability.
The PIPSWAY website download remains a different older robot.

REFERENCE
https://www.mql5.com/en/docs/standardlibrary/tradeclasses/ctrade/ctradepositionclose
