Averaging down EA

17 December 2018, 09:10
Jan Flodin
9
1 114

The main purpose of this blog is to describe and explain the input parameters of my Averaging down Expert Advisor (MT4 version / MT5 version).

This is an out-of-the-box product which will normally not be modified based on request from a single customer. Please therefore first read this blog to the end and/or download a demo and test the EA in the strategy tester in order to understand what it can and cannot do.

Whenever there is an available update of the EA I recommend you to wait with updating until all open positions by the EA have been closed. You can update it without removing the previous version from the chart. Before updating I also recomend to turn off AutoTrading and after the update please control that the input parameters have not changed on each chart where the EA is loaded. Then you can turn on AutoTrading again.

Input parameters

Parameters marked with an asterisk (*) in the beginning are only available in the MT5 version and parameters marked with two asterisks (**) in the beginning are only available in the MT4 version.
  • GENERAL SETTINGS
    • Enable averaging - When set to False the the EA is in sleeping mode doing nothing.
    • Enable only for this magic number (-1 = all) - You can set this to 0 for controlling manually opened orders or set a magic number for a specific EA.
    • Close all and stop trade - When changed to True the order basket will be closed and the EA will bet set in sleeping mode.
    • 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. This paramater is only used for opening of orders. Closing of orders will always occur at the current spread.
    • Maximum allowed slippage in points - Please note that not all brokers/account types support slippage control.
    • ADR (Average Daily Range) period (days) - Default is 60. ADR is calculated based on the sum of each days move (high-low) divided with the amount of days. Parameters ending with the text ...(<0 = ADR %) means that if a negative (minus) value will be put here then the ADR% (Average daily range) logic will be used. If for instance the symbol in question has an average range of 100 Pips then setting a value of 50 (%) will convert the value to 50 pips.
  • MONEY MANAGEMENT
    • 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. The risk will not be calculated for averaging orders. Therefor it is important for you to do your own risk calculation depending on the Lot multiplier and Amount of averaging orders settings.
    • ** 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).
    • 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 (floating) loss is over this value. 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 orders 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 as long as the magic number doesn't start with 67.
    • 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.
  • TRADE MANAGEMENT
    • Strategy to use for first order - Listbox with 2 alternatives:
      • Manual trading - Order must be manually opened by you or by another Expert Advisor.
      • RSI M5-D1 - RSI 14 must be above/below 70/30 on all these time frames on order for short/long trade to be opened.
      • RSI H1
      • Moving average 200. Long trade above and vice versa. MA values are calculated from the current chart time frame.
    • Take profit (0 = disabled, <0 = ADR %)  - Take profit for the first (non averaging) order.
    • Trailing stop (<0 = ADR %) - Will trail the stop loss constantly with the distance you have set as soon as the trade is in profit. When a negative (minus) value will be put here then the ADR% (Average daily range) logic will be used. If for instance the symbol in question has an average range of 100 Pips then setting a value of 50 (%) here will make the trailing stop start when the price is 50 pips in profit.
    • Trailing step - 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 here.
    • Break-even (0 = disabled)
    • Break-even trigger - The price has to reach this level (calculated from the opening price) in order for the break-even to be set.
  • CLOSE HALF SETTINGS
    • Close half position - Combo box with the values below. Please make sure that your account supports part close of orders before you use this option.
      • Disabled - Default value.
      • ATR - The current ATR level multiplied with the value you have set below in the 'ATR multiplier' parameter.
      • At first TP level - If you select this option you will also have to adjust the value in the 'First TP level' parameter below.
    • Move to break-even after close half - True or False.
    • First TP level for Close half (<0 = ADR %)
    • ATR multiplier for Close half
    • AVERAGING SETTINGS
      • ** Averaging method - Listbox with 3 selections:
        • DISTANCE - the next order will be opened as soon as the distance has been reached.
        • TIMEFRAME - the next order will be opened upon new candle open and if the distance has been reached.
        • PIVOT - the next order will be opened at the next closest pivot level.
      • ** Time frame (if set to TIMEFRAME or PIVOT above) - There must be a new candle for the selected time frame and minimum distance reached in order for an averaging order to be opened.
      • * Time frame (candle close), pivot point or exact distance - If this value is set to a time frame then there must be a new candle for the selected time frame and minimum distance reached in order for an averaging order to be opened. If set to PIVOT the current chart time frame will be used.
      • First averaging order distance (0=disabled) - Value in points. You can set another value than 0 here if you for instance would like the first averaging order to have a larger distance than the following averaging orders.
      • Min. distance for next orders (<0 = ADR %) - Positive values are in points. If you use a negative value here then with the default value the distance must have reached 50 pips (100 / 2) before an averaging order will be opened. This using the example that ADR for the last 60 days is 100 pips.
      • Distance multiplier - Default value is 1 which means that the distance for next averaging orders will always remain the same. If you put here for instance 1.5, and have distance set to for instance 200 (points) in the parameter above, then the next order will be opened when a 300 points distance has been reached (200 * 1.5). The next order again at 450 points (300 * 1.5) and so on.
      • ** Lot increase method - Select from MULTIPLIER or INCREMENT.
      • ** Lot multiplier/increment - If Multiplier is selected above and this value is set to for instance 1.4 then an initial 0.1 lot order will generate a first 0.14 lot averaging order. If Increment is set above and this value is 0.02 then the first averaging order will be opened with 0.12 lots. Second 0.14 and so on.
      • * Lot increase (<0=multiplier, >0=increment) - If negative value and set to for instance -1.4 then an initial 0.1 lot order will generate a first 0.14 lot averaging order. If positive value and set to for instance 0.02 then the first averaging order will be opened with 0.12 lots. Second 0.14 and so on.
      • Take profit method - Select from POINTS or MONEY.
      • Take part profit (after 3rd order) - Amount of points for TP of the last averaging order.
      • * Profit in points or money (0 = break even) - If the value is set to for instance 10 then if Points is selected above the averaging order basket will be closed when in 10 points profit. If money then when 10 in profit in the account currency.
      • ** Profit in points or money - If the value is set to for instance 10 then if Points is selected above the averaging order basket will be closed when in 10 points profit. If money then when 10 in profit in the account currency. If set to 0 then the basket profit level will never be set. It is then up to the trader to manually set the TP level for each order.
      • Wait for candle close (Virtual TP must be True) - Will wait until the candle has closed until the order basket will be closed.
      • Virtual TP (always used with Money. Must beTrue for FIFO) - If set to True a green line will appear at the basket close level. If False then all orders will have a broker TP. If 'Take profit method' is set to MONEY then there green line will not be drawn on the chart.
      • Lots limit method - Select from MAXORDERS or MAXLOT.
      • Lots limit value - Amount of averaging orders to open or max lot size to open.
      • Close all orders at max orders - All orders will be closed when the last order has been opened and the price has moved yet a distance unit.
      • ** Enable lock order - Possibility to enable Averaging lock (hedge) order. If this is set to True and the maximal number of grid levels is opened and the price moves another distance points against the basket, the EA will open the lock order which  makes the whole position neutral and removes all take-profits. Hence the loss amount of the time when the lock order was opened will stay the same since the lot sise of the lock order will be the same as the sum of the lots for the already opened orders. After that the EA does nothing and the trader will have to manually deal with the trades.
      • ** Lock distance in points (from last averaging order) - The lock order will be opened when this distance has been reached. The distance is counted from the last averaging order.
      • * Lock order distance (0=lock order disabled) - Possibility to enable Averaging lock (hedge) order. If this is set to a higher value than 0 and the maximal number of grid levels have been opened, and the price moves another distance points against the basket, the EA will open the lock order (in the opposite direction) which makes the whole position neutral and removes all take-profits. Hence the loss amount of the time when the lock order was opened will stay the same since the lot sise of the lock order will be the same as the sum of the lots for the already opened orders. After that the EA does nothing and the trader will have to manually deal with the trades.
      • Virtual lock order (False=pending order)
    • EA SETTINGS
      • Magic number for averaging orders - This number must be different than the number set in the 'Enable only for this magic number' parameter.
      • Order comment - This text will be added to the end of the original order comment.



    Share it with friends: