MTF Trend Channel EA
- Experts
-
Dragan Joksimovic
MQL4 / MQL5 Expert Advisor and Indicator Developer
I develop and test Expert Advisors, indicators and trading utilities for MetaTrader 4 and MetaTrader 5 based on clearly defined trading rules.
My work includes:
• Expert Advisors for MT4 and MT5
• Custom indicators - 버전: 1.13
- 활성화: 5
MTF Trend Channel EA trades pullbacks to the middle line of a higher-timeframe trend channel. The channel is built on a higher timeframe of your choice (H1 by default): the middle line is a moving average, the upper and lower lines are the moving average plus and minus the Average True Range. The slope of the moving average on the last closed bars gives the trend direction. The Expert Advisor calculates the channel itself, so no additional indicator is needed, and it draws the channel on the chart, including the history of the last bars, exactly as it was traded.
How it trades
Trend filter. On the higher timeframe the middle line is the moving average of the closing prices (period, method and applied price are inputs). The channel width is the Average True Range multiplied by a factor. The trend is up when the moving average of the last closed bar is above the value of the bar before it, and down otherwise. All values come from closed bars of the higher timeframe and stay fixed until the next bar of that timeframe closes, so the channel never repaints.
Entry in pullback mode (default). A closed candle pulls back to the zone around the middle line and closes on the side of the trend. In an up trend the low of the candle reaches the middle line plus the touch zone and the candle closes above the middle line: a buy. In a down trend the high of the candle reaches the middle line minus the touch zone and the candle closes below the middle line: a sell. The candle that is checked is either the closed higher-timeframe candle (default) or the closed candle of the chart timeframe. There is one entry per direction per higher-timeframe candle.
Entry in crossover mode. The close crosses the middle line in the direction of the trend. An optional band in points requires the close to pass the line by that distance before the signal counts.
Exit. Two rules are available: the opposite crossing of the middle line (the position is closed and a new one is opened in the new direction), or the close comes back inside the channel after it has been outside it. The opposite crossing can close positions in every mode, and an opposite entry signal can optionally always close and reverse the position.
Signals. Crossover and exit signals are read from the live price on every tick (default) or only from closed candles of the chart timeframe. An entry signal can stay valid for a number of seconds, so an entry that could not be sent on the first tick (spread filter, session edge) is retried instead of being lost. The candle that was already closed when the Expert Advisor started can be skipped.
Protection and money management
Stop loss: none, a fixed distance in points, or beyond the opposite channel line with an offset. Take profit: none, a fixed distance in points, or the opposite channel line. A trailing stop in points with a step and a start distance. Lot size: fixed, or a percentage of the balance at risk per trade (requires a stop loss). Maximum spread filter. Before every request the Expert Advisor checks the free margin (the lot is reduced or the entry is skipped), the stop level and the freeze level of the broker, the volume limit and the trade mode of the symbol, and the trade sessions of the symbol. It works on netting and hedging accounts. All distances are set in points.
On the chart
The channel is drawn on the chart: the three lines of the current higher-timeframe bar and the history of the last bars (200 by default), as the Expert Advisor traded it. An information block shows the higher timeframe and its settings, the trend direction, the channel values, the open positions and the pending signal.
Inputs
MTF channel
- Higher (MTF) timeframe: H1
- MA period: 20
- MA method: Simple
- MA applied price: Close
- ATR period: 14
- Channel width, ATR multiplier: 1.0
Entry
- Buy on a pullback in an up trend: true
- Sell on a pullback in a down trend: true
- Entry mode: pullback (or crossover)
- Touch zone around the middle line, points: 30
- Band in points the close must pass (crossover mode and exits): 0
- Maximum spread, points: 0 (no filter)
Signals
- Pullback candle: closed higher-timeframe candle (or closed chart candle)
- Entry signal stays valid, seconds: 0 (first tick only)
- Crossover and exits on closed chart candles only: false (live price)
- Skip the already closed candle after start: false
Exit
- Exit rule: opposite crossing (or the close comes back inside the channel)
- Opposite crossing closes positions: true
- Opposite entry signal always closes and reverses: false
Stop loss and take profit
- Stop loss mode: none (or fixed points, or beyond the opposite channel line)
- Stop loss, points: 300
- Channel stop offset, points: 20
- Take profit mode: none (or fixed points, or the opposite channel line)
- Take profit, points: 600
- Minimum stop distance, points: 30 (widened to the broker stop level)
Trailing stop
- Trailing stop, points: 0 (off)
- Trailing step, points: 10
- Trailing start, points: 0 (after the trailing stop distance)
Money management
- Fixed lot: 0.10
- Risk percent of balance per trade: 0 (fixed lot)
- Reduce the lot to the free margin: true (otherwise the entry is skipped)
Trade
- Maximum deviation, points: 30
- Magic number: 260922
- Order comment: MTFT
- ECN mode (open without stops, then modify): false
Display
- Show information on the chart: true
- Draw the channel: true
- Channel history, higher-timeframe bars: 200
- Colours of the upper, lower and middle line
