Three custom MT5 indicators for visual/manual chart reference — ports of this project's
TradingView Pine Script indicators (see README_pinescript.md) and, where applicable,
bot.py's own indicator functions. None of these feed the trading bot itself; test_bot()
computes everything it needs directly in Python via add_indicators().
These were written without access to a compiler — verify each compiles cleanly in MetaEditor before running it live, and report back if you hit any errors.
MT5 has a hard constraint Pine Script shares: one indicator can draw to the main chart
window OR one separate sub-window, never both. That's why ADX_Stochastic_Choppiness.mq5
is separate from the two chart-overlay files — it can't be merged in.
The original, minimal port — just the trailing trend-flip line, colored lime (bullish) /
orange (bearish). Uses SMA-smoothed high/low internally (ta.sma equivalent), matching
bot.py's current HalfTrend().
| Input | Default | Purpose |
|---|---|---|
| Amplitude | 2 | Lookback for the high/low EMA and highest-high/lowest-low range |
ADX/+DI/-DI (blue/lime/red), a double-EMA-smoothed Stochastic %K/%D (aqua/red — hand-rolled
rather than using MT5's built-in iStochastic, since that smooths with SMA by default and
wouldn't match the Pine script's ta.ema-based smoothing), and the Choppiness Index (orange,
same formula as bot.py's ChoppinessIndex()). Reference levels at 80/20 (stochastic) and
61.8/38.2 (Choppiness choppy/trending thresholds) are drawn automatically.
| Input | Default | Purpose |
|---|---|---|
| DI Length | 14 | True range / +DM / -DM Wilder smoothing length for +DI/-DI |
| ADX Smoothing | 14 | Separate Wilder smoothing length for ADX itself (from DX) |
| %K Length | 5 | Raw stochastic %K lookback |
| K Smoothing | 3 | EMA smoothing period applied to raw %K |
| D Smoothing | 3 | EMA smoothing period applied to smoothed %K to get %D |
| Choppiness Length | 14 | Lookback for both the true-range sum and the highest/lowest range |
- Copy the
.mq5file(s) into your MT5 data folder'sMQL5/Indicators/directory (or open them directly in MetaEditor via File → Open). - Compile (F7 in MetaEditor) — check the Errors tab for any compile issues.
- In MT5, drag the compiled indicator from the Navigator panel onto your chart.
- Adjust inputs from the indicator's Properties dialog (Inputs tab) as needed.
Same as the Pine Script README: >61.8 is traditionally "choppy," <38.2 "trending," but on your actual XAUUSD 1-minute data the real distribution sits much tighter around the mean (~49.3, 25th-75th percentile 42.7-56.1) than those textbook levels suggest — don't expect the 61.8/38.2 lines to fire constantly at this timeframe.