Moving Average Fade Counter Trend
- Experts
- Versione: 2.2
- Attivazioni: 10
Moving Average Fade Counter-Trend is an automated Expert Advisor for MetaTrader 5.
IMPORTANT RISK NOTICE
Trading leveraged products is risky. This EA uses a stop loss on its trades, but a stop loss can be skipped by gaps and slippage. Past or simulated results do not guarantee future results. Test on a demo account first and only risk money you can afford to lose.
How it works
- Uses the 200 period simple moving average on M5 (calculated on M5 whatever chart timeframe is used).
- SELL signal: the last closed M5 candle is above the SMA by at least a multiple of ATR, one of the last two candles made a new N-bar high, and the candle closed red. BUY is the mirror image.
- Stop loss = the extreme of the signal candles plus ATR x a multiplier (0 = no stop loss). Take profit is placed at the moving average and updated every M5 bar.
- A trade is also closed at a set server hour, after a maximum number of M5 bars, or when price touches the line.
- One trade at a time. Lot is fixed or calculated from a risk percentage when a stop loss is used.
Safety and broker compatibility
- Volume is normalized to the symbol minimum, maximum and step before every order.
- Free margin is checked with OrderCalcMargin before an order is sent.
- Stops level and freeze level are respected when placing or modifying orders and SL/TP; a modification is not sent when the values are unchanged and nothing is modified inside the freeze zone.
- Symbol trade mode, trading session, order limit and filling mode are checked before sending requests.
- No DLL, no web requests, no files are written.
BOTKRIT recovery core and dashboard
This build includes a basket recovery core and a standard BOTKRIT panel. When the open basket of this EA loses more than the set percentage of the balance the EA pauses its own new entries and the core can open balancing (hedge) trades with its own magic number until the basket can be closed at break-even plus a target; the basket is cut at the set loss percentage. Balancing trades can increase exposure. The core works on hedging accounts only and can be switched off with InpRKOn = false. The panel can be collapsed and moved to another corner.
Inputs
- InpSide (default FS_SELL): Trade side
- InpMaPeriod (default 200): SMA period (M5)
- InpLookback (default 48): New high/low lookback in M5 bars (48 = 4 hours)
- InpMinDist (default 1.0): Close must be at least ATR(M5) x this away from the SMA (0 = no filter)
- InpFrom (default 01:00): Entries allowed from (server time)
- InpTo (default 22:00): Entries allowed until
- InpSlATR (default 2.0): SL = extreme + ATR(M5) x this (0 = no SL)
- InpTpBroker (default true): Set broker TP at the SMA (updated every M5 bar)
- InpExitHour (default 23): Close the trade at this hour (server time, 24 = off)
- InpMaxBars (default 288): Maximum holding time in M5 bars (0 = unlimited)
- InpLot (default 0.01): Fixed lot
- InpRiskPct (default 0): Risk % of equity per trade (needs SL, 0 = fixed lot)
- InpMaxSpread (default 0): Maximum spread in points (0 = no limit)
- InpMagic (default 26101801): Magic
- InpComment (default MA200F): Comment
- InpPanel (default true): Summary text top-left
Recovery core and dashboard inputs:
- InpRKOn (default true): Recovery core on/off: when the basket loss grows, new entries of the EA are paused and balancing trades can be opened until the basket closes
- InpRKStartPct (default 3.0): Start recovery when the basket loss exceeds this percent of the balance at basket start
- InpRKStartATR (default 3.0): or when price runs against the net position by this many ATR (0 = off)
- InpRKCutPct (default 30.0): Close the whole basket at this percent loss of the start balance
- InpRKShockATR (default 10.0): Shock distance to survive (ATR multiples), used for the lot ceiling
- InpRKMinMargin (default 300.0): Do not open a recovery trade if the margin level after opening would be below this percent
- InpRKSpreadMul (default 2.0): Pause recovery trades when the spread is above this multiple of the 60-minute median
- InpRKCorner (default bottom right): Corner of the BOTKRIT panel
- InpRKBar0 (default FULL): Bar-0 label (basket profit, spread and leverage)
Recommended setup
- Works on any symbol; designed for M5 signals (the chart can be any timeframe). Check the Maximum spread input on wide-spread symbols.
- Minimum capital: A balance of 500 USD or more with the default 0.01 lot.
- Test on a demo account first and keep the lot small.
