Главная
Каталог статей форекс
English instructions and articles

Для того, чтобы использовать все возможности сайта, мы рекомендуем Вам person_add Зарегистрироваться или person Войти

starРейтинг: 5.0/1

date_range Posted: 01.08.2017

date_range Updated: 01.08.2018

remove_red_eyeReviews: 161

dashboardCategory: English instructions and articles

historyHistory versions

computerTerminal: МТ4 и МТ5

cloudTesting, optimization, and, The, X:


Read about The X: Testing and Optimization

Description

We already wrote about the fact that The X is a project that has become very popular for 5 years.

This is the best advisor for Forex , which allows you to create your strategy from standard indicators and use our functions for an advisor.

The functional features of the expert and the description of the settings we already wrote in our article The X - Universal Advisor for Forex MT4 MT5 Full instruction

We recently published an article for those who wanted to create their own signals with our robot: Programming strategies in the open source!

In this article, we will talk about how to optimize the parameters of the Expert Advisor and get the desired result.

We will talk about the testing methods, the choice of strategies for optimization, as well as the inclusion of various functions to work on Forex.

 

Introduction

We will not talk about how to test or optimize the advisors in the terminal mt4 and mt5! We already talked about this in our article: Testing and Optimizing Expert Advisors

In this article I will show you some ways to optimize the Expert Advisor and the right function to work with an Expert Advisor.

We have created several sets of optimization settings for you so that you can start optimizing on your computer.

Starting with version 18.008 we gave the names of all variables to the same name in the version for mt4 and mt5. This is done so that you can transfer configuration files from one terminal to another!

We will show examples of trading strategies based on THE X.

Remember : The X is a designer of trading strategies. By grouping and applying different combinations of functions, you can get absolutely different results.

You must understand that miracles do not happen. And our adviser is just an instrument for trading on Forex. Forex - This is 100% risk!

The set of settings depends on your deposit and the drawdown limit. Currency pair and contract specifications. Long-term trade or pipsing!

 

Here and below I will use these values:

0-10-100 = means that the parameters for optimization are:

  1. Start optimization value = 0
  2. Parameter optimization step = 10
  3. Stop parameter value for optimization = 100

All the parameters that are measured in points (Stoploss, TakeProfit, distance ......) I used from the 4-digit quotation.

  1. For example, EURUSD = 1.2001 means that the broker has 4-digit quotes. and 1 = 1 point!
  2. If I wrote 10, it means that I have 10 points in mind.
  3. If your broker has 5-digit quotes, then you need to multiply my recommendations by 10!
  4. For example, EURUSD = 1.20015 means that the broker has 5-digit quotes. and 1 = 1 point!
  5. If I wrote 10, it means that I have 10 points in mind. But you must set the values ​​to 100

Remember the answer to the question!

What are the values ​​in the parameters in points or pips?

In points! The item is taken from the value of the Point () variable

  • If you have a 5 \ 3 digit broker, then 1 point = 0.00001 \ 0.001
  • If you have a 4 \ 2 digit broker, then 1 point = 0.0001 \ 0.01

Block 1: Trade signals and filters

In our advisor, more than 20 trading strategies based on standard indicators of the MetaTrader terminal.

Why Do We Use Standard Indicators?

All user indicators, almost or completely, repeat standard indicators that are already in the terminal.

By changing parameters inside the code, you get a custom indicator. Logically, the custom indicator is 90% composed of standard indicators!

We wrote more than 5,000 advisers on custom indicators and we can say with confidence: it does not make sense.

Work on standard indicators is predictable and in 90% of cases it is more profitable.

Therefore, we use standard indicators for trading. Read examples of opening positions on standard indicators, as well as a description of signals, in the article: Examples of signal operation!

Indicators and signals are the main thing, where to start our optimization and testing!

At the time of this writing, we have 20 signals:

  1. NoSignal = 0, // No Signal
  2. Ma = 1, // Moving Average
  3. MACD = 2, // Moving Average Convergence / Divergence (MACD)
  4. STOCH = 3, // Stochastic Oscillator
  5. RSI = 4, // RSI
  6. CCI = 5, // Commodity Channel Index (CCI)
  7. WPR = 6, // Williams Percent Range (WPR)
  8. BB = 7, // Bollinger Bands
  9. Envelopes = 8, // Envelopes
  10. Alligator = 9, // Alligator
  11. OsMA = 10, // Moving Average of Oscillator (OsMA)
  12. AO = 11, // Awesome Oscillator (AO)
  13. ISH = 12, // Ichimoku
  14. AC = 13, // AC
  15. BAR = 14, // BAR BEAR \ BULL
  16. ADX = 15, // ADX
  17. ADXWilder = 19, // ADX Wilder
  18. ZigZag = 17, // ZigZag
  19. MFI = 20, // Money Flow Index
  20. Fractals = 21, // Fractals

Each signal and strategy is the standard strategy for using the indicator. Such strategies were written by people who invented these indicators. We will not explain the whole point of each strategy.

These are standard trading strategies!

You will have 100 000 000 options for using the standard indicator, but you also understand that we can not add them to the Expert Advisor!

If you wish to write your strategy or adviser on your indicator, then you need open source code:

  1. Open source The X for MetaTrader5
  2. Open source The X for MetaTrader4
  3. Programming the Expert Advisor: 10 Steps to Success!

In our Expert Advisor, you can combine 1 signal and up to 5 filters.

Signal and filter difference:

Signal

  1. Signal - occurs when there are all conditions for the signal, for example, the fact of intersection of lines MA. Or the appearance of a new ZigZag point.
  2. For example: The intersection of level 70 for the RSI indicator is a signal. And if the RSI is above the level of 70, then this is already a filter.
  3. The signal is what appears when the quotes are received, fixed on the bar. The adviser accepts the fact of the signal.
  4. For example : The light turned on. This is a signal because the light has just turned on. When you turn on the light, the person woke up. It's a signal.
  5. Opening positions occurs after the signal is committed, the lines intersect, then the position opens. If the lines were crossed earlier, then this is not a signal. The signal has already passed.

Filter :

  1. Filter - This is the current position of the indicator, for example the current position of the MA lines relative to each other. Or the current last vertex of ZIGZAG
  2. The filter is what the indicator shows at the moment. This is not a signal. This is the current position of the indicator.
  3. For example : The light was on. This filter is because the light has already been turned on and it is already on. When the light is on, the person no longer sleeps. This is a filter.
  4. Filtering of signals occurs at the current value to the indicator. If the Fast MA is above the slow MA, then this is the filter that only BUY should open.

Tips for optimizing signal parameters:

 input string Signal1s = "========= OWN Signal options =========";
input typesignals IndSigToTrade = 1;
input ENUM_TIMEFRAMES TF_IndSigToTrade1 = PERIOD_CURRENT;
input bool Signal_Reverse = false;
input bool ClosePositionifChangeOWNSignal = false;
input int OWNSIGNAL_shift = 1;
input string Signal2s = "========= Filter 1 options =========";
input typesignals2 FILTER_IndSigToTrade1 = 0;
input ENUM_TIMEFRAMES FILTER_TF_IndSigToTrade1 = PERIOD_CURRENT;
input bool Filter1_Reverse = false;
input int FILTERSIGNAL1_shift = 1; 

We advise you not to use more than 2 filters for the signal, so we hid the other 3 filters in the bottom of the settings table.

This is because each filter reduces the number of signals. And if you use more than 2 filters, the signals will be very rare.

Why did we make 5 filters?

At the stage of programming and creating an advisor, our first users were for us "Wishlist" and wishes. We fulfilled the requests and made 5 filters.

Variants of signal block optimization

IndSigToTrade parameter can be optimized from and to! there will be 20 busts of this parameter. It's not so much, but you can choose the best result for this or that strategy.

Optimization of values: 1 - 20 or Moving Average - Fractals

Parameter TF_IndSigToTrade1 - can also be optimized from and to. But we advise you to put the TimeFrame , on which you usually trade.

  1. Remember : The higher the TimeFrame, the less signals will appear. The higher the TimeFrame, the longer the strategy will be.

The Signal_Reverse parameter is used to overturn strategies! Sometimes it happens that trade becomes more profitable when we overturn a strategy.

It makes no sense to optimize.

  1. But to include this parameter I recommend only on long-term trade and use of large Stop-loss and Take-Profit.
  2. If you use lossless and trailing stop and receive a loss within the spread, you will not be able to trade profitably if you enable this parameter!
  3. For example : If your strategy includes StopLoss = 2000 points and TakeProfit = 500 points, and getting 100 losses and 1 profit.
  4. When you flip the strategy, you get 100 wins and 1 loss.
  5. But it's all relative. Every theory needs to be tested! Miracles do not happen!

Parameter ClosePositionifChangeOWNSignal - allows closing of open positions when the main signal changes.

It makes no sense to optimize.

  1. This option can be used to immediately cut off false signals.
  2. For example , if you do not use averaging (Displaying a series of items in the total profit) and agree that some signals will be false and you will receive an instant loss when closing on a signal, then you can enable this function.

The OWNSIGNAL_shift parameter is a very important parameter! It regulates the reception of a signal from a closed or current bar.

It makes no sense to optimize.

  1. I recommend leaving it by default.
  2. 1 - receiving signals from an already closed and fully formed bar.
  3. 0 - Receiving a signal from the current bar, which is only being generated.
  4. A detailed article on how to use the SHIFT signal .

Parameters Filter N options - have the same logical explanations, as well as signals. Therefore, we will not repeat them, but we say the following:

  1. You can use filters of other indicators, different from the signals!
  2. You can use the same indicator as in the signal, but set the TimeFrame higher than the TimeFrame signal. For example TF signal = M15 , and TF filter = H1
  3. The filter reduces the number of signals and open positions!
  4. One filter may not work with another signal. It all depends on the strategies you set up. Some filters and signals can conflict with each other.
  5. For example: Mooving Average shows a BUY signal, and the RSI Filter shows only SELL at that moment. Such conflicts have met!
  6. If you do not open a position using a filter, turn off the filter and investigate this question. Perhaps two indicators are in conflict!

Block 2: Signal options

In this block, we added parameters that can help in fine tuning the block of signals.

These parameters are auxiliary and I do not recommend optimizing them!

 input bool Show_alert_without_opening_positions = false;
input bool OpenBarControlOnly = false;
input bool ControlNewBarforSIGNAL = true;
input bool ReverseSignal = false; 

Parameter Show_alert_without_opening_positions - allows to disable real opening of positions. Instead, the Expert Advisor displays the information on the screen when the signal arrives.

It makes no sense to optimize.

  1. The advisor does not open the position.
  2. The information about the signal with calculated parameters is displayed
  3. You can enable or disable the opening of positions for this signal

The parameter OpenBarControlOnly is used only for the testing model in the form of Open Prices Only.

It makes no sense to optimize.

  1. Allows to include work of the adviser on open bars on the real schedule!
  2. When this parameter is enabled, the whole algorithm of the Expert Advisor is executed only when the new bar is opened 1 time.
  3. The results when you enable this option are similar to the results of testing in the Open Prices Only mode

Parameter ControlNewBarforSIGNAL - Parameter that includes signal processing only 1 time on a new bar.

It makes no sense to optimize.

  1. Allows you to significantly reduce the load on your computer while optimizing the Expert Advisor.
  2. Increases the testing speed in the strategy tester.
  3. Used only for SHIFT> 0

Parameter ReverseSignal - turns the general signal to the opening of positions.

Optimization of values: True - False

  1. Unlike Signal_Reverse, you can flip the common signal to open, including signals and filters

Block 3: Opening Filter options

This block contains those parameters that allow you to filter the opening of positions on technical limitations.

 input string oo_121 = "========= Opening Filter options =========";
input TypeTrade TypeTradeBUYSELL = 0;
input int MinuteToOpenNextPosition = 0;
input bool OpenOppositePositionAfterStoploss = false;
input bool ONlyOnePosbySignal = true;
input bool OnePosPerDirection = true;
input bool OnlyOnePositionPerMagic = false;
input bool OnlyAlternateSignals = false;
input int MAX_BUY_POSITION = 0;
input int MAX_SELL_POSITION = 0;
input int MaxSpreadToNotTrade = 0;
input int MinSpreadToNotTrade = 0; 

Parameter TypeTradeBUYSELL - includes the ability to trade only in one direction.

It makes no sense to optimize.

  1. Useful when you manage the Expert Advisor manually, for example when analyzing news.
  2. Or when you use additional means to determine the signals. For example, trend lines.
  3. I recommend this feature only when you are sure that the trend has direction!

The parameter MinuteToOpenNextPosition - prohibits the opening of an additional position on the signal.

It makes no sense to optimize.

  1. allows you to fine-tune the settings of trading on signals, when the trader is confident in the strength of the signal.
  2. Used with options ONlyOnePosbySignal = false
  3. Limits the opening of positions on the same signal

Parameter OpenOppositePositionAfterStoploss - Opens the opposite position if the previous position was closed by stop loss (in loss).

It makes no sense to optimize.

  1. This is an experimental option and can only be used by a trader who understands the essence of her work.

Parameter ONlyOnePosbySignal - allows the adviser to open only one position for the selected currency pair and magic.

You can optimize this parameter True False when using OnePosPerDirection = true

  1. Disabling this function allows you to "dial" positions on the same signal, in the same direction.
  2. I do not recommend changing this parameter.

Parameter OnePosPerDirection - allows the EA to open positions in only one direction or includes the possibility of trading in two directions at once.

It makes no sense to optimize.

  1. Works only when ONlyOnePosbySignal = false
  2. I do not recommend changing this parameter.

The OnlyOnePositionPerMagic parameter allows you to control the open positions of all Expert Advisors that have the same MAGIC.

It makes no sense to optimize.

  1. Works only when ONlyOnePosbySignal = false
  2. I do not recommend changing this parameter.

The parameter OnlyAlternateSignals - allows you to open positions only in the opposite direction from the last closed position ..

It makes no sense to optimize.

  1. Very much reduces the number of signals.
  2. I do not recommend changing this parameter.

Parameter MAX_BUY_POSITION MAX_SELL_POSITION   - allows you to limit the number of simultaneously open items ..

It makes no sense to optimize.

  1. Works only when ONlyOnePosbySignal = false.
  2. I do not recommend changing this parameter.
  3. This parameter is created for trading in different directions without limiting the number of signals.
  4. Allows you to limit the simultaneous opening of positions on one signal or finding open positions in the market.

Parameter MaxSpreadToNotTrade MinSpreadToNotTrade - allows you to limit the opening of positions on a signal when the spread is changed frequently by the broker.

It makes no sense to optimize.

  1. I do not recommend changing this parameter.
  2. These parameters should be set only on a real chart.
  3. They allow you to limit the signals when important news releases and a sharp jump in the spread, in which the adviser can set big stops.

Block 4: Close options

This block contains those parameters that allow you to close positions in certain situations.

 input string oo_123 = "========= Close options =========";
input bool ClosePosifChange = true;
input bool CloseChangeOnlyInProfit = true;
input int ClosePosition_After_X_Minutes = 0; 

Parameter ClosePosifChange - close the opposite position when changing the signal to open.

Optimization of values: True - False

  1. Useful when you want to change the current signal if it turns out to be false or when a new signal appears.
  2. Allows you to fix a profit or loss when changing the signal from the indicator.

Parameter CloseChangeOnlyInProfit - allows you to close only profitable positions.

Optimization of values: True - False

  1. It allows you to lock in profits when changing the signal from the indicator.
  2. Works only with ClosePosifChange = false

Parameter ClosePosition_After_X_Minutes - closing the position after a certain time.

Optimization of values: I recommend setting the numbers that are multiples of your TF.

For example: when using Expert Advisor on TimeFrame M15, set the values: start 0, step 15, stop 75.

  1. For a clear fixation of trading time.
  2. Allows you to close positions that were opened by signal. For example, 15 minutes after the opening
  3. Depends and works on the CloseChangeOnlyInProfit parameter:
  4. If CloseChangeOnlyInProfit = true, then the positions are closed only if they have a profit.

Block 5: Pending orders options

In this block, the parameters for working with pending orders are collected.

 input StopOrderType StopOrderUSE = 0;
input int StopOrderDeltaifUSE = 0;
input int StopOrderDayToExpiration = 0;
input int StopOrderBarToExpiration = 0;
input bool ReInstallStopOrdersNewSignalAppears = true;

Parameter StopOrderUSE - allows you to open pending or limit orders instead of positions.

Optimization of values: False - Use Stop Orders

  1. Allows you to additionally filter the signals by the operating distance!
  2. Use Stop Orders: If the Expert Advisor received a signal and we opened a pending order at a distance of 100 points. If the price has passed 100 points in our direction and hooked the pending order, then the signal is considered confirmed.
  3. Use Limit Orders: If the Expert Advisor received a signal and we opened a limit order at a distance of 100 points. If the price has passed 100 points in the opposite direction and hooked a limit order, then the signal is considered a rebound. You need to be sure that there will be a rebound.
  4. I do not recommend optimizing for Use Limit Orders
  5. The value of Use Stop Orders makes sense only for long-term trading.

Parameter StopOrderDeltaifUSE - the distance of setting a deferred or limit order.

Optimization of values: It is recommended to set the parameters individually for each pair.

  1. For example : If this is the EURUSD currency pair and you trade on the M30 period and the average price movement in the period, for example, 50 bars = 7500 points, then set this parameter for optimization as: start 0, step 100, stop 1000.
  2. For example : If this is the XUGUSD currency pair and you trade on the M1 period and the average price movement in the period, for example, 50 bars = 100 points, then set this parameter for optimization so: start 0, step 10, stop 100.
  3. For example : you need confirmation of the opening signal, and the average price movement in the period, for example 100 bars = 1000 points, then start 0, step 50, stop 500.
  4. Allows you to additionally filter the signals by the operating distance!
  5. Use Stop Orders: If the Expert Advisor received a signal and we opened a pending order at a distance of 100 points. If the price has passed 100 points in our direction and hooked the pending order, then the signal is considered confirmed.

Parameter StopOrderDayToExpiration - deletes the pending order if it did not work the set number of days.

It makes no sense to optimize.

Parameter StopOrderBarToExpiration - deletes the pending order if it did not work the set number of bars (Depends on your timeframe!).

Optimization options: start 0, step 1, stop 10

  1. Allows you to delete a pending order if the price does not break the pending order setting level

Parameter ReInstallStopOrdersNewSignalAppears - Resets the pending order when the signal is updated.

It makes no sense to optimize.

  1. Allows you to set a pending order every time a new signal appears.
  2. I do not recommend changing this setting

 

Block 6: Trading options

In this block are collected those parameters that are set at the time of the execution of positions.

It makes no sense to optimize.

 

Block 7: Stops options

Block of work with stop-loss and take-profit

 input string oo5 = "========= Stops options =========";
input bool VirtualStops = false;
input bool ForcedModifySLTP = false;
input minlevel SetMinStops = 0;
input int StopLoss = 2000;
input int TakeProfit = 0;
input bool Include_Commission_Swap = true; 

Parameters ForcedModifySLTP, SetMinStops, Include_Commission_Swap I do not recommend changing! It makes no sense to optimize.

The parameter VirtualStops - includes the ability to install virtual stop-loss and take-profits. Without actual modification of positions (stop loss and take-profit in position will be = 0)

Optimization of values: True - False

  1. All levels of StopLoss and TakeProfit are stored in global variables and on the chart!
  2. There is a virtual execution of Stop-loss and Take-Profit
  3. It makes sense to apply only when you need to install very small (less than the minimum possible level on the server) stop levels.
  4. It allows you to hide your stop levels from the broker, thereby making it difficult to understand the logic of your strategy.

Parameter StopLoss - StopLoss position.

Optimization of values: It is recommended to set the parameters individually for each pair.

  1. For example : If this is the EURUSD currency pair and you trade on the M30 period and the average price movement in the period, for example, 50 bars = 7500 points, then set this parameter for optimization as: start 0, step 100, stop 1000.
  2. For example : If this is the XUGUSD currency pair and you trade on the M1 period and the average price movement in the period, for example, 50 bars = 100 points, then set this parameter for optimization so: start 0, step 10, stop 100.
  3. Depends on your limits for each position.
  4. The more stoploss, the longer the holding time of the position. And the opportunity to hope that the price will return to the open position.
  5. The smaller the stop-loss, the faster the false signals will be closed.
  6. It makes no sense to use a small stop-loss, which is less than the distance averaging Distance

 

Parameter TakeProfit - Take-profit position.

Optimization of values: It is recommended to set the parameters individually for each pair.

  1. For example : If this is the EURUSD currency pair and you trade on the M30 period and the average price movement in the period, for example, 50 bars = 7500 points, then set this parameter for optimization so: start 0, step 25, stop 500.
  2. For example : If this is the XUGUSD currency pair and you trade on the M1 period and the average price movement in the period, for example, 50 bars = 100 points, then set this parameter for optimization so: start 0, step 5, stop 100.
  3. You can set a take-profit in the calculation of Stoploss / 2 or Stop-loss / 3.
  4. The larger the take-profit, the longer the holding time of the position. You can miss the profit position if it does not achieve the goal of the take-profit.
  5. The smaller the take-profit, the sooner the profitable signals will be closed.
  6. It makes no sense to use a small take-profit, which is less than the distance of the additional opening DistanceAdditionalOpening

 

 

Block 8: Lots options

Block of work with a fixed lot and autolot.

 input string oo4 = "========= Lots options =========";
input double Lots = 0.01;
input bool DynamicLot = false;
input double LotBalancePercent = 0.01;
input double RiskRate = 0;
input double MaxLot = 999;
input double Martin = 1; 

Parameters MaxLot , RiskRate I do not recommend changing! It makes no sense to optimize.

Lots parameter   - adjusts the volume of the position.

Optimization of values: Depends on your deposit. For example: For a step lot in 0.01 and a deposit of $ 1000: start 0.01, step 0.01 stop 0.1

  1. This parameter is better optimized after optimization of the remaining parameters of the strategy.
  2. When you increase the lot, you increase the profit obtained from one position.
  3. With an increase in the lot, you can drain the deposit.
  4. It does not make sense to optimize with DynamicLot = true
  5. Calculate the lot so that when you open a position with this lot, you only used 1-2% of the balance. For example:
  • To open one position with a lot of 0.01, you need 10 dollars of free margin.
  • If you use 100 stop points (where the price is 1 point = 0.1 dollar) you will receive a loss of $ 10. This is 1% of $ 1000

Parameter DynamicLot and LotBalancePercent - adjusts the auto calculation of the lot position.

Value optimization: DynamicLot = true and LotBalancePercent with parameters: start 0.1 step 0.1 stop 1

  1. This parameter is better optimized after optimization of the remaining parameters of the strategy.
  2. Allows you to increase the lot when making a profit in a geometric progression.
  3. Can affect the final profit.
  4. I do not recommend using values ​​greater than 1%.

Martin parameter   - Includes Martingale when closing on stoploss.

Optimization of values: start 0.1, step 0.2, stop 2

  1. It makes sense to use, only with the value StopLoss> 0
  2. If Martin is less than 1, then each next position and its lot will be less than the previous one.
  3. Values ​​less than 1 it makes sense to use only when the Lots   positions is greater than the minimum lot on the server.
  4. If Martin is greater than 1, then each next position and its lot will be larger than the previous one.
  5. The higher the value of Martin , the more dangerous the trade adviser.
  6. Martingale is a very simple and dangerous strategy.
  7. I recommend to check and read about our Martingale trading strategy: Two Sides

 

Block 9: Averager options

Block of work with the opening against the trend. Averaging positions.

 input string oo2 = "========= Averager options =========";
input bool AverageUSE = true;
input bool OnlyModify = false;
input int TakeProfitALL = 200;
input int Distance = 500;
input double DistanceMartin = 1;
input double LotsMartin = 1;
input int MaxOrdersOpen = 5; 

Parameters OnlyModify , I do not recommend changing! It makes no sense to optimize.

Parameter AverageUSE - Enables the averaging functions. Only with AverageUSE = true can other parameters be optimized!

Optimizing values: True - FALSE

  1. Averaging positions can load your deposit with additional positions.
  2. The averaging strategy requires a balance that is greater than the standard deposit (without averaging) at least 3 times.
  3. Averaging positions is an attempt to maintain a loss-making position in profit.
  4. If you use the recommended deposit, you can increase the number of profitable trades to 70-90%
  5. When using averaging, the advisor will try to bring a false signal into profit. Other signals will be ignored until the averaging series closes.

Parameter TakeProfitALL - Modifies the take-profit of all positions by 1 level

Optimization of the values: 10-50-1000 (start = 10, step = 50, stop = 1000)

  1. Serves as additional protection of positions, if you have switched off the light.
  2. It makes sense if YOU do not use the Additional Open AdditionalOpening = false

The parameter Distance - on which additional positions are opened against the trend!

Optimization of values: It is recommended to set the parameters individually for each pair.

  1. For example : If this is the EURUSD currency pair and you trade on the M30 period and the average price movement in the period, for example, 50 bars = 7500 points, then set this parameter for optimization so: start 0, step 25, stop 500.
  2. For example : If this is the XUGUSD currency pair and you trade on the M1 period and the average price movement in the period, for example, 50 bars = 100 points, then set this parameter for optimization so: start 0, step 5, stop 100.
  3. Another way to optimize this parameter is to use the average spread for the selected currency pair. This method is used in our TickSniper advisor
  4. For example: The average spread for a currency pair = 3 points, then the averaging distance = 50 * 3 = 150 points. In this case, the optimization can be set as follows: 100-25-250
  5. Read more about the recommendations regarding the averaging distance: Averager for mt4 and mt5
  6. The higher the distance values, the longer the adviser takes time to bring the series of positions into total profit
  7. The smaller the value of the averaging distance, the greater the load on your balance. The more positions will open. The faster you can make a profit, but at the same time there will be a big load on your trading account!

Parameter DistanceMartin - Increase distance Distance in each additional position!

Optimization of values: Only in extreme cases, 1-0.1-2

  1. This parameter should be optimized only if you need to increase the distance at each new position from the series.
  2. If Distance is too small, then DistanceMartin allows you to increase the step of the averaging grid.
  3. If DistanceMartin is less than 1, then the step of the averaging grid and Distance will decrease when each additional averaging position is opened!
  4. If DistanceMartin is greater than 1, then the step of the averaging grid and Distance will increase when each additional averaging position is opened!

 

Parameter LotsMartin - Increase the lot on each additional position!

Optimization of values: Only in extreme cases, 1-0.1-2

  1. Allows you to reduce the time for a series of positions to go into profit.
  2. Can give load to your trading account and balance.
  3. It is recommended to use only with sufficient balance!
  4. If LotsMartin is less than 1, then the next averaging lot will decrease when you open each additional averaging position!
  5. If LotsMartin is greater than 1, then the next averaging lot will increase when each additional averaging position is opened!

Parameter MaxOrdersOpen - Limit on the number of additional averaging positions against the trend!

Optimization of values: Only in extreme cases, 0 - 1 - 10

  1. Allows you to limit the load on the deposit, by limiting the number of new additional positions.
  2. I use the value of 5. But you can optimize this value for better results.

Block 10: Additional opening

Block of work with the opening on the trend. Additional discovery.

 input string oo10 = "========= Additional opening ================================== ======= ";
input bool AdditionalOpening = false;
input bool OnlyModifyAdditionalOpening = false;
input int StopLossALL = 0;
input int DistanceAdditionalOpening = 100;
input double LotsMartinAdditionalOpening = 1;
input int MaxOrdersOpenAdditionalOpening = 0; 

Parameters OnlyModifyAdditionalOpening , I do not recommend changing! It makes no sense to optimize.

Parameter AdditionalOpening - Enables the function of additional opening by trend. Only with AdditionalOpening = true can other parameters be optimized!

Optimizing values: True - FALSE

  1. Additional opening of positions allows you to get more profit if the signal was very profitable.
  2. An additional position can get a loss and lower profits from the initial series.
  3. Allows you to build a grid of positions in the direction of profit
  4. It makes sense to use it together with the Absolute or Trailingstop

Parameter StopLossALL - Modifies Stoploss of all positions by 1 level

Optimization of the values: 10-50-1000 (start = 10, step = 50, stop = 1000)

  1. Serves as additional protection of positions, if you have switched off the light.
  2. It makes sense if YOU do not use Averaging AverageUSE = false

Parameter DistanceAdditionalOpening - The distance on which additional positions are opened on the trend!

Optimization of values: It is recommended to set the parameters individually for each pair.

  1. For example : If this is the EURUSD currency pair and you trade on the M30 period and the average price movement in the period, for example, 50 bars = 7500 points, then set this parameter for optimization so: start 0, step 25, stop 500.
  2. For example : If this is the XUGUSD currency pair and you trade on the M1 period and the average price movement in the period, for example, 50 bars = 100 points, then set this parameter for optimization so: start 0, step 5, stop 100.
  3. Another way to optimize this parameter is to use the average spread for the selected currency pair.
  4. For example: Average SPREAD for a currency pair = 3 points, then the averaging distance = 50 * 3 = 150 points. In this case, the optimization can be set as follows: 100-25-250

 

Parameter LotsMartinAdditionalOpening - Increase the lot on each additional position!

Optimization of values: Only in extreme cases, 1-0.1-2

  1. Can give load to your trading account and balance.
  2. It is recommended to use only with sufficient balance!
  3. If LotsMartinAdditionalOpening is less than 1, then the lot of the next additional position will decrease when each additional position is opened!
  4. If LotsMartinAdditionalOpening is greater than 1, then the lot of the next additional position will increase when each additional position is opened!

Parameter MaxOrdersOpenAdditionalOpening - Restriction on the number of additional positions on the trend!

Optimization of values: Only in extreme cases, 0 - 1 - 10

 

 

Block 11: BreakEven WithoutLOSS options

Block break-even.

 input string MovingInWLUSE _ = "========= BreakEven WithoutLOSS options =========";
input bool MovingInWLUSE = false;
input int LevelWLoss = 0;
input int LevelProfit = 0; 

Parameter MovingInWLUSE - Enables the installation of stop - loss in the breakeven. Only with MovingInWLUSE = true can other parameters be optimized!

Optimizing values: True - FALSE

Parameter LevelWLoss - The level of setting stop loss in profit. Parameter LevelProfit - Value of profit in points when the breakeven begins to work

Optimization of values: 0-5-50

  1. The LevelProfit parameter must always be greater than LevelWLoss
  2. You can set LevelProfit optimization to 25-5-100, and LevelWLoss to 0-5-50
  3. The higher the value of LevelProfit , the more you need to go to the profit position, so that the advisor has set a break-even. This is protection against a small loss, but YOU can miss the profit.
  4. The greater the difference between LevelProfit and LevelWLoss , the less sensitive the break-even threshold is.

 

Block 12: Standard Trailing options

The unit of standard trailing stop.

 input string Trailing _ = "========= Standard Trailing options =========";
input bool TrailingStopUSE = true;
input bool IfProfTrail = true;
input int TrailingStop = 100;
input int TrailingStep = 1;
input bool SaveTPafterTrailingStop = false; 

IfProfTrail and TrailingStep and SaveTPafterTrailingStop parameters , I do not recommend changing! It makes no sense to optimize.

Parameter TrailingStopUSE - Enables the support and modification of stop-loss to profit. Only with TrailingStopUSE = true can other parameters be optimized!

Optimizing values: True - FALSE

  1. The difference between TrailingStop and BreakEven is that the trailing stop installs BreakEven and then pulls stop loss into profit if the situation on the market allows it.
  2. You can use different parameter values ​​for TrailingStop and breakeven. It makes no sense to use the same parameters.

Parameter TrailingStop - The distance of stop-loss from the current price. In this case, the position should collect TrailingStop profit items.

Optimization of values: 0-10-100 (With an average currency pair movement of 200-300 points per day)

  1. The higher the value of TrailingStop , the more you need to go to the profit position, so that the advisor has established a breakeven and continued to accompany the position. This is protection against a small loss, but YOU can miss the profit.

 

Block 13: TrailingStop by SAR

Trailing stop unit on the SAR indicator.

 input period periods6 = "========= TrailingStop by SAR ================================= ==== ";
input bool TrailingStopSAR = false;
input ENUM_TIMEFRAMES TrailingStopSAR_TimeFrame = PERIOD_CURRENT;
input double step = 0.02;
input double maximum = 0.2; 

Parameters TrailingStopSAR_TimeFrame and step and maximum , I do not recommend changing! It makes no sense to optimize.

Parameter TrailingStopSAR - Enables the support and modification of StopLoss in profit by the points of the indicator PARABOLIC. Only with TrailingStopSAR = true can other parameters be optimized!

Optimizing values: True - FALSE

  1. Allows you to set stop-loss on the extremes of the indicator.
  2. Always keeps the distance from the current price to the extremum, calculating the distance automatically
  3. It does not make sense to use it with TrailingStopUSE = true

 

Block 14: Time Trade options

The time management unit of the Advisor

 input string oo6 = "========= Time Trade options ================================= ======= ";
input bool TradeStartStopbyTime = false;
input string SeveralTimeWork = "";
input number of times41 = "=== Time Trade Start / Stop Time ============================";
input int OpenHour = 0;
input int OpenMinute = 0;
input int ClosePeriod_Minute = 0;
input int CloseHour = 23;
input int CloseMinute = 59;

input typeofclosebyouttime CloseAllTradesByOutOfTime = NotUse;
input time period43 = "=== Time Trade Days ============================";
input bool TradeByDays = false;
input string Days = "1,2,3,4,5,6,0";
input int DayForOptimization = 0;
input time period42 = "=== Time Trade Monday ============================";
input bool TradeStartbyTimeMonday = false;
input int OpenHourMonday = 0;
input int OpenMinuteMonday = 0;
input number of periods44 = "=== Time Trade Friday ============================";
input bool TradeStartStopbyTimeFriday = false;
input int OpenHourFriday = 0;
input int OpenMinuteFriday = 0;
input int CloseHourFriday = 23;
input int CloseMinuteFriday = 59;
input bool CloseFriday = false; 

In this block there are a lot of parameters and optimize all the parameters for a very long time.

You can optimize the time settings after optimizing all the other blocks in order to improve the test results.

Only with TradeStartStopbyTime = true it makes sense to optimize the remaining parameters!

I can advise optimizing only these parameters:

  1. OpenHour = 0-1-23
  2. CloseHour = 0-1-23
  3. TradeByDays = True-False
  4. DayForOptimization = 0-1-6

 

Block 15: CloseALL when Profit or LOSS options

Block closing on the total profit.

 input string CloseProfitLoss = "========= CloseALL when Profit or LOSS options =========";
input typeprofloss TypeofClose = 1;
input bool CloseProfit = false;
input double prifitessss = 10;
input bool CloseLoss = false;
input double lossss = -10;
input double TrailOptions = 0;
input double TrailOptionsStep = 0;
input double BalanceStart = 0;
input bool ForcedClose = true;
input bool MailSend;
input bool Orderdelete = true;
input bool OFFAfterClosePROF = false;
input bool OFFAfterCloseLOSS = false;
input bool CloseTerminalAfterClosePROF = false;
input bool CloseTerminalAfterCloseLOSS = false; 

Individual block. You can optimize parameters only when it is necessary for your strategy.

For example: When you open several positions or chaotic opening positions.

It makes sense to optimize with the inclusion of TypeofClose = PercentBalance the following parameters:

  1. CloseProfit = True-False;
  2. prifitessss = 0.1-0.1-1
  3. CloseLoss = True-False;
  4. lossss = (- 0.1) - (- 0.1) - (- 1)

Other parameters of the Expert Advisor

I do not recommend changing and optimizing the rest of the system parameters without studying the detailed descriptions of these parameters. And also without knowing what is happening with the adviser when you turn on the other parameters.

 

 

Optimization of the Expert Advisor in the examples

Our advisors have the same algorithm of signals and functions.

But in view of the differences between the terminals MT5 and MT4 there may be errors in performance.

The strategy tester in the MT5 terminal, at the moment, is the most technologically advanced and accurate.

The most important feature of the terminal MetaTrader 5 and Strategy Tester is the ability to test on real ticks. The spread and stop levels in the MetaTrader 5 are floating. This means that testing in the MT5 strategy tester is as close to real trading as possible.

We will not dwell on testing and optimization in the MetaTrader 4 terminal! You already know how to test it. And the optimization process is similar to the process mt5 (Settings and Startup)

But the main feature of the strategy tester from MT5 is, of course, the ability to optimize in the cloud MQL5 Cloud Network

The cloud allows to optimize the advisor for thousands of other computers at a minimal price. It's very cheap and fast. Therefore, I highly recommend using the MQL5 cloud.

 

In the archive with the Expert Advisor you will find several files with a set for optimization. These are just examples, but it will show you how to configure optimization.

Remember: Each currency pair and broker have their trading conditions (Spread, swap, commission, settlement method, execution, account type), so the optimization results may differ!

In order to make the results more and less similar, you need to turn off Random Delay. To optimize it is not needed!

 

Setting up the Strategy Tester:

  1. Select an Expert Advisor from the list.
  2. Set the currency pair for which you will conduct the test.
  3. TF is better to choose M1. ( TimeFrame will be set by the Expert Advisor from its settings)
  4. Optimization date - you can select the current year! Remember! Results in the past, can not guarantee profit in the future! Optimizing every half year is the most practical range!
  5. Forward can be set to 1 month. But we advise getting clean results. And then already carry out Forward Test
  6. Deposit (Deposit) is better to establish the one from which you will begin your trade. Do not set too small a balance. And also too big!
  7. Leverage expose the one on which you will trade.
  8. Optimizing the Slow Complete algorithm
  9. and be sure! Every tick, based on real ticks!

Configuring Expert Advisor Settings:

  1. Click the Inputs tab and load our Set file
  2. Check or uncheck the options you want to optimize. (By default, I set up the file so that you can optimize for all important parameters)
    1. Value - This is the fixed value of the parameter. The Expert Advisor will take this value if this parameter is not optimized. Or when testing!
    2. Start - The initial value of the parameter for optimization.
    3. Step - The step of changing the parameter each time the optimizer runs.
    4. Stop - The final value of the parameter for optimization.
  3. Remember! The more parameters and steps for optimization, the more time is needed to complete the testing and optimization!

Enable cloud optimization

I highly recommend including cloud OPTIMIZATION!

In this case, I disable the work of my processor. So my computer does not slow down when optimizing. And the cost of one pass in the cloud is less than 0.01 cents!

 

 

 

Press the START button and go on your business!

 

 

Optimization results

Optimization in all parameters can be done in 2-3 days.

It's long enough, But you'll get the results of all the passes.

For more than 20,000 passes, we spent about $ 6 on optimization. You can adjust the number of passes, limiting the number of optimization parameters.

When writing the article, we will follow the examples.

 

Let's say we got results on our optimization.

We select the Profit column and sort the results by the largest profit.

 

You can conduct a single run of results to form a complete report on the items.

 

After the testing is completed, we will get results with which we can agree.

And if they suit us, then We can save the settings!

 

Remember: Test results are only 99% true. On real accounts, you may have delays in the execution of orders, slippage, power outages and other factors.

 

Multicurrency testing and optimization in the MetaTrader 5 terminal

After these actions, I recommend checking these settings on other currency pairs. To do this, in the market review, I added only those currency pairs that I think are the main and which you can trade:

Customize the optimization by symbols:

Run the optimization and get the results:

These actions are aimed at finding universal parameters of the adviser to use on any currency pair.

As you can see from the results of optimization for currency pairs. This set of settings gives a good result in only 4 currencies out of 11!

 

In our advisor for MT5 there is the possibility of working simultaneously with 10 or more currency pairs and the same settings.

Including, you can optimize all parameters simultaneously for 10 currency pairs. The time of such optimization is significantly delayed, but you do not waste time selecting a currency pair and optimizing its parameters

+ You can find out the result of the work of the adviser, who simultaneously trades on 10 currency pairs.

To do this, use the following options:

 input string pair = "========= Symbols options =========";
input string PAIR1 = "";
input string PAIR2 = "";
input string PAIR3 = "";
input string PAIR4 = "";
input string PAIR5 = "";
input string PAIR6 = "";
input string PAIR7 = "";
input string PAIR8 = "";
input string PAIR9 = "";
input string PAIR10 = "";
input string PAIR11 = "";
input string PAIR12 = ""; 

It is important that these parameters are filled in as the names of the symbols are filled in your broker. for example:

 PAIR1 = EURUSD.m
PAIR2 = USDCHF.m
PAIR3 = USDJPY.m
PAIR4 = XAUUSD.m
PAIR5 = XAGUSD.m
PAIR6 = EURGBP.m
PAIR7 = EURJPY.m
PAIR8 = EURCHF.m
PAIR9 = GBPUSD.m
PAIR10 = GBPJPY.m
PAIR11 = GBPCHF.m 

If the test does not start and you get an error:

 2018.05.14 10: 42: 15.916 Core 1 2018.01.01 00:00:00 Check in MarketWatch EURUGBP.m !
2018.05.14 10: 42: 15.916 Core 1 OnInit critical error

So you indicated the wrong name of the currency pair!

Thus, you can optimize the settings for making a profit, when trading simultaneously on 11 currency pairs. !!

Examples of using functions

Parameter for receiving the alarm bar

shift (0,1,2 .....) Bar number 
This parameter is the bar number from which your indicators will take a signal. When ordering an expert, you must specify such parameters for determining the signal: Open the trade immediately after the signal, or wait until the signal forms on the closed bar and open the deal only by opening the next bar 

Some indicators, by virtue of their algorithms, have a clear definition: on which bar the signal is given. If we talk about clarity and proper execution of the order: then the transaction must be processed only at a closed bar ie. parameter shift = 1, If ​​it is necessary to open a trade immediately upon the arrival of a signal on the current bar and the indicator this allows you to set shift = 0.

Flipping Strategy Signals

ReverseSignal (true - false) Enabled / Disabled 
This parameter is a flipping of your indicators \ indicators 
If your expert is built on a certain algorithm, or on certain indicator signals, you have the opportunity to swap the BUY \ SELL signals without reprogramming 
For example : ReverseSignal = true 
Your indicator signaled to BUY, but the expert will open the SELL deal. 
Your indicator signaled to SELL, but the expert will open the BUY deal.

Using pending orders when opening instead of position

StopOrderUSE (Orders - Limit-false) and StopOrderDeltaifUSE (From the minimum allowed stop on the server) in points 
This parameter in the bundle is an opportunity to open not positions and pending orders. If you allow after the onset of the signal you want to check it by setting a pending order 
For example : StopOrderUSE = Orders StopOrderDeltaifUSE = 100 
If your indicator has signaled the opening of BUY, the EA will open the pending BUYSTOP order at the Ask + StopOrderDeltaifUSE price of the items 
If your indicator has signaled the opening of SELL, then the advisor will open the pending order SELLSTOP at the Bid-StopOrderDeltaifUSE price 
If the parameter is less than the minimum allowed on the server, the expert will report an error of 130

Magic number

Magic (0 .... 99999) Number 
This parameter is a special number of the expert, which stands on the chart. If you use a lot of experts on different graphs, to avoid problems with entanglement of transactions between experts, you need each expert to assign a separate number. 

If, for example, you use 1 expert but with different settings, you need each individual expert with the settings to assign your magic number. Also, this parameter should be changed in different currency pairs, in order to soon figure out a detailed report, which expert to which pair was tied.

Stoploss / Take-Profit Positions

StopLoss (0 ...) in points 
This parameter represents StopLoss of each position, This is the number of minus points at which the transaction will be closed by the server 
0 - the parameter is disabled, and StopLoss of the transaction will be 0.

TakeProfit (0 ...) in points 
This parameter represents the Take Profit of each position, This is the number of plus points at which the transaction will be closed by the server 
0 - the parameter is disabled, and the Take-Profit transaction will be 0.


This parameter must be set at least - the minimum allowed stop on your server. 
If the parameter is less than the minimum allowed on the server, the expert will report an error of 130

 

Closing of transactions on the back signal

ClosePosifChange (true - false) 
This parameter controls the ability to close the opposite transaction when you open a new one. If your indicator uses the signals: BUY - SELL - BUY - SELL, then when this parameter is enabled, the expert will close the opposite 
CloseChangeOnlyInProfit (true - false) 
This parameter includes the ability to close on the reverse signal only then! When the reverse direction went into profit and has a common + (If the transaction is one = it is considered a profit, if the transaction is somewhat = the total profit of all reverse-direction transactions is considered)

 

Number of signal positions of the strategy

ONlyOnePosbySignal (true - false) Enabled / Disabled 
This parameter controls the ability to open one position or multiple positions. 
At that in the switched on position, with 1 signal for 1 bar 1 position will be opened. 
For example : The signals of your strategy give an alternate signal to BUY on each new bar, while if ONlyOnePosbySignal = false, then on each bar, when the signal arrives, the BUY transaction will be opened 
If this function ONlyOnePosbySignal = true, the EA can open only one BUY and one SELL transaction and wait until they close 

OnePosPerDirection : Opening 1 deal on 1 direction 
for example : 
if OnePosPerDirection = true and ONlyOnePosbySignal = false 
then the advisor can open 1 Bai transaction on a signal and 1 Sell deal on a signal 
if OnePosPerDirection = false and ONlyOnePosbySignal = true 
then the advisor can only open one transaction at a signal, either Bai or CELL 
if OnePosPerDirection = false and ONlyOnePosbySignal = false 
then the adviser can open any transactions for each indicator signal 

OnlyOnePositionPerMagic : Opening 1 position per 1 magick, 
The advisor checks whether there are open positions for this magick in other currency pairs. If there is no position, the advisor will open the transaction at the signal, and the remaining advisers will wait for the completion of this transaction. 

Fixed lot

Lots (0.01 .........) Setting a fixed lot for all trades 
This parameter sets the number of lots when opening a trade. The lot is fixed and applies to all transactions 
In this case, you must clarify with the broker the minimum allowable lot, to open a deal

Martingale

Martin (1 ....) in the coefficient 
This parameter allows you to use the Martingale principle for your strategy, in which the following unprofitable trade will be opened at the rate of Lot * Martin 
If the parameter is 1, Martingale is not used. 
For example : Lots = 0.01 Martin = 2: 
1 BUY deal (0.01) closed in the minus or stop loss (minus) 
2 the transaction will be opened with a lot of 0.01 * 2 = 0.02 
3 if the previous transaction was closed on stop-loss, the next transaction will be opened by lot 0.04 
If the previous transaction was closed in + or on the takeprofit, the next one will be opened with the initial lot of 0.0

Working hours of the expert

Attention: Trade in time means only filtering to open new deals on new signals. 
All other functions: Trailingstop, Absolute (Stop-loss on the break-even point), Averaging, Trend rolls, and so on, works around the clock. 
Attention: You can optimize all the trading time parameters in the tester. 

If TradeStartStopbyTime = false, then the Expert Advisor trades around the clock, if no work is specified on Friday and Monday 
If TradeStartStopbyTime = true, then the trading time is enabled: 

The commencement of trading hours begins on Monday. 
The Expert Advisor starts working on Monday, if set by TradeStartbyTimeMonday = true by the time OpenHourMonday: OpenMinuteMonday 
For example , OpenHourMonday = 3 and OpenMinuteMonday = 40, then the EA starts trading on Monday at 03:40 on server time 
(the time of your broker, as indicated in the market review). 

Next, the Expert Advisor checks the trading time by parameters: OpenHour: OpenMinute - the start of trading and CloseHour: CloseMinute - the end of the trade for 1 day. 
For example : OpenHour = 5 and OpenMinute = 0, and also CloseHour = 18 and CloseMinute = 59, then the EA will trade every day from 5:00 to 18:59. 

If you want to specify the trading period from the start time, you can set the parameter ClosePeriod_Minute - the period in minutes. 
For example , OpenHour = 6 and OpenMinute = 0 and ClosePeriod_Minute = 180, then the advisor sets the trading time from 6:00 to 9:00 (6 + 180 minutes = 9 hours). 

You can also specify several time slots for trading in the SeveralTimeWork parameter. Recording format: HH: MM-HH: MM; 
where: Start trading hour: Minute start trading - Part stop trading: Minute of stop trading. 
For example , SeveralTimeWork = 3: 00-5: 00; 7: 30-8: 50; 12: 00-15: 00; 
then the adviser will trade 3 pieces of time. from 3 hours to 5 hours, from 7:30 to 8:50 and from 12:00 to 15:00. All the rest of the time the counselor will not open new deals. 

Also you can close all open trades and pending orders during non- business hours, CloseAllTradesByOutOfTime = true. 
In this case, the adviser will trade at the time specified above, and when the trading time is over, the adviser will close all open positions and orders. 
TradeStartStopbyTimeFriday - Trading time for Friday. 
In our adviser YOU can set the time for trading adviser on Friday. 
Time options for Friday: OpenHourFriday: OpenMinuteFriday - CloseHourFriday: CloseMinuteFriday 
For example, you need the adviser not to open new deals on Friday after 18:00, then YOU establish: 
OpenHourFriday = 0: OpenMinuteFriday = 0 - CloseHourFriday = 18: CloseMinuteFriday = 0 
In this case, the adviser will not open new deals after 18:00 

Also you can close all open trades and pending orders on Friday at the set time of 18:00, CloseFriday = true. 
CloseAllTradesByOutOfTime 

In our block of work on time YOU can specify Trading days for trade: TradeByDays 
For example, TradeByDays = true Days = 1,2,3 - in this case the adviser will trade only on Monday, Tuesday and Wednesday according to the time set above. Or trade around the clock for these 3 days, if time is not set. 
If YOU specified Days = 1,2,3,4,5 but the parameter TradeStartStopbyTimeFriday = false, the Expert Advisor will not trade on Friday. 

Also you can set 1 day for optimization in the parameter DayForOptimization . 
This option is useful in order to determine which days on the optimization were the most profitable. 
for example, DayForOptimization = 3, then the EA will only trade on Wednesdays. 

You can set the start of trading on Monday and stop trading on Friday, while the rest of the days the adviser will trade around the clock. 
You can set the start on Monday and certain hours on the remaining days.

Classic TralingStop

TrailingStopUSE (true - false) IfProfTrail (true - false) TrailingStop (in points) TrailingStep (in points) 
These parameters include \ disable automatic tracking of the position by modifying the stop-loss in the + zone. 
TrailingStopUSE - Enables / disables the Trillingstop function 
IfProfTrail - at true the Expert Advisor starts modifying only from the moment the position is exited to the Break-even (stop-loss on the breakeven point). at false - the trawling stop starts to work immediately after positioning and pulls it after the price 
TrailingStop - the distance in points from the current price to the estimated stoploss. This parameter can not be less than the minimum allowed on your server. 
TrailingStep - step of modification stoploss 
For example : StopLoss will be modified every TrailingStep 50 points at a distance of TrailingStop 100 points from the current price 

TralingStop by PARABOLIC SAR

TrailingStopSAR (true - false) step and maximum (SAR Parabolic Parameters) 
These parameters include the possibility of modifying Stop-loss by the Parabolic 
In this case, the stop-loss will be modified at each new value of the Parabolic SAR. 
Accordingly, BUY is modified when the Parabolic is below the price, Sell is modified when the PARABOLIC is above the price.

The closing function for total profit / loss

These parameters control the ability to close the transaction / transaction on this instrument and the magic, having reached one of the parameters 
Options 
TypeofClose = 1; -Type of closing on profit 1 - Dollar, 2-Points, 3 -% Equity, 4 -% Balan 
CloseProfit = false; Closing if the total cumulative position (all transactions) went into profit + 
prifitessss = 10; -The number of units (depending on the choice of TypeofClose) to close the profit. 
CloseLoss = false; Closing if the total cumulative position (all transactions) came at a loss - 
lossss = -10; -The number of units (depending on the choice of TypeofClose) to close the loss. 
For example : 
If you want to close several BUY \ SELL transactions with a profit of $ 10: 
TypeofClose = 1; CloseProfit = true; prifitessss = 10; 
If you want to close several BUY \ SELL transactions with a loss of 200 points: 
TypeofClose = 2; CloseLoss = true; lossss = 200; 
If you want to close several BUY \ SELL transactions with a 5% deposit loss, and close several BUY \ SELL transactions with a 10% deposit return: 
TypeofClose = 4; CloseLoss = true; prifitesssslossss = 5; CloseProfit = true; prifitesssslossss = 10;

Installing stoploss in a break-even

MovingInWLUSE (true - false) LevelWLoss (in points) LevelProfit (in points) 
These parameters govern the ability to include a modification of the transaction in the Absolute (stop-loss on the break-even point), at the earliest opportunity 
for example 
You want to establish a stop-loss in the Absolute (stop-loss on the breakeven point), when the transaction will gain +10 points of profit: 
MovingInWLUSE = true; LevelWLoss = 0; LevelProfit = 10; 
You want to set a stop-loss of +5 points, when the trade will gain +20 points of profit: 
MovingInWLUSE = true; LevelWLoss = 5; LevelProfit = 20; 
The difference between LevelProfit - LevelWLoss should always be greater than or equal to the minimum stop on the server 

Averaging, opening against the trend

UseAverAdditionalOpenOrderinOne - true The number of orders is considered common and the refresher and the averager; 
AverageUSE - Use averaging, opening additional orders against the trend; 
Distance - The distance of the opened positions grid; 
LotsMartin - Increase the lot for the grid positions; 
MaxOrdersOpen - Maximum number of knees 0 - unlimited; 

This EA supports the function of averaging positions. The principle of its work is that when the price goes in the opposite direction from the transaction and passes a certain distance Distance in points - the adviser opens the transaction in the same direction as the main transaction with the lot of the main transaction * LotsMartin . Thus, out of 2 transactions, an average trade with a total take-profit is obtained (if it is set in TakeProfit parameters). 
If the trailing stop TrailingStopUSE is enabled, the advisor will accompany the entire series of trades on the common trailing stop. 
Also it is possible to set the maximum number of knees in the series by the MaxOrdersOpen parameter 
For example : 
AverageUSE = true Distance = 100 LotsMartin = 2 MaxOrdersOpen = 3 TakeProfit = 50 

Trimming, opening by trend

AdditionalOpen - Use the opening of additional orders on the trend; 
DistanceAdditionalOpen - The distance of the open positions of the grid is topping up the trend; 
LotsMartinAdditionalOpen - Increase the lot for the grid positions; 
MaxOrdersOpenAdditionalOpen - The maximum number of knees 0 is unlimited; 

The advisor is able to top up the trend if the price goes to the positions. If the price passes the Distance additionalOpen distance in points from the opening price of the position, the advisor will open the same position with the lot lot * LotsMartinAdditionalOpen . It is also possible to set the maximum number of refilling positions 
For example : 
AdditionalOpen = true DistanceAdditionalOpen = 100 LotsMartinAdditionalOpen = 2 MaxOrdersOpenAdditionalOpen = 3 TakeProfit = 500 
You can also set stoploss, trailing stop, Break-even (stop-loss on the breakeven point) 

Limit loss and profit for 1 day \ Week \ Month

Limiting LimitFor - Limit type day / week / month 
LimitForLosses - limit on profit 
LimitForProfits - Limit on loss 
LimitType - Limit type by Dollars, Points, Deposit Interest 
ClosebyLIMITING - Close the adviser's transactions when the Limit is exceeded 
UseCurrentProfit - Take into account, when calculating the limit, the current profit / loss 

This function is able to disable the work of the Expert Advisor if the Expert Advisor gained a certain profit / loss in the deposit currency for the day \ month \ week. The next work of the adviser will be the next day \ week \ month 
For example LimitFor = DAY LimitForProfits = 1 Total profit closing = 10 dollars 
Also you can select LimitType limit type for calculations. In dollars, points, percent of the balance of the account. 
If you need to close and delete all transactions for this Expert Advisor, if you exceed the limits, you can put ClosebyLIMITING = true 
The UseCurrentProfit parameter disables or allows you to account for the current floating profit / loss for this Expert Advisor

Virtual stops

VirtualStops - Hides real stops in positions and makes them virtual. 
This parameter turns real stoploss, takeprofit, trailing stop, Break-even (stop-loss on the break-even point) and everything related to 
stops in virtual stops. Those. The Advisor does not place a stop-loss / take-profit on the broker's server, and 
keeps all the data in memory. 
As soon as the price crosses the virtual level of stops - the adviser closes the position. 
The advantages of virtual stops are obvious. It is possible to exhibit even the most minimal take-profit 
or stoploss of 1 point. The server does not see your stops, so it can not knock them down. 
But there are also disadvantages: The computer should always be turned on. Otherwise, the virtual stoploss will not work. 
At closing of positions - there can be requotes, thereby to move points of stops. 


Completely redesigned algorithm of virtual StopLoss \ TakeProfit \ trailing stop \ Bugless (setting stop-loss on break-even point). 
Now all virtual stops are displayed on the chart and are the key when closing positions on these levels. 
Data is written in the form of lines and global variables. 
Note : If you delete a stop line on the chart and global variables - Virtual Closing by this 
the line will not work. 
Attention : Check your experts and indicators to remove lines from the chart and global variables! 
Attention : Virtual levels are triggered at the current price, after which the closing occurs. 
During closing, there may be slippage in a couple of points! 
Attention : When you enable VirtualStops, the testing speed is significantly lower.

Ghost all parameters with stops, to the lowest possible level on the server

SetMinStops - Automatic translation of installed 
This parameter allows you to bring your stop parameters (StopLoss, TakeProfit, Distance for 
pending orders, trailing stop, Absolute (stop loss on breakeven point)) to the lowest possible level on the server. 
Checking the levels occurs every tick. 
For example: If you set StopLoss = 10 points, and the minimum stop on your server = 20 points, then 
when you open a position - the server will return an error 130 indicating that the level of stops is less than the minimum. 
If you enable the SetMinStops option, the Expert Advisor will automatically bring your stop loss to level 20 
points so that there is no error 130.

conclusions

Optimization and testing of advisers is quite a necessary occupation.

You may think that optimization is very difficult and expensive. But you are going to earn millions of dollars?

You should understand that there is nothing easy on Forex. And every EA is just an algorithm built in the code.

We have been working for more than 10 years and know what trade experts are.

With confidence, we can say that optimizing and configuring one EA is much easier than searching and optimizing thousands of other robots.

  1. Test and find your options for trading, which will please you.!
  2. Optimize every half a year!
  3. Follow the adviser, study the log and the log files, be attentive to the advisor!
  4. Adjust the parameters of the advisers depending on the news.

Learn the materials on Forex trading.

The X: Testing and Optimization_1
Здесь можно скачать The X: Testing and Optimization
Купить The X: Testing and Optimization можно здесь - Прочитать о The X: Testing and Optimization можно здесь - Обсуждение The X: Testing and Optimization - стейты, отзывы, комментарии - Отзывы о The X: Testing and Optimization - Настройки к The X: Testing and Optimization - Мониторинг The X: Testing and Optimization - Download The X: Testing and Optimization - Buy The X: Testing and Optimization - Read about The X: Testing and Optimization - Discusion of The X: Testing and Optimization - Comments of The X: Testing and Optimization - Settings The X: Testing and Optimization - Monitoring The X: Testing and Optimization - The X: Testing and Optimization скачать бесплатно - The X: Testing and Optimization ключ - The X: Testing and Optimization открытый код - The X: Testing and Optimization скачать
-
Читать The X: Testing and Optimization
0 $

We will not talk about how to test or optimize the advisors in the terminal mt4 and mt5! We already talked about this in our article: Testing and Optimizing Expert Advisors

In this article I will show you some ways to optimize the Expert Advisor and the right function to work with an Expert Advisor.

We have created several sets of optimization settings for you so that you can start optimizing on your computer.

Starting with version 18.008 we gave the names of all variables to the same name in the version for mt4 and mt5. This is done so that you can transfer configuration files from one terminal to another!

We will show examples of trading strategies based on THE X.

Remember : The X is a designer of trading strategies. By grouping and applying different combinations of functions, you can get absolutely different results.

English instructions and articles FinanceApplication Windows 01.08.2018
5 1
Expforex Идеи для Форекс https://www.expforex.com/1NEWDESIGN/NEWLOGO/LOGONEW.png expforex@meta.ua Украина expforex2