• Overview
  • Reviews (3)
  • Comments (5)
  • What's new

Martingale EnvBBmacd

Martingale EnvBBmacd EA trades using the signals of the following indicators: Envelopes, Bollinger Bands (BB), Moving Average Convergence/Divergence (MACD) and Simple Moving Average (SMA).

It enters the market on receiving signals from Env, BB, MACD and SMA and considering the selected mode. The orders are closed by MACD signal managing the profit of each open position, or by stop loss. The Stop Loss level for the first and next orders is set according to the selected mode: daily timeframe with a specified step or using Env and BB indicators' parameters.

The trading volume used for opening positions depends on the Max_order and Risk_money_SL parameters, as well as on the stop loss selection mode. Martingale system, which proportionally increases the trade volume according to the set parameters, is applied when you open a trade.

The EA is optimized for EURUSD, M30 0_00001. You should attach the EA to a chart and allow automated trading to let the Expert Advisor work. But with proper settings, it is also appropriate for any timeframes and instruments.


  • Magic_index – magic number assigned to the first trade; Magic_index+n is assigned to the next trades, where n is a number of opened positions. NOTE: Regardless of the amount of opened positions set in the Max_order parameter, the EA reserves 10 magic numbers. If the magic number is equal to 1, do not use the next 9 numbers with this symbol. Instead, start from 11, etc.;
  • Max_order – maximum amount of opened positions but not greater than 10. Martingale is used;
  • Risk_money_SL – amount of money which can be lost if Stop Loss triggers at all open positions;
  • Profit_percent_risk – percentage of targeted profit from Risk_money_SL when closing all positions;
  • Period_SMA – period of high SMA and low SMA, and Fast EMA MACD;
  • Period_MACD_SMA – period of smoothing moving average from difference between Slow EMA and Fast EMA;
  • Period_EnvBB – period of Bollinger Bands and Envelopes indicators, as well of MACD indicator's Slow EMA;
  • Filter_BB = true – Bollinger Bands indicator filter;
  • Deviat_BB – Bollinger Bands indicator deviation;
  • Filter_Env = true – Envelopes indicator filter;
  • Deviat_Env – Envelopes indicator deviation;
  • Filter_SMA_Daily = true – daily timeframe filter based on the SMA indicator relative to the current price.
  • Filter_SMA_Period – period of the SMA indicator used as a daily timeframe;
  • SL_Daily = true – enable the function defining a stop loss by a daily timeframe. If disabled, a stop loss is placed according to Bollinger Bands or Envelopes indicator parameters.
  • SL_Daily_Step – daily step used for a stop loss calculation. It is active if the SL_Daily function is enabled and changes from 1 to 30 with the step of 1.

Attention: The default settings are not universal ones. You should define an asset, a timeframe and the parameters to ensure the EA correct operation!

Andrey Litvichenko
2017.10.25 08:05 

User didn't leave any comment to the rating

Eleni Anna Branou
2017.02.16 13:00 

Nicely done.

Ovidiu Caslariu
2016.06.05 17:23 

User didn't leave any comment to the rating

Version 1.10 - 2015.08.28
- Added new parameter Money_Minimum_Profit_Reverse, which closes an open position upon a reversal signal if the position profit exceeds the value specified in the parameter.
- Added new parameter Martingale_Trading_Signals, which activates martingale order trading based on MACD signals.
- Added a function of trading with all indicator signals disabled;
- Improved Martingale based position placing algorithm.
- Minor renaming of some parameters for better clarity.
Version 1.9 - 2015.08.17
1) Added trading signal function "Breakdown OR Rebound " if:
-EnvBB_Strategy_Breakdown = true;
-EnvBB_Strategy_Rebound = true.
2) Added trading signal function "Trend OR Reverse " if:
-MACD_Strategy_M_trend = true;
-MACD_Strategy_M_reverse = true.
Version 1.8 - 2015.08.12
-Added a new parameter: "Control_profit_martingale". Control over profitable positions placed by Martingale.
-Added parameters for selecting a trading strategy by Envelopes, Bollinger Bands and MACD;
-Removed the SL Daily 0 to 30 parameter;
-The TS_Percent_maxSL parameter is replaced by TS_Points, trailing stop in points;
-The BE_Percent_maxSL parameter is replaced by BE_Points, modifies stop loss into breakeven, points;
-Added a new function: if SL_Points=0, stop loss is placed by parameters of EnvBB indicators;
-Added a new function: if EMA_Slow_Period is greater than Period_EnvBB, the EnvBB period is set by parameters of EMA_Slow_Period;
Version 1.7 - 2015.06.29
-Improved the filter of the first position entry for the bar Shift Back=1 by High and Low;
-The Trailing_Stop_Points parameter is replaced by the TS_Percent_maxSL parameter, which modifies stop loss as percentage of the stop loss parameter;
-The Break_Eve_Points parameter is replaced by the BE_Percent_maxSL parameter, which modifies stop loss into breakeven as percentage of the stop loss parameter;
-Deleted the function of placing stop loss by Env and BB (when SL_Daily_0_to_30=0 and SL_Points=0);
-Optimized for M30 EURUSD 0.00001 2010-2015 by open prices (recommended to re-optimize for your broker and timeframe).
-Added the Spread_Max function which allows the EA to trade if the current spread is less than Spred_Max.
Version 1.6 - 2015.06.19
- Added new Independent_Trade function which activates a mode of simultaneous independent trading for Buy and Sell.
- The Magic_index is changed to the Magic_uses_10 parameter. It reserves 10 magic numbers. If magic number is 1, do not use next 9 numerals for this pair in the terminal but start from 10 etc.
Version 1.5 - 2015.06.17
Added the new Trade_Opening_Prices function that enables trading by Open prices. Otherwise, trading is performed at every tick.
Version 1.4 - 2015.06.15
-Changed parameter Max order to Max order 1 to 5
-Changed parameter Period EMA to EMA Fast Period
-Added parameter EMA Slow Period
-Changed parameter SL Daily to SL Daily 1 to 30
-Deleted parameter Filter Daily SARstep
-Improved algorithm of placing orders by Martingale, control by profit is implemented instead of control by points.
Version 1.3 - 2015.06.01
New function:
- Close_position_reversal = false; Closes positions regardless of profit when a trend change signal emerges. The function is off by default.
Version 1.2 - 2015.05.27
Added the new functions:
- Risk_Percent_Balans_SL defines percentage risk from a deposit balance. Risk value is calculated as a maximum value between Risk_money_SL and Risk_Percent_Balans_SL; used for autolot calculation;
- SL_Points sets a stop loss in points. A stop loss is calculated as a maximum value between SL_Daily_Step and SL_Points.
Version 1.1 - 2015.05.20
- Added new parameters:
Break Even Points - moves an order to breakeven, in points;
Trailing Stop Points - trailing stop in points;
Period SMA is replaced to Period EMA.
- changed filter:
SMA Daily is replaced to Parabolic SAR (SAR) Daily.
- Combined parameters:
Filter_Deviat_BB (0 - filter is disabled, BB deviation);
Filter_Deviat_Env (0 - filter is disabled, Env deviation);
Filter_Daily_SARstep - (0 - filter is disabled, step of SAR);
SL_Daily_Step - (0-30 step 1, if equal to 0, stop loss is placed by parameters of Env or BB).