Moving Average Strategy EA

26 February 2019, 10:26
Jan Flodin
0
341

The main purpose of this blog is to describe and explain the input parameters of this product. Further below you will also find a list of known bugs and other shortcomings as well as a list of planned changes.

  • Time frame to operate on - This is intended to work as a protection so that no unwanted trades will be taken in case the time frame on the chart was unintentionally changed.
  • MA strategy to use - List box with the following selections:
    • Triple MA - The EA will trade when 3 MAs are aligned and a certain distance has been reached between each of them.
    • MA crossover - The EA will trade regular crossovers of 2 moving averages.
    • Heiken Ashi smoothed - The EA will trade color changes.
  • Send alert instead of opening trade - When set to 'true' an alert will be sent instead of opening a trade.
  • Reverse system (sell when buy, buy when sell) - 'true' or 'false'.
  • ADR period (days): ADR (Average daily range) period for trailing stop.
  • Open buy/sell order - 'true' or 'false'.
  • Enable trade time filter (your broker's server time) - Time filter for opening trades.
  • Trade from/to time - Hour and minutes from/to.
  • Maximum allowed slippage in points - Please note that not all brokers/account types support slippage control.
  • Maximum allowed spread in points (0 = not used) - Can be set to avoid taking trades with high spread directly after midnight market opening or at news releases. Useful for those with variable spreads.
  • Risk in percentage (>0 = auto lot) - If set to 0 the Manual lots value will be used. If set to > 0 then the EA will use money management if combined with a stop loss.
  • Point value for risk percentage - Default is 1. Should normally not be changed. Only in some rare cases where the broker has unconventional tick values for CFD:s a setting of 0.1 could be used.
  • Manual lots - Will be used if Risk above is set to 0.


It is important to understand the logic and functionality of the 3 following parameters. If something is not clear then please contact me by sending me a private message (PM) here on MQL5.

---------------------------------------------------------------

  • Max allowed balance drawdown % (100=disabled) - This function will prevent opening of new trades on other charts where the EA is running if your accumulated loss is less than xx%. If the 'Close orders' parameter (explained below) has been set to False then already opened orders on all charts will continue to run (including averaging orders. The averaging mechanism will also continue to open new order if necessary).
  • Orders with this Magic number (0=all) - Default value is 67. Please note that in my set files the Magic number is set to 67XXXX. With the default value the EA will only check open order where the Magic number starts with 67. So if you have other EAs running with open orders then they will not be taken into consideration.
  • Close orders - If set to True then all orders, where the magic number starts with the value you have set above, will be closed immediately when the Max allowed % has been reached.
-----------------------------------------------------------------
  • Exit method - List box with the following selections:
    • Fixed stop-loss
    • At MA cross - The position will be closed automatically when the first MA has crossed the second at candle close.
    • At trend MA - Will use the 'Trend MA period' parameter value for closing the position when the price has reached this MA value. The 'Use trend moving average' parameter does not have to be set to True for this to work.
  • Fixed stop-loss - 
  • Take profit method - List box with the following values:
    • Fixed take profit
    • Trailing stop – starts to trail when profit>=0
    • Risk/Reward (based on SL)
  • Fixed take profit - 
  • Risk/Reward ratio - You need to set the “Take profit method” parameter to Risk/Reward in order for this value to have any effect. You need also to set “Type of stop-loss” to Fixed and a fixed stop loss value. A stop loss value of 200 points and a R/R ratio of 1.5 would mean that the take profit level would be automatically set to 300 points (200 * 1.5) when an order is opened.
  • Trailing stop and Trailing step - Will trail the stop loss constantly with the distance you have set as soon as the trade is in profit. If the trailing step is set to 0 then the trailing stop will be adjusted each 3rd second. Else the trailing stop will be adjusted every time the price has moved the amount of points you have set in the Trailing step parameter.
  • Calculate trailing stop using ADR divider (0=disabled) - If ADR is 1000 points (100 pips) for the symbol in question and you have set this value to for instance 4, then trailing stop will be done with a distance of 250 points (1000 / 4).
  • Break-even (0 = disabled)
  • Break-even trigger - The price has to reach this level (calculated from the opening price) in order for the stop-loss to be moved to break-even.
  • GENERAL MA SETTINGS
    • MA price type
    • Use trend MA
    • Trend MA period
    • Trend MA method
    • Trend MA time frame
  • TRIPLE MA SETTINGS
    • Signal MA periods - Default values are 10, 20, 30.
    • Signal MA shifts - Default values are 0. You could for instance simulate the Alligator oscillator by using other values for Period and Shift.
    • Signal MA methods - Default is Exponential (EMA).
    • Min. distance in points between signal MA:s
    • Max. distance between signal MA:s (0=disabled) - Will prevent opening a trade if the distance is too big. For instance after a news event.
  • MA CROSSOVER SETTINGS
    • New trade at crossover (Exit method must be set to 'At MA cross') - The current trade will be closed at an opposite crossover (if TP has not been hit before that) and a new trade will be opened in the direction of the new crossover.
    • Fast and slow MA periods
    • Fast and slow MA shifts
    • Fast and slow MA methods
  • HEIKEN ASHI SMOOTHED SETTINGS
    • Maximum orders on signal - Default is 1. If set to for instance 3 then a new trade will be opened on each next 2 candles as long as the color is the same.
    • MA periods and methods
    • Candle shift to look for color change - Must be >= 1. If set to for instance 3 the trade will be opened upon the 4th candle after the color change. This in order to better avoid false signals in for instance a flat (ranging) market.
  • ALERTS (if alert instead of trade is enabled) - Set to 'true' for each alert type you would like to use.
  • Magic number - If using the EA on the same symbol on multiple charts (typically with different time frames), or on same symbol but different strategy, then it is important that the Magic number parameter has a different value. If not then trades on the same symbol will interfere with each other.
  • Order comment - Default is "MA". To this comment will be added the time frame and the strategy. For instance "MA H1 Heiken".
  • Show comments on chart - Will give you some basic information in the upper left corner of the chart.


Known bugs

  • Nothing reported or known at the moment. 


Planned changes

  • No planned changes


Share it with friends: