Averaging down EA

17 December 2018, 09:10
Jan Flodin

The main purpose of this blog is to describe and explain the input parameters of this product.

Input parameters

    • 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.
    • 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.
    • 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-H4 - RSI 14 must be above/below on all these time frames on order for short/long trade to be opened.
      • Moving average 200. Long trade above and vice versa. MA values are calculated from the current chart time frame.
    • Take profit (0 = disabled) - 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 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 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.
      • Use ADR (Average Daily Range) - This parameter has been removed in version 1.7.
      • ADR divider - This parameter has been removed in version 1.7.
      • First averaging order distance (0=disabled)
      • Min. distance for next orders (<0 = ADR %) - *** This parameter replaces the 2 discontinued parameters above*** 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
      • 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.
      • Take profit method - Select from POINTS or MONEY.
      • 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.
      • 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.
      • Virtual lock order (False=pending order)
      • 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: