Русская версия подробного описания - https://www.mql5.com/ru/blogs/post/713543
Instruction to the Advisor Generator Pro
Table of contents:
- Description of the adviser's parameters.
- Create a strategy file in the strategy tester.
- The use of a strategy file for trading in real time.
- Addition, modification of the strategy file.
- News filter.
- The main difference between typical expert advisors and Generator Pro.
- Recommended type of VPS.
- Calculate values of pairs.
- Description of the adviser's parameters.
1) TradeMode (Create_Mode - for tester only) - Advisor mode:- From_file - the mode of operation from the virtual strategy file ( in this mode all the adviser's parameters below the CREATE MODE section have no effect, since these parameters are generated in the file). A virtual strategy file is required GeneratorPro_PP_XXXYYY_1234.txt (where PP is the period in minutes, XXXYYY is the currency pair, 1234 is the Magic Number), which must be for real trading in the folder ... / MQL4 / Files , for the strategy tester in the folder ... tester / files . For real trading, this file is required once when loading parameters. Loading of parameters from files will be carried out automatically if the saved file will not be found. If the saved file from the previous job is found, or you want to download a new file, you must click the Restart-Confirm button. After that, if there were open orders with this Magic Number, then they will be closed.
- Without_file - the mode of operation without a file of virtual strategies. Virtual strategies are formed from the selected ranges of parameters in the Generator section. If the Expert Advisor does not find the previously saved file, then automatically the new one is created from the specified parameters. If the saved file from the previous job is found, or if you want to load new parameters for virtual strategies, you must click the Restart-Confirm button. After that, if there were open orders with this Magic Number, then they will be closed.
- Create_mode - create a virtual strategy file. This mode works only in the strategy tester. To create a strategy file, read the appropriate section.
2) GLOBAL PARAMETERS - global parameters for working with virtual strategies:
- Risk - The risk parameter. High risk is considered to be <2000, with an average risk of 2000-5000. Low> 5000. Some servers (small quantity) may not have a standard margin calculation system, so the risk value may be different, you may need to adjust to 100, or another value. Check on in the strategy tester on history.
- AutoFixBalance - Automatically sets the FixedBalance parameter. If the current balance is higher than FixedBalance, then FixedBalance is equal to the current balance.
- FixedBalance - If equal to 0, the advisor works with the entire balance of the deposit, if not equal to 0, it will work with the specified value. This value can be either less or more than the current balance.
- Min Lot To Start, relative value - the minimum value of the settlement lot, from which the advisor will start to open positions. Relative value; Real lot = Relative lot * Balance * K / Risk. " K" may vary depending on the pair and currency of the deposit. For example, for EURUSD and USD, the deposit currency is K = 1;
- Frequency - the minimum value of the next lot. Relative value;
- Max.Total Lots, relative value - the maximum limit of all opening of the lots of the current pair. Relative value;
- Auto GMT - enable automatic calculation of the GMT difference and server time (for the strategy tester, use ManualGMTOffset, since the automatic method can not work during testing);
- ManualGMTOffset = 2 - set own terminal time difference minus GMT (used for testing for any AutoGMT value and for real trade when setting AutoGMT = false);
- SummerTime - use only when testing. It is necessary for the adviser himself to translate GMTOffset for one hour, when the broker's time is translated. Set this parameter to false if it's winter time now, and to true, if it's daylight saving time, and do not forget to put the current GMTOffset broker in the ManualGMTOffset parameter.
- Slippage - the maximum possible slippage in points;
- SpreadLimit - set spread limit in points, by default 3.0 (automatically multiplied by 10 for five-digit servers). If the spread is greater than this parameter, the virtual strategies work only in the closing mode, new positions are not opened. The limit is displayed on the graph with a message with a red color.
- Commission - Reimbursement of commissions from transactions. Set the value of the commission you want to make up by increasing the profit from transactions. Value in dollars for 1 lot. For example, 8. Remember, increasing this parameter reduces the probability of successful completion of the transaction. If you have a commission, you do not need to set this parameter.
- Magic Number - unique number of adviser's transactions;
- Orders Comment - order comments;
- FIFO - close orders by the FIFO rule;
- Partition Close - partial closing if the settlement lot is less than the current position (recommended true);
- Real Positions Mode - the mode of real positions. Two types: OneSummaryDirection - one total direction (simultaneously only one direction). TwoSeparateDirections - two independent directions (both Buy and Sell orders can be opened);
- Limit Orders Of Symbol - limit the number of open positions by the symbol, 0 - no limit.
3) FILTERS - filters:
- Filter Mode - filter mode. Can be several types: CloseAndRem - closes and remembers the positions before the event, Stop - stops calculations for the time of the event, CloseOnly - continues work in the mode of closing virtual positions only.
- NewsFilter - enable / disable the news filter (the indicator is required for operation, see the corresponding section). Importance: HighImpact - high. MiddleImpact - medium. LowImpact - low. Speaks - performances. USDNewsForAll - USD news for all couples. MinsBeforeNews - minutes before the news. MinsAfterNews - minutes after the news.
- Time Filter . After the end of time (HourEnd) positions are closed and remembered (as well as using the button Close & Rem). They open from HourStart time according to the signals of virtual strategies.
- Hour Start - the hour of commencement of trade on GMT;
- Hour End - the end of trading hours for GMT;
- Close And Remember Before Weekend - close and remember the positions before the weekend;
- Slow Closing on Friday - with TRUE virtual strategies do not start trading on Friday, if they were closed with a profit.
- Close All And Restart After DD,% - close all positions and resume the work of the Expert Advisor after the drawdown as a percentage of the deposit;
- Close All And Remember After DD,% - close all positions and remember after the drawdown as a percentage of the deposit;
- SaveToExtarerecoveryAfterDD - saves loss in Extra recovery after drawdown.
- FirstPosition&ReverseChanсe - Each strategy will try its own coin, each time a reversal signal or first position signal occurs for each strategy separately, with the probability of FirstPosition&ReverseChance.
- LossToExtrarecoveryChance - when closing a virtual position, it will be randomly selected to save the loss to an additional recovery cell or not with the probability of LossToExtrarecoveryChance.
4) ADDITIONAL RECOVERY - additional recovery:
- GlobalRecovery2019 - on/off. The new global recovery system 2019 is new among my programs. The essence of the system is not to increase the risk, but to distribute the loss from the losing strategy to other virtual strategies. If you use multiple expert advisors and the same name of the global variable, all expert advisors will work on loss recovery, distributing the load and reducing the recovery time.
- GlobalRecovery2019_BalanceLimitPercent - if the current virtual balance decreased by GlobalRecovery2019_BalanceLimitPercent percent, It will not participate in the allocation of losses.
- GlobalRecovery2019_Increment - add to the virtual balance if the global variable is not empty. If 0, the value will be calculated automatically pVirtualBalance / number of local strategies. If you use several expert advisors, it is recommended to set this value to pVirtualBalance/number of all strategies.
- ExtraRecovery (work if> 1) - Additional recovery of lost strategies. The value sets how many times the initial lot (pStartLots) and the value of the required profit (pProfitFactor) will be increased with the virtual deposit unchanged until the lost deposit is restored. This increases the riskiness of trade. The value for the restoration is displayed on the graph at the bottom of the page with the inscription Local(if Global Variable for ExtraRecovery = false) or Global (if Global Variable for ExtraRecovery = true). These values are formed either after losing virtual strategies, or after any loss (if the option AllLossToExtraRecovery = true).
- Global Variable for Recovery - Use the global variable for additional recovery, if True, then the Expert Advisor will work with the global variable. All HotPointAUTO experts who have the same account and magic number will participate in the simultaneous recovery. If there was a local restore, then if you set the GlobalRecovery parameter to True, the value of the local variable is transferred to the global variable (the reverse is not transferred to the local one). The global variable can be edited using the terminal (Service-Global Variables).
- UltraExtraRecovery - use the dynamically changing value of ExtraRecovery depending on the loss.
- kExtraRecovery (if Ultra = true) - the change rate of ExtraRecovery. ExtraRecovery = kExtraRecovery * Loss / (Deposit + Loss) * (5000 / Risk)
- MinxtraRecovery is the minimum value of ExtraRecovery.
- MaxExtraRecovery - the maximum value of ExtraRecovery.
- NotCloseLostStrategies - do not close losing strategies. True - If the current loss from the virtual positions of one virtual strategy exceeds the virtual deposit of this strategy, then these positions will not be closed. Falce - will be closed (this is a kind of virtual Stop Loss). (If Close And Remember Before Weekend = true is selected , the virtual strategies will close at any value of NotCloseLostStrategies. )
- AutoRestart - automatically close all losing strategies if equity has reached the level of Restart Equity (the maximum equity is remembered before the first losing strategy occurs). AutoRestart will not work if NotCloseLostStrategies = false.
- NotAverageIfMoreMaxRealLots - do not average the virtual positions if the total volume of all lots by module is greater than MaxTotalLots. If this option is false, then virtual averaging will continue and may exceed MaxTotalLots, in this case MaxTotalLots (multiplied by the relative coefficient) will be opened in reality.
- NotLimitBalance - do not limit the virtual balance. If the virtual balance of the virtual strategy ends, then it will be increased by other virtual strategies.
- NotLimitMaxLot - do not limit the lots. If the amount of lots of virtual strategy will be greater than MaxLot of this strategy, MaxLot of this strategy will be doubled.
5) CREATE MODE PARAMETERS - parameters of the strategy creation mode;
- DynamicExcludeMode (for tester only) - Dynamic exclusion of losing strategies when creating virtual strategies in the strategy tester.
- Top_Mode - the criterion for choosing the best strategies. Three types of Profit - selected at which the best profit, ProfitAndDrawdown - which have the best ratio of profit and drawdown, Drawdown - which have a smaller drawdown.
- Top_Size is the number of best strategies for selection.
- UseIgnorFile - use ignore-file, ignore-file is a file that contains a list of ignored strategies. It is required if we need to do additional optimization ( example 1 : we got strategies for the period 2010-2016 and we want to further optimize in a year.) In order not to re-optimize for 2010-2016 and not waste time, you can use the previously ignored-phal and continue Optimization from 2016-2017 Example 2 : Optimize on another server with the ignore-phal received, because the strategy will initially be smaller, then optimization will be much faster .Example 3 : Optimize for several pairs).
- IgnorFile is the name of the ignore file.
- Random_Create_Mode - the EA will randomly initialize the initial strategies within the set parameter limits (from parameter1 to parameter2, now parameterInc is no required), and creates the Random_Strategies.
- Random_Strategies - the number of init random strategies.
6) VIRTUAL STRATEGY PROPERTIES - properties of virtual strategies;
- Strategy- selecting a virtual strategy.
- Volatility Multiplier (relative to 100) - the volatility multiplier (relative to 100). Required when you need to change the parameters of virtual strategies depending on the volatility, without changing the parameters themselves. For example, if Volatility Multiplier = 120 and pLimitDayPrice = 60, then pLimitDayPrice = 72 (60 * 120/100) will be used. The virtual parameters are influenced by the volatility multiplier: pStepLots, pLimitDayPrice, pDelta, pLimitOnreverse .
7) GENERATOR - generator;
7.1) MAIN - basic parameters of the generator;
- pVirtualBalance = 5000; pVirtualBalance2 = 5000; pVirtualBalanceInc = 1000 - Virtual balance;
- pStartLots = 0.01; pStartLots2 = 0.01; pStartLotsInc = 0.01 - Starting Lot;
- pMaxLots = 10; pMaxLots2 = 10; pMaxLotsInc = 1 - The maximum number of open lots;
- pStepLots = 6.0; pStepLots2 = 18.0; pStepLotsInc = 2 - The minimum step of the next position ;
- pChangeLots = 1.3; pChangeLots2 = 1.6; pChangeLotsInc = 0.1 - Change the next lot, multiplier;
- pProfitFactor = 1; pProfitFactor2 = 2; pProfitFactorInc = 1 - Required profit;
- pTrendPer = 75; pTrendPer2 = 75; pTrendPerInc = 20 - The trend period ;
- pLimitDayPrice = 60; pLimitDayPrice2 = 120; pLimitDayPriceInc = 20 - Restriction on price movement ;
- pReverseInd = 10; pReverseInd2 = 10; pReverseIndInc = 5 - Turn indicator, or first position, if there are none;
- pDelta = 100; pDelta2 = 100; pDelataInc = 50 - The maximum averaging distance from the first position;
- pMaxTotalOrd = 40; pMaxTotalOrd2 = 40; pMaxTotalOrdInc = 1 - Maximum value of virtual orders for each strategy ;
- pLimitOnReverse = 0; pLimitOnReverse2 = 0; pLimitOnReverseInc = 50 - Restriction on position reversal. Positions do not unfold if the distance from the first order to the last is less than LimitOnReverse;
- pReduceLotsAfterReverse = 1; pReduceLotsAfterReverse2 = 1; pReduceLotsAfterReverseInc = 0.5 - Decrease the amount of lots when reversing the positions in as many times.
7.2) ADVANCED OPTIONS - additional generator parameters that change the logic of the selected virtual strategy.
- VirtualReverse = true - use the reversal of positions in virtual strategies.
- FlexibleLevels = false - use dynamic levels of restrictions on price movement. If false, then static will be used at the beginning of each day.
- WaitNextBarForOpen = true - wait for the next bar to open new positions.
- WaitNextBarForClose = false - wait for the next bar to close positions.
- FixTakeProfitDistance = false - fix the distance to close positions. For example, with a turn, the distance to the required profit may increase. If the parameter is set to true, then the positions will be closed, if they pass the same distance, if they did not unfold. But in this case, to achieve the required profit, it may take several times to open positions.
- NormalizeLots = false - normalize the lots. If the positions were closed, then after receiving a signal to open the first lot, it will be calculated based on the current loss and the required profit. For example, the current loss is -20, the required profit 2. It turns out that to achieve profit we need 22, i.e. 11 times more than it was without a loss. The first position in this case will be = 11 * 0.01 = 0.11.
- AveragingBothSides = false - averaging in both directions if the price has passed either in the right direction or in the opposite from the last order.
- AveragingTrendDirection = false - averaged only in the direction of the trend, if the price goes in the opposite direction from the open, then there will not be averaging.
- AveragingTops = false - averaging only from the top (bottom) positions, and not from the latter.
- ReverseWithZero = false - when true - if the reversal signal is received and the profit is less than 0, the positions will not be reversed until the profit is >=0
- AllLossToExtrarecovery = false - put all losses in ExtraRecovery and start the series from the beginning.
- CloseAfterDelta = false - close positions if Delta is reached from the first to the last position. If false, the positions will not close, but the new ones will not open.
- NegativeStartIndicator = false - the first position indicator will work in the opposite direction (the algorithm changes).
- Directions = LongAndShort - virtual items. Long - positions will be opened only for purchase, Short - positions will be opened only for sale, LongAndShort - both directions.
7.3) TO USE IN OPTIMIZATION - to use or not additional parameters listed in the ADVANCED OPTIONS section when optimizing. If true, two elements of this parameter will be included in the optimization: true and false. In the case of Directions, the optimization will include three elements (Long, Short, LongAndShort)
- _ToUseInOpt_VirtualReverse = false;
- _ToUseInOpt_FlexibleLevels = false;
- _ToUseInOpt_WaitNextBarForOpen = false;
- _ToUseInOpt_WaitNextBarForClose = false;
- _ToUseInOpt_FixTakeProfitDistance = false;
- _ToUseInOpt_NormalizeLots = false;
- _ToUseInOpt_AveragingBothSides = false;
- _ToUseInOpt_AveragingTrendDirection = false;
- _ToUseInOpt_AveragingTops = false;
- _ToUseInOpt_ReverseWithZero = false;
- _ToUseInOpt_AllLossToExtrarecovery = false;
- _ToUseInOpt_CloseAfterDelta = false;
- _ToUseInOpt_NegativeStartIndicator = false;
- _ToUseInOpt_Directions = false;
2. Create a strategy file in the strategy tester.
1) Download, or update the quotes of the pair for which you will receive the file. In the terminal, select Tools - Archive of quotations.
2) Open the Strategy Tester. Select a symbol. Period (recommended M15). The model (if WaitNextBarForOpen = true, you can use to speed up the optimization. Control points, if WaitNextBarForOpen = true and WaitNextBarForClose = true, then you can use the Open prices, if both parameters are false, then you need to use All ticks). Spread (manually set the average broker spread). Choose dates. Uncheck Visualization.
3) Open the properties of the expert. Install TradeMode = Create_mode.
4) Choose Strategy.
5) Select DynamicExcludeMode. If true, then those strategies that lose their virtual deposits VirtualBalance, they will be excluded and the time for optimization will decrease. False - can be used if you need to determine the best strategies taking into account the loss of virtual deposits. For example, the first strategy may lose a virtual deposit of 5000 once, and make a profit of 20,000, and the second strategy will not lose the deposit, and will receive a profit of 10,000. In this case, the first strategy will be selected if the Profit selection option is set.
6) Choose a criterion for selecting the best strategies Top_Mode. Three types of Profit - selected at which the best profit, ProfitAndDrawdown - which have the best ratio of profit and drawdown, Drawdown - which have a smaller drawdown.
7) Choose how many total strategies will be selected in the file Top_Size.
8) If you want to continue the optimization, and you have an ignore file, then set the UseIgnorFile = true parameter and in IgnorFile enter the file name. When using an ignore file, it is necessary that all parameters that were previously received when receiving the ignore file remain unchanged, otherwise the list of ignored strategies will not be correct. (To save parameters for further optimization, it is also recommended to save the Set file with parameters and load it before that).
9) Configure the virtual parameter ranges in the GENERATOR section.
10) Configure the advanced settings.
11) Define additional parameters that will participate in the optimization. If they are set to false, then the value that is set in the advanced parameters will be used.
12) Click Ok. And run the test with the Start button.
13) If you open the Log tab, or open the log file, you will see how many strategies are initiated, there will also be information about free and used memory.
If there is not enough memory, the message "Not Enough Memory" will appear in the log and the test will be interrupted. In this case, you need to reduce the number of optimized parameters (for example, set a larger step, or exclude some parameters from optimization).
14) When the testing is completed (the testing time depends on the number of strategies and the computer's power), the list of selected strategies, strategy numbers, parameters, and selection criteria values will be displayed in the log.
15) It is recommended to create a separate folder and copy into it three optimization files, as well as a set-file of the advisor's parameters. Three optimization files are located in ... tester / files. The Set file is created in the Expert Properties by clicking the Save button.
16) To work with the received file in the strategy tester, select the parameter TradeMode = From_file. It is recommended to check the received settings at other time intervals. If the results suit, then you can go to the real-time trade.
3. Using the strategy file for real-time trading.
1) Before installing the Expert Advisor on the chart, check the chart period, the symbol name, and MagicNumber - they must match the name of the file. GeneratorPro_PP_XXXYYY_1234.txt (where PP is the period in minutes, XXXYYY is the currency pair, 1234 is the Magic Number)
2) Copy the strategy file to the folder .../MQL4/Files. Also, if there is a set file, copy it to the /MQL4/Presets folder.
3) Set the EA on the chart. Set TradeMode=From_file. (Or if you have *.set file, load it). Click Ok.
4) The parameters will be downloaded from the file automatically if the saved file is not found. If the saved file from the previous job is found, or if you want to download a new file, you must click the Restart-Confirm button on the graph. After that, if there were open orders with this Magic Number, then they will be closed.
4. Addition, modification of the strategy file.
1) You can manually change the virtual parameters of the strategies in the strategy file.
2) You can also add strategies from several files. Or delete several strategies. One strategy is one line. The characters at the beginning of the line (S [10], S [97], etc.) are optional and can be arbitrary, so when you merge files, you do not need to rename these numbers.
3) The first line contains information about the version of the Expert Advisor that made this file, as well as information about optimization, which may be useful to you in the future. Also this first line will be displayed on the chart in the Strategies section .
5. News filter.
1) The news filter uses the ForexFactory.com calendar and the free FFCal indicator, for its operation it is required to allow DLL import. It was slightly upgraded and corrected by me. did not work correctly. You can find the corrected version in the attachment ffcal_hp.mq4, as well as the compiled version of ffcal_hp.ex4. Check that the names of the downloaded files are correct. If they are different, then delete the unnecessary part of the name, or download the zip file and unpack it. The names must be ffcal_hp.mq4 and ffcal_hp.ex4
2) These files must be copied to the MQL4 / Indicators folder. And then in the terminal in the Navigator-Indicators field, click Refresh. The indicator should appear. If it does not appear, you need to install it in MetaEditor with your terminal version.
3) In the terminal settings, enable the DLL import. Service-Settings-Expert Advisors-Allow DLL import.
4) And after that, install the Expert Advisor on the chart and NewsFilter = true, and verify that the DLL import is allowed. If the Expert Advisor was previously installed, it may be necessary to delete and re-install on the schedule.
5) Do not put the indicator on the same chart with the advisor, because they will interfere with each other.
6. The main difference between typical expert advisors and Generator Pro (Разница между обычными советниками и Generator Pro):
Typical expert advisors (Обычные советники) | GeneratorPro |
---|---|
Optimization is carried out on one Deposit, you get a lot of positive results, but use only one. | You can set ranges of virtual deposits, ranges of parameters, and after testing the EA will automatically generate a file with many of the best parameters. You use not one, but many of the best parameters. |
A typical EA with averaging and martingale loses the entire Deposit. | Generator Pro consists of a variety of strategies with different parameters and virtual deposits, so the loss of one strategy involves the loss of only part of the Deposit. For example, We use Nstrat strategies, the loss from one strategy with VirtualDeposit will be equal to Deposit/Risk*VirtualDeposit/Nstrat. For Example, Deposit = 10000, Risk = 5000, VirtualDeposit = 5000, NStrat=1000. The loss of one strategy will be = 10000/5000 * 5000/1000 = 10. |
A typical expert Advisor usually has one type of algorithm. | Generator Pro has several types of algorithms (Trend, AntiTrend, TrendAndAntitrend), as well as the many properties that change the form of the algorithm (virtual reversal; dynamic levels; to wait for the next bar to open; to wait for the next bar to close; to lock distance to close; to normalize the lots; averaging in both directions; averaging in the direction of the trend; averaging from the upper (lower) positions; to expand the position when profit >= 0; all losses be placed in ExtraRecovery; to close positions if reached the value of Delta; flip over the first position indicator; direction selection). |
7. Recommended type of VPS.
It is recommended for this EA to use VPS with Remote Desktop. Because the EA is protected against interrupts, and saves all calculations to file. When trading resumes the calculation are restored from a file. This procedure work only with Remote Desktop servers, or with PC.
8. Calculate values of pairs.
You can calculate the volatility of the pair with the help of an additional expert Advisor in the application (Calculate_vol_of_pair_D1.ex4). Open the D1 chart and launch the app.