Adjustable MA 3G

I tried to backtest the EA in MT4 build 670, but got a zero divide error for the indicator (at 76,50).

In the iCustom call of the EA (lines 99, 100) there is no input parameter for the sampling period of the indicator.

Not sure if the new build processes differently, or if this MT4 version of the EA has not been updated.
 
I tried to backtest the EA in MT4 build 670, but got a zero divide error for the indicator (at 76,50).

In the iCustom call of the EA (lines 99, 100) there is no input parameter for the sampling period of the indicator.

Not sure if the new build processes differently, or if this MT4 version of the EA has not been updated.

Are you talking about this EA? What time period for testing do you use? What currency pair and timeframe? Input parameters?

Backtesting on EUR/USD @ M5 (every tick) on 2008-04-01 through 2014-01-24 does not generate any errors.
 
Hello,
I'm new here, this EA running good on backtes with appropriate TP/SL and TF
Can it modified to close running order by opposite of MA cross
Example : Running Buy position will be closed after meet Sell condition and continued with Opened Sell position
Thank you
image.jpg
 
@Freddy Tri, the EA is already functioning this way - it closes the previous trade on an opposite signal and opens a new one. Please use the input parameter MinDiff if you want to increase the sensitivity of the crosses. You might also want to remove this part of the code if you want the difference between MAs of less than 1 standard pip to qualify as a cross:
MQL4:
    // Checking for unconvetional Point digits number.
   if ((Point == 0.00001) || (Point == 0.001))
   {
      Poin *= 10;
      Deviation *= 10;
   }
 
@Freddy Tri, the EA is already functioning this way - it closes the previous trade on an opposite signal and opens a new one. Please use the input parameter MinDiff if you want to increase the sensitivity of the crosses. You might also want to remove this part of the code if you want the difference between MAs of less than 1 standard pip to qualify as a cross:
MQL4:
    // Checking for unconvetional Point digits number.
   if ((Point == 0.00001) || (Point == 0.001))
   {
      Poin *= 10;
      Deviation *= 10;
   }
Okey thank you Sir
But it didn't work on mt5, the opposite positions open but the previous not closed
 
Last edited:
Version 1.05 of the Adjustable MA 3G EA is now available:
  • Added a status panel via the chart commentary.
  • Added an input parameter for trailing stop trigger profit.
  • Added input parameters to restrict trading on certain days of the week.
  • Added support for cross-midnight time periods.
  • Added validation for more of the input parameters on initialization.
  • Added None as a trading direction to only close trades or trail stops without opening new positions.
  • Changed the start/end time input parameters from strings to integers to allow backtesting optimization based on time periods.
  • Changed the EA to work with points only without assuming what a pip is for a given trading instrument.
  • Changed Magic number from an implicitly calculated value to a modifiable input parameter.
  • Fixed a bug with position closing that could (very rarely) occur with the MT4 version of the EA.
  • Fixed multiple issues in the money management function of the EA.