A Supertrend flip on Gold (XAUUSD) counts only when the candle closes beyond the band. At every new candle this EA rebuilds the Supertrend on closed bars, ATR 10 and multiplier 3.0 by default, and opens one position when the last closed candle changed the trend: a buy on a flip up, a sell on a flip down. The lot is calculated from the stop distance, so the trade risks the percent of balance or equity you set.
The stop goes at the Supertrend line plus a buffer, or at a fixed distance in points. The target is a multiple of that stop distance, 2.0 by default. When price moves 1.0 times the stop distance in favour, the stop moves to the entry price plus an offset. An opposite flip closes the position.
Supertrend follows trends and flips back and forth in a range, so sideways markets bring losing streaks. If the calculated lot is below the broker minimum, the minimum lot is used and the risk is higher than your percent. Test in the Strategy Tester first.

Any symbol and any timeframe, on hedging or netting accounts. All distances are in points of the symbol, so check the values for your broker digits. It keeps one position at a time for its symbol and magic number, and a flip that arrives while a position is still open does not add a second one. Before every order it checks the free margin with OrderCalcMargin and skips the order if it is not enough. Decisions are taken once per candle on closed bars, the breakeven is checked on every tick. The status is a plain text comment on the chart. The EA does not draw the line: to see it, add Supertrend Gold Signals with the same ATR period and multiplier, it uses the same formula. This first version passed the automatic validation of the MQL5 Code Base. The defaults are a starting point, not an optimised set.
Run your own backtests on XAUUSD, XAGUSD, EURUSD, GBPUSD, US30 and NAS100, on M15, H1 and H4, and compare multipliers 2.0, 3.0 and 4.0. The code is split in small functions you can lift into your own EA: XP_Supertrend returns the trend of the last two closed bars and the line, XP_Lot sizes the position from a price distance, XP_MarginOk checks the margin and XP_Breakeven moves the stop. XP_TryOpen is the place to plug a session or news filter, a higher timeframe trend check, Smart Money Concepts levels or support and resistance before the order is sent.
Open source. Use it as it is, adapt it, build your own version on top of it.
New versions and new tools are announced first on my MQL5 channel: https://www.mql5.com/en/channels/xander
Questions, suggestions and your own backtests are welcome in the Xander Lab group: https://www.mql5.com/en/messages/02eec85e4364dd01
More tools on my profile: https://www.mql5.com/en/users/09151993a
Provided as is, use at your own risk.
Daily Pivot Points – Classic, Fibonacci and Camarilla
Daily pivot point with three resistance levels and three support levels, using Classic, Fibonacci or Camarilla formulas.
CreyesHistoryCSV - Closed trades to CSV with summary
Script that exports the closed trades of your account to a CSV file and prints a short summary: trades, win rate, net result and profit factor.
Accelerator Oscillator (AC)
The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.
MACD Signals
Indicator edition for new platform.