Svetofor Contrarian

SvetoforContrarian is a long-only, contrarian Expert Advisor for daily (D1) charts. It waits for a completed daily bar on which all of its checks are bearish at the same time — trend slope, smoothed momentum and RSI state — and then opens a buy position against that alignment, on the assumption that a one-sided daily move is exhausted. Each position gets a wide protective stop placed beyond the recent 30-bar low, is sized from a fixed percentage of account balance relative to that stop distance, and is closed by a time exit after 20 signal bars if the stop is not hit first. The EA holds at most one position per chart.

The EA runs on the symbol of the chart it is attached to — one chart per symbol, with a unique magic number per symbol. Preset files are provided for AUDJPY, GBPJPY, CHFJPY, EURJPY, USDJPY and GBPNZD; verified backtest reports for all six symbols are summarized below. The product is a single self-contained file: no DLLs, no custom indicators, no external files, no network requests. It works on hedging and netting accounts; on a netting account, do not trade the same symbol manually or with another EA, because positions would be merged by the account model.

**Key features**

- **Contrarian D1 logic** — buys only after a full bearish alignment on a closed daily bar, not during an unfinished move; signals are evaluated once per bar on closed data only.
- **Risk-based position sizing** — volume is calculated from a set percentage of account balance and the actual stop distance of the specific trade, using the symbol tick value; trades whose calculated volume falls below the symbol minimum are skipped, not forced.
- **Capital protection by design** — every position has a broker-side stop loss from the moment it opens; free-margin, stops-level and trading-session checks run before every order; at most one open position per chart.
- **No dangerous money management** — no martingale, no grid, no averaging, no position additions, no recovery lots. One signal — one position — one stop.
- **Works from small deposits** — position size follows the risk percentage down to the broker minimum volume; if the minimum volume already exceeds the intended risk on a small account, the trade is skipped and the reason is written to the journal.
- **Transparent operational journal** — the journal records opened/closed orders, skipped orders (volume below minimum, insufficient margin) and execution errors with retcodes, so the EA state can be audited without exposing signal internals.

**Who it is for**

- Traders who prefer rare, rule-based daily decisions over intraday activity — in the backtests below the EA opened 14–18 trades per symbol in 22 months, and most positions stayed open for about four calendar weeks.
- Accounts from a few hundred USD upward where the broker minimum volume (typically 0.01 lot) keeps the per-trade risk close to the set percentage with a wide daily stop; the reference tests used 10 000 USD at 0.5% risk per trade.
- Users who accept a slow contrarian profile: long flat periods, individual stop-loss exits, and results that depend on a small number of trades.

**Risk management**

- Fixed fractional sizing: risk per trade as a percentage of account balance (0.5% in the supplied presets), converted to volume through the stop distance and the symbol tick value.
- Broker-side stop loss on every position, set below the lowest low of the lookback window minus an ATR buffer, and validated against the broker stops level before entry.
- A distance filter blocks entries when price has already fallen too far below its long-term average, in ATR units.
- One position per chart; no new entry on the bar immediately following a close.
- Pre-trade checks: normalized volume within symbol limits, free margin via OrderCalcMargin, spread limit (optional, off in presets), trading-time filter (optional, off in presets), and a trading-session guard that suppresses orders outside the symbol session.
- No take-profit target and no break-even move: losses are limited by the stop, while open profit is exposed to reversal until the time exit. This is a deliberate property of the strategy and a material risk to understand before use.

**How it trades**

- Once per new signal bar, the EA reads closed D1 bars only. A buy requires the full set of bearish conditions to hold simultaneously on the last closed bar: the Hull moving average is not rising, the TMA-smoothed CCI and the raw CCI are not positive, and RSI is below its "bullish" border.
- An EMA-distance filter then rejects entries that are too far below the long-term EMA, measured in ATR multiples.
- The order is sent at market at the start of the new bar. In the supplied runs all entries occurred in the first hour of the server day.
- Only long positions are opened. The EA never shorts, never hedges and never adds to a position.
- A 30-second timer heartbeat runs the same once-per-bar logic even if chart ticks are rare; this does not create extra trades.

**Exits**

- **Initial stop** — lowest low of the lookback window (30 bars in presets) minus an ATR buffer (1.5 ATR in presets), attached to the order at entry.
- **Time exit** — the position is closed at market after 20 signal bars if it is still open. In every verified run most trades ended this way (11 of 15 on AUDJPY, 12 of 15 on GBPJPY, 13 of 16 on CHFJPY, 12 of 14 on EURJPY, 13 of 18 on USDJPY, 12 of 14 on GBPNZD); the remaining trades hit the stop loss, and one position each on AUDJPY, EURJPY, USDJPY and GBPNZD was closed by the end of the test period.
- **Optional trailing stop** — a Chandelier-type trailing stop based on the highest high since entry minus an ATR multiple, raise-only, evaluated on closed bars. It is off by default and was off in the verified runs.
- No take profit, no break-even transfer, no partial closes, no reversals.

**What the EA does not do**

- It does not use martingale, grid, averaging, hedging or lot multiplication of any kind.
- It does not trade short, does not scalp and does not react to intraday moves; between daily bars it only manages the stop and the exit schedule.
- It does not guarantee that a calculated trade fits a small account: if the risk-based volume is below the broker minimum, the entry is skipped.
- It does not use news filters, external data, DLLs, WebRequest or custom indicators, and it does not read or write files.
- It does not promise a trade frequency or a return. In flat or persistently bullish markets it can stay out of the market for months.

**Requirements**

- MetaTrader 5 terminal; the EA is attached to one chart per traded symbol. The chart timeframe does not affect signals — the signal timeframe is an input (D1 in presets) — but the chart symbol defines the traded instrument.
- Symbols: presets are supplied for AUDJPY, GBPJPY, CHFJPY, EURJPY, USDJPY and GBPNZD. If your broker uses suffixes or prefixes (for example AUDJPY.pro), attach the EA to that symbol's chart; no symbol-name input is needed.
- Leverage 1:100 or higher is recommended for margin headroom with wide stops; the reference tests used 1:100.
- A VPS or an always-on terminal is recommended: positions are held for weeks and the time exit is executed by the EA, although the protective stop itself is stored on the broker side.
- Hedging accounts are the least restrictive choice. On netting accounts, keep each EA symbol free of manual and third-party positions.

**Presets**

- **Standard (per symbol, as tested)** — SvetoforContrarian_AUDJPY.set / _GBPJPY.set / _CHFJPY.set / _EURJPY.set / _USDJPY.set / _GBPNZD.set. The five JPY-symbol presets share identical strategy inputs (HMA period 20, SL buffer 1.5 ATR, time exit 20 bars, risk 0.5%); only the magic number differs (52010101–52010105). The GBPNZD preset keeps the compiled-in default strategy inputs (HMA period 50, SL buffer 2.5 ATR) with magic number 52010106 — exactly as its published run was made. Note: the JPY presets differ from the compiled-in defaults. Load the .set file to reproduce the published runs.
- **Small account** — use the Standard .set unchanged. Position size scales with balance; expect skipped entries in the journal when the wide stop makes even 0.01 lot exceed the intended 0.5% risk. Do not compensate by raising the risk percentage unless you accept the higher per-trade risk.
- **Conservative** — *_Conservative.set files: identical to Standard except risk per trade 0.25%. Only the money-management input changes; strategy inputs are never changed between presets.
- Every supplied preset has a published reference run below. The EA can also be attached to other symbols, but those are not covered by the author's testing — evaluate them in the tester first.

**How to test**

1. In the Strategy Tester, select SvetoforContrarian, one symbol (for example AUDJPY) and the D1 period for the test range; the EA reads its signal timeframe from the inputs.
2. Load the matching .set preset for that symbol (Inputs tab → Load).
3. Set modelling to "Every tick based on real ticks", deposit 10 000 USD, leverage 1:100, and a period of at least 1.5–2 years ending today.
4. On the first run, let the terminal download the full tick history for the symbol; check that history quality reaches 99–100% before judging results.
5. Run the test, then read the journal: order opens/closes, skipped-order reasons and any retcodes are logged in plain operational form.
6. Repeat per symbol on separate tester runs, each with its own preset and magic number.

**Backtest results**

Six single-symbol runs were made on RoboForex-Pro history, D1, 2025.01.01–2026.10.24, initial deposit 10 000 USD, leverage 1:100, risk 0.5% per trade, history quality 100%. The five JPY symbols used their Standard presets (HMA period 20, SL buffer 1.5 ATR); the GBPNZD run used the compiled-in default strategy inputs (HMA period 50, SL buffer 2.5 ATR), recorded in its preset file. Tick counts, 470 bars each: AUDJPY 32 439 041, GBPJPY 45 989 979, CHFJPY 37 812 655, EURJPY 42 664 430, USDJPY 34 464 813, GBPNZD 43 955 262. Swap is included in all results and differed by symbol at this broker — AUDJPY +22 USD of the +67 USD net, GBPJPY +18 of +106, CHFJPY −37 of +120 (long CHFJPY paid swap), EURJPY +4 of +154, USDJPY +13 of +61, GBPNZD 0 of +40 — swap rates differ by broker and over time and will change live results.

AUDJPY (preset SvetoforContrarian_AUDJPY.set):

- **Total net profit +67 USD** (10 000 → 10 067 USD)
- **Profit factor 1.40**, Sharpe ratio 0.25, recovery factor 0.58, expected payoff +4.50 USD per trade
- **Maximum equity drawdown 1.16%** (116 USD), maximum balance drawdown 0.79% (79 USD)
- **15 trades**, all long; profit trades 53.33% (8 of 15); largest profit trade +83 USD, largest loss trade −45 USD; average profit trade +29 USD, average loss trade −24 USD
- Months with closed trades: 12 of 22 — 7 positive, 5 negative; best month 2026.09 (+83 USD), worst month 2025.02 (−68 USD)
- Average holding time 383:47:19 (tester time, excluding weekends); exits: 11 time exits, 3 stop losses, 1 end-of-test close

GBPJPY (preset SvetoforContrarian_GBPJPY.set):

- **Total net profit +106 USD** (10 000 → 10 106 USD)
- **Profit factor 1.67**, Sharpe ratio 0.35, recovery factor 1.16, expected payoff +7.09 USD per trade
- **Maximum equity drawdown 0.92%** (92 USD), maximum balance drawdown 0.53% (53 USD)
- **15 trades**, all long; profit trades 66.67% (10 of 15); largest profit trade +70 USD, largest loss trade −44 USD; average profit trade +26 USD, average loss trade −32 USD
- Months with closed trades: 14 of 22 — 9 positive, 5 negative; best month 2026.07 (+70 USD), worst month 2025.04 (−44 USD)
- Average holding time 420:45:39 (tester time, excluding weekends); exits: 12 time exits, 3 stop losses

CHFJPY (preset SvetoforContrarian_CHFJPY.set):

- **Total net profit +120 USD** (10 000 → 10 120 USD)
- **Profit factor 1.68**, Sharpe ratio 0.41, recovery factor 0.85, expected payoff +7.49 USD per trade
- **Maximum equity drawdown 1.37%** (141 USD), maximum balance drawdown 0.93% (96 USD)
- **16 trades**, all long; profit trades 56.25% (9 of 16); largest profit trade +83 USD, largest loss trade −46 USD; average profit trade +33 USD, average loss trade −25 USD
- Months with closed trades: 14 of 22 — 8 positive, 6 negative; best month 2025.11 (+83 USD), worst month 2026.07 (−47 USD)
- Average holding time 439:27:44 (tester time, excluding weekends); exits: 13 time exits, 3 stop losses

EURJPY (preset SvetoforContrarian_EURJPY.set):

- **Total net profit +154 USD** (10 000 → 10 154 USD)
- **Profit factor 2.30**, Sharpe ratio 0.50, recovery factor 1.51, expected payoff +10.98 USD per trade
- **Maximum equity drawdown 0.99%** (102 USD), maximum balance drawdown 0.84% (86 USD)
- **14 trades**, all long; profit trades 64.29% (9 of 14); largest profit trade +64 USD, largest loss trade −44 USD; average profit trade +30 USD, average loss trade −24 USD
- Months with closed trades: 12 of 22 — 9 positive, 3 negative; best month 2025.11 (+64 USD), worst month 2026.10 (−42 USD)
- Average holding time 473:29:41 (tester time, excluding weekends); exits: 12 time exits, 1 stop loss, 1 end-of-test close

USDJPY (preset SvetoforContrarian_USDJPY.set):

- **Total net profit +61 USD** (10 000 → 10 061 USD)
- **Profit factor 1.29**, Sharpe ratio 0.25, recovery factor 0.48, expected payoff +3.37 USD per trade
- **Maximum equity drawdown 1.26%** (127 USD), maximum balance drawdown 0.86% (86 USD)
- **18 trades**, all long; profit trades 61.11% (11 of 18); largest profit trade +78 USD, largest loss trade −49 USD; average profit trade +25 USD, average loss trade −30 USD. On this symbol the average loss is larger than the average profit; the outcome rests on the share of profit trades, which is typical for a contrarian exit profile and not a stable property
- Months with closed trades: 15 of 22 — 10 positive, 5 negative; best month 2025.10 (+78 USD), worst month 2025.02 (−54 USD)
- Average holding time 369:35:26 (tester time, excluding weekends); exits: 13 time exits, 4 stop losses, 1 end-of-test close

GBPNZD (preset SvetoforContrarian_GBPNZD.set — compiled-in default strategy inputs, as tested):

- **Total net profit +40 USD** (10 000 → 10 040 USD)
- **Profit factor 1.46**, Sharpe ratio 0.18, recovery factor 0.37, expected payoff +2.82 USD per trade
- **Maximum equity drawdown 1.07%** (108 USD), maximum balance drawdown 0.76% (76 USD)
- **14 trades**, all long; profit trades 57.14% (8 of 14); largest profit trade +36 USD, largest loss trade −50 USD; average profit trade +16 USD, average loss trade −14 USD
- Months with closed trades: 13 of 22 — 7 positive, 6 negative; best month 2025.08 (+36 USD), worst month 2026.01 (−31 USD)
- Average holding time 432:04:40 (tester time, excluding weekends); exits: 12 time exits, 1 stop loss, 1 end-of-test close

The runs contain only 14–18 trades each. That is a small sample: every metric above is indicative, not statistically conclusive, and a few different trades would change the picture materially. These are backtests on one broker's history, not live trading records. Past performance does not guarantee future results. Run your own test on your broker's data and start on a demo account.

**Main inputs**

- **Magic number** — unique ID of the EA's positions; use a different value on every chart (presets use 52010101–52010106).
- **Risk per trade, % of balance** — balance share risked if the stop is hit (0.5 in presets, 0.25 in Conservative presets).
- **Order comment** — comment attached to opening orders ("SvetoforC").
- **Signal timeframe** — timeframe of all calculations (D1 in presets); independent of the chart timeframe.
- **HMA period** — Hull moving average used for the slope check (20 in the JPY presets; 50 in the GBPNZD preset and in the compiled defaults).
- **CCI period / TMA smoothing of CCI** — momentum base and its smoothing length (14 / 5).
- **Raw CCI maximum** — optional stricter raw-CCI cap; 0 keeps the standard "below zero" rule.
- **RSI period / RSI upper border** — RSI length and the level below which the bar is treated as not bullish (14 / 55.0).
- **ATR period** — volatility unit for the stop buffer, the distance filter and the optional trailing stop (14).
- **EMA distance filter (on/off), EMA period, max distance below EMA in ATR** — blocks entries too far below the long-term average (on, 200, 6.0).
- **SL lookback / SL buffer in ATR** — stop placement beyond the lowest low of the window (30 bars; buffer 1.5 in the JPY presets, 2.5 in the GBPNZD preset and in the compiled defaults).
- **Time exit, bars** — scheduled close after this many signal bars (20).
- **Chandelier trailing stop, ATR** — optional raise-only trailing stop; 0 = off (off in presets).
- **Max spread, points** — optional entry spread cap; 0 = off (off in presets).
- **Trade-time filter (on/off), start/end hour (server)** — optional entry window by server time; off in presets.

**FAQ**

- **Why does the EA not open trades?** Entries need the full bearish alignment on a closed D1 bar, the EMA-distance filter passed, no open position on the chart, no entry on the bar right after a close, an acceptable spread/session, a calculated volume at or above the broker minimum, and enough free margin. With D1 signals, weeks or months without an entry are normal — the reference runs produced 14–18 trades per symbol in 22 months. Skipped entries for volume or margin reasons are written to the journal; absence of a signal is silent by design.
- **My broker's symbol has a suffix (AUDJPY.pro). What should I do?** Nothing special: attach the EA to that symbol's chart and load the matching preset. The EA always trades its chart symbol.
- **Can I run several symbols at once?** Yes — one chart per symbol, each with its own preset and magic number. The charts are independent; total account risk is the sum of the per-chart risks, so size the risk percentage accordingly.
- **Can I disable one symbol?** Remove the EA from that symbol's chart (or close the chart). Its open position, if any, keeps its broker-side stop but loses the EA-managed time exit — close it manually if you want a clean stop.
- **Does it work on cent accounts?** The sizing math is currency-based and works the same way, but check the broker's contract size and minimum volume for cent symbols in the tester first; skipped-volume messages in the journal will show if the minimum lot is too large for the set risk.
- **Why can live results differ from the backtest?** Spread and swap schedules, execution price at the daily open, tick history and stops/freeze levels differ by broker. With about 14–18 trades per 22 months per symbol, small differences compound. Test on your broker, then on demo.

**Version history**

- 1.12 — Market build: trading-session guard before order sending, 30-second timer heartbeat for quiet charts, filling mode set by symbol, freeze-level check on stop modification, operational journal messages (skipped orders, execution retcodes). Strategy logic and default inputs are unchanged from 1.11.
- 1.11 — initial version.

**Note**

Trading involves substantial risk of loss and is not suitable for every investor. This Expert Advisor is a software tool that automates the rules described above; it does not provide investment advice and does not guarantee any result. Backtest results shown on this page were obtained on historical data of one broker and do not represent live trading. Test the EA in the Strategy Tester and on a demo account, and never trade money you cannot afford to lose.

Yazarın diğer ürünleri
**StackTrend GoldSilver** is a two-engine trend portfolio for MetaTrader 5: it trades gold (XAUUSD) and silver (XAGUSD) on H1 through two independent engines under strict, percentage-based risk control. Each engine has its own magic number, its own order comment and its own risk budget. The engines do not mix positions, and each of them can also work alone. The EA uses no DLLs, no custom indicators and no external files, and it works on hedging and netting accounts in any account currency. ##
Filtrele:
Değerlendirme yok
Değerlendirmeye yanıt