Case studies

Case study: Supertrend execution bot on gold

The indicator draws its arrow at candle close; manual execution always arrived a candle late and the stop was often forgotten.

  • XAUUSDMarket
  • M30TF
  • MT4Platform
  • 5 weeksDelivery window
  • 5Deliverables
Backtest and forward test method

The client's idea

Reza Amini works XAUUSD on M30; the opening brief was: Take my Supertrend indicator and enter at the exact moment it marks the arrow.

Project and starting point

The indicator draws its arrow at candle close; manual execution always arrived a candle late and the stop was often forgotten.

Solution architecture

The indicator buffer is read only at candle close, signal freshness is checked, the stop comes from the latest swing, and it moves to break-even at a fixed profit.

Reading the buffer only at close removes intra-candle noise. It matches how XAUUSD is actually traded and can be tested against the data already available.

Why this design

Reading the buffer only at close removes intra-candle noise. It matches how XAUUSD is actually traded and can be tested against the data already available.

Implemented capabilities

Modules and components built: Signal-freshness check.

Delivered output:
Supertrend execution bot on gold — XAUUSD (M30)
Specification document and the rule-to-code mapping table
Full MQL4 source, commented
Test report: Historical arrows reconciled with trades
Parameter document and install guide (5 weeks)

Safeguards and risk control

The expert never reads future bars, and it stops opening positions when the connection drops.

Backtest and forward test method

Test method: Historical arrows reconciled with trades.

Testing runs in three stages: a backtest on historical data, limited optimisation inside the contract's scope, and a forward run with the parameters frozen.

Tools and stack: MQL4, the client's indicator code, gold M5 data.

Every figure from this project is published together with its measurement conditions: the data window, the tick model, the spread, the commission and the build of the executable. Without them a number cannot be compared with anything.

Publishable results

The bot took 21 of the 23 arrows in the test window, and the two misses were reported with their cause.

Limitations and cautions

The expert never reads future bars, and it stops opening positions when the connection drops.

Every test result depends on the quality of the historical data, the broker's spread and market conditions, and none of it is a promise about the future. Through a severe price gap or a broker disconnection a stop loss cannot be guaranteed, so behaviour in those conditions must be reviewed separately.

Our next-step proposal

The next step is a chart dashboard showing the live signal and the filters that rejected a trade.

Portfolio

Measured results

These are the figures the test produced — not a promise about future performance.

  • 412 Trades reviewed
  • 0.6 pip Average execution slippage
  • 12.1 % Max drawdown in test
  • 14 Configurable inputs