量化交易系统

MT4-MACD and MA filter

  • 型号:
Main Image

The MACD and MA filter EA trades on the MACD indicator, uses the filter as two moving averages (fast MA is higher than slow MA - buy, sell - contrary), the Martingale is applied at the request of the User (the amount of lot multiplication for a series of losses is limited), breakeven, trailing stop, inverting the signal.

In EA version 1.4. added closing an order by a reverse signal, separately by the MACD indicator (parameter Close_By_Reverse_MACD_Signal), separately by moving averages (parameter Close_By_Reverse_MA_Signal).

In version 1.5. added a separate timeframe selection for the applied indicators

Input parameters:

Indicator MACD:

  • Close_By_Reverse_MACD_Signal = false; Close order by a reverse signal of the MACD indicator
  • MACDfast_ema_period=12; Fast EMA period
  • MACDslow_ema_period=26; Slow EMA period
  • MACDsignal_period=9;  Signal line period
  • applied_price_macd = 0; Used price

PRICE_CLOSE - 0
PRICE_OPEN - 1
PRICE_HIGH - 2
PRICE_LOW - 3
PRICE_MEDIAN - 4
PRICE_TYPICAL - 5
PRICE_WEIGHTED - 6

  • Invert_MACD_sig = false;

If it is off (false), the signal on the MACD indicator is generated as follows:
buy order - if the main line of the indicator has crossed the signal line from bottom to top
sell order - if the main line of the indicator crossed the signal line from top to bottom
If enabled (true), then the signal is formed contrary

  • Zero_Line_Filter = false; (added parametr in version of EA 1.02)
if true: a buy order can be opened if the cross of the main and signal lines of the MACD indicator happens below the zero line of the indicator, a sell order can be opened if the cross of the main and signal lines of the MACD indicator happens above the zero line of the indicator
  • shift_macd = 1; number of the bar from which we take the signal for MACD, 0 - on the current, 1 - on the previous one with confirmation of the signal, and so on.
  • TF_MACD=PERIOD_CURRENT; timeframe of the MACD indicator

Indicator MA:

  • Close_By_Reverse_MA_Signal= false; Close order by a reverse signal of the MA indicator
  • PeriodMA_slow = 200; Period slow MA
  • PeriodMA_fast = 100; Period fast MA
  • ma_shift_slow =0; Slow moving average shift
  • ma_shift_fast =0; Flow moving average shift
  • ma_method_slow = 0; slow moving average averaging method
  • ma_method_fast = 0; fast moving average averaging method

0 - Simple averaging
1 - Exponential averaging
2 - Smooth averaging
3 - Linear Weighted Averaging

  • applied_price_slow = 0; used price of the slow moving average
  • applied_price_fast = 0; used price of the fast moving average
0-closing price
1-opening price
2-Maximum price for the period
3-minimum price for the period
4-median price, (high + low) / 2
5-Typical price, (high + low + close) / 3
6-Weighted Price, (high + low + close + close) / 4

  • shift_ma = 1; bar number from which we take the signal for MA, 0 - current, 1 - previous and so on
  • TF_MA=PERIOD_CURRENT; timeframe of the MA indicator

Orders management :

  • SL = 40; Stop loss
  • TP = 80; Take Profit
  • Lots = 0.01; fixed lot
  • Lot_Koef = 2; lot increase ratio
  • Limit = 3; lot multiplication limit
  • Use_Risk = true; on / off proportional money management
  • Risk = 3; lot size with proportional money management
Trailing stop:
  • Trailing_Use = false; use trailing stop
  • Profit_Level_Trailing = 100; order profit level in points at which the trailing stop starts working
  • TrailingStop = 50; distance at which the stop loss reaches for the price
  • TrailingStep = 50; modification step

Break-even:

  • Breakeven_Use = false; use breakeven
  • Profit_Level = 30; profit level in points, upon reaching which the breakeven is set by the order
  • SL_Plus = 1; breakeven level in points
  • Slip = 5; Slippage
  • Magic = 100; Magic orders
  • Auto_Digits = true; Automatic transfer of points to five-digit / three-digit quotes
  • Buy = true; Trade Buy Orders
  • Sell ​​= true; Trade sell orders