The X and The xCustomEA: Testing and Optimization

The X and The xCustomEA: Testing and Optimization

Exp – Partial Close and Trailing. Partial closing of positions on rollbacks
SafetyLOCK PRO Protect your positions by locking using the opening of opposite pending orders (HEDGE)
Exp – Partial Close and Trailing. Partial closing of positions on rollbacks
SafetyLOCK PRO Protect your positions by locking using the opening of opposite pending orders (HEDGE)

Description

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

The x and The xCustomEA are the best Expert Advisors for Forex, which allows you to create your strategy from standard indicators and iCustom indicators and use our functions as Expert Advisors (EA).

We will not talk about how to test or optimize the Expert Advisors (EA)in the terminals 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.

RememberThe X or The xCustomEA is a designer of trading strategies. By grouping and applying different combinations of functions, you can get different results.

You must understand that miracles do not happen. And our Expert Adviser (EA) is just an instrument for trading on Forex. Forex – This is 100% risk!


EA The xCustomEA Universal Trading Expert Advisor (EA) on iCustom indicators.


The X – Universal Expert Advisor (EA) for Forex on Standart indicators.


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

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

We will discuss the testing methods, the choice of optimization strategies, and the inclusion of various functions to work on Forex.

Start Step Stop

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(Pips) (Stoploss, TakeProfit, Distance, etc.) I used it 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(Pips) 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(Pips) 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

Preparing for Optimization of the Expert Advisor

Our Expert Advisors (EA) have the same algorithm of signals and functions.

However, because 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 MetaTrader 5 are floating, which means that testing in the MT5 strategy tester is as close as possible to live trading.

We will not explain testing and optimization in the MetaTrader 4 terminal! You already know how to test it. 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 optimizing the Expert Advisor (EA) for thousands of other computers at a minimal price. It’s very cheap and fast. Therefore, I highly recommend using MQL5 Cloud.

In the archive with the Expert Advisor, you will find several files with a set for optimization. These are just examples, but they 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!

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

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, past results can not guarantee a 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 first. Then, we will carry out the 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 exposes 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 turn off the work of my processor. So my computer does not slow down when optimized. And the cost of one pass in the cloud is less than 0.01 cents!

Press the START button and go on your business!

Customizable parameters for optimization

You can download our files for optimization for The X

Block 1: Trade signals and filters

In our Expert Advisors (EA), more than 20 trading strategies are 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 the 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 Expert Advisers (EA) on custom indicators, and we can say with confidence that 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 things to consider when starting 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 Expert Adviser (EA) on your indicator, then you need open-source code:

  1. Open source The X for MetaTrader5 (Currently unavailable)
  2. Open source The X for MetaTrader4 (Currently unavailable)
  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 all conditions for the signal are met, for example, the 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. 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 Expert Adviser (EA) 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 wakes up. It’s a signal.
  5. Opening positions occur after the signal is committed. The lines intersect, and then the position opens. If the lines were crossed earlier, 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. Signals are filtered at the current value of the indicator. If the Fast MA is above the slow MA, then only BUY should open this filter.

Tips for optimizing signal parameters:

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

We advise you not to use more than 2 filters for the signal, so we hid the other 3 filters at 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 Expert Advisor (EA), our first users were for us “Wishlist” and wishes. We fulfilled the requests and made 5 filters.

Variants of signal block optimization

IndSigToTradeparameter can be optimized! 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. But we advise you to put the TimeFrame on which you usually trade.

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

The Signal_Reverse parameter is used to overturn strategies! Sometimes, a trade becomes more profitable when we reverse a strategy.

It makes no sense to optimize.

  1. But to include this parameter, I recommend only 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(Pips) and TakeProfit = 500 Points(Pips), you will have 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 the closing of open positions when the primary signal changes.

It makes no sense to optimize.

  1. This option can be used to cut off false signals immediately.
  2. For example, suppose 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. In that case, you can enable this function.

The OWNSIGNAL_shift parameter is very important! 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 that are 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, the Moving Average shows a BUY signal, while the RSI Filter shows only SELL at that moment. Such conflicts have been met!
  6. If you do not open a position using a filter, turn off the filter and investigate this question. Perhaps two indicators 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!

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

Parameter Show_alert_without_opening_positions – allows turning off the 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 Expert Advisors (EA) does not open the position.
  2. The information about the signal with calculated parameters is displayed
  3. You can turn on or off 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. This allows for the inclusion of the Expert Adviser’s (EA) work on open bars on the real chart!
  2. When this parameter is enabled, the Expert Advisor’s whole algorithm is executed only when the new bar is opened once.
  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. It allows you to significantly reduce the load on your computer while optimizing the Expert Advisor.
  2. Increases are 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 reverse the main 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.

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

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

It makes no sense to optimize.

  1. It is useful when you manage the Expert Advisor manually, for example, when analyzing the 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. It allows you to fine-tune the trading settings 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 Expert Advisor (EA) to open only one position for the selected currency pair and magic number.

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

  1. Turning off 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. It 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 deals (positions).

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. It allows you to limit the simultaneous opening of positions on one signal or find open positions in the market.

Parameter MaxSpreadToNotTrade MinSpreadToNotTrade allows you to limit the opening of positions on a signal when the broker frequently changes the spread.

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 Expert Advisor (EA) 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. It is useful when you want to change the current signal if it turns out to be false or when a new signal appears.
  2. It allows you to fix a profit or loss when changing the signal from the indicator.

Parameter CloseChangeOnlyInProfit – allows you to close only profitable positions.

If a signal is received to open the opposite position, it will be closed only when the current position is in profit.

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 = true

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. To tightly fix the time when the Expert Adviser (EA) is allowed to trade.
  2. It allows you to close positions that were opened by the 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 if they have a profit.

Block 5: Pending orders options

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

 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. It allows you to filter the signals by the operating distance additionally!
  2. Use Stop Orders: If the Expert Advisor receives a signal and we open a pending order at a distance of 100 Points(Pips), if the price has passed 100 Points(Pips)in our direction and hooked the pending order, then the signal is considered confirmed.
  3. Use Limit Orders: If the Expert Advisor receives a signal and we open a limit order at a distance of 100 Points(Pips), if the price has passed 100 Points(Pips)in the opposite direction and hooked a limit order, then the signal is considered a rebound. It would be best if you were sure that there would 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 is the Distance to the pending stop 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. The average price movement in the period, for example, 50 bars = 7500 Points(Pips), then set this parameter for optimization as start 0, step 100, and 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(Pips), 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(Pips), then start 0, step 50, and stop 500.
  4. It allows you to filter the signals by the operating distance additionally!
  5. Use Stop Orders: If the Expert Advisor receives a signal and we open a pending order at a distance of 100 Points(Pips), if the price has passed 100 Points(Pips) in our direction and hooked the pending order, then the signal is considered confirmed.

Parameter StopOrderDayToExpiration – deletes the pending order if it does not work the set number of days.

It makes no sense to optimize.

Parameter StopOrderBarToExpiration deletes the pending order if it does not work for the set number of bars (it 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(StopOrder) setting level

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

It makes no sense to optimize.

  1. It 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, those parameters that are set at the time of the execution of positions are collected.

It makes no sense to optimize.

Block 7: Stops options

Block of work with stoploss and takeprofit

 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 ForcedModifySLTPSetMinStopsInclude_Commission_Swap I do not recommend changing! It makes no sense to optimize.

The parameter VirtualStops – includes the ability to install virtual stoploss and take profits. Without actual modification of positions (stoploss and takeprofit 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 Stoploss and TakeProfit
  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. The average price movement in the period, for example, 50 bars = 7500 Points(Pips), then set this parameter for optimization as start 0, step 100, and 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(Pips), then set this parameter for optimization so: start 0, step 10, stop 100.
  3. It depends on your limits for each position.
  4. The more stoploss, the longer the holding time of the position, and the more opportunity there is to hope that the price will return to the open position.
  5. The smaller the stoploss, the faster the false signals will be closed.
  6. It makes no sense to use a small stoploss, which is less than the Distance averaging Distance.

Parameter TakeProfit – Takeprofit 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(Pips), 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(Pips), then set this parameter for optimization so: start 0, step 5, stop 100.
  3. You can set a takeprofit in the calculation of Stoploss / 2 or Stoploss / 3.
  4. The larger the takeprofit, the longer the holding time of the position. You can miss the profit position if it does not achieve the goal of the takeprofit.
  5. The smaller the takeprofit, the sooner the profitable signals will be closed.
  6. It makes no sense to use a small takeprofit, 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; 

I do not recommend changing the parameters MaxLot and RiskRate! It makes no sense to optimize.

Lots parameter – adjusts the volume of the position.

Optimization of values: It 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 the 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 use 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(Pips) (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 – adjust 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 the optimization of the remaining parameters of the strategy.
  2. It allows you to increase the lot when making a profit in a geometric progression.
  3. It can affect the final profit.
  4. I do not recommend using values higher 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 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. If the value is less than 1, it makes sense to use it only when the Lot positions are higher 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 Expert Advisor (EA).
  6. Martingale is a very simple and dangerous strategy.
  7. I recommend checking and reading 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 are attempts 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 Expert Advisor (EA) 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. It 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(Pips), 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(Pips), 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. We use this method in our TickSniper Expert Advisor (EA).
  4. For example, The average spread for a currency pair = 3 Points(Pips), then the averaging Distance = 50 * 3 = 150 Points(Pips). 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 Expert advisor 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 open, the faster you can make a profit, but at the same time, your trading account will be heavily loaded!

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 if you need to increase the Distance at each new position from the series.
  2. If the 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. It allows you to reduce the time for a series of positions to go into profit.
  2. It can give the load to your trading account and Balance.
  3. It is recommended to use only 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 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 positions 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 openings of positions allow you to get more profit if the signal is very profitable.
  2. An additional position can get a loss and lower profits from the original 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 Trailing stop

Parameter StopLossALL – Modifies Stoploss of all positions by 1 level

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

  1. It serves as an additional opening of positions if you have switched off.
  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(Pips), 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(Pips), 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, The average SPREAD for a currency pair = 3 Points(Pips), then the averaging Distance = 50 * 3 = 150 Points(Pips). 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. It can give the load to your trading account and Balance.
  2. It is recommended to use only 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 breakeven.

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

Parameter MovingInWLUSE enables the installation of a 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(Pips) 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 Expert Advisor (EA) has set a breakeven. This is protection against a small loss, but YOU can miss the profit.
  4. The higher the difference between LevelProfit and LevelWLoss, the less sensitive the breakeven threshold is.

Block 12: Standard Trailing options

The unit of standard trailing stops.

 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 stoploss 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 market situation 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 stoploss 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(Pips) per day)

  1. The higher the value of TrailingStop, the more you need to go to the profit position so that the Expert Advisor (EA) 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

Trailingstop 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(Pips) of the indicator PARABOLIC. Only with TrailingStopSAR = true can other parameters be optimized!

Optimizing values: True – FALSE

  1. It allows you to set stoploss on the extremes of the indicator.
  2. Always keep 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 Expert Advisor (EA)

 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 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)

MetaTrader 5: Setting the optimization and saving the file “.SET

You can download our files for optimization for The X

To optimize an expert, you need to open Optimizer MT5 :

Select the mode Complete Optimization (new version of the MetaTrader 5 terminal)

After that, we have to adjust our Strategy Tester for optimization:

  1. Choosing an expert for optimization.
  2. Selecting the trading symbol (currency pair) that we want to get results.
  3. Timeframe (Our expert can optimize the TF of each indicator, so skip this step)
  4. Period optimization (can be optimized over the last year; it makes no sense to optimize for over 10 years!)
  5. Be sure to choose a model “Every Tick based on real ticks”!
  6. Choose the type of optimization = Exhaustive search parameters ( Slow complete optimization )
  7. Go into setting input parameters Inputs.

Load your file to optimize or configure the settings to your liking!

Click the right mouse button – Load (Load)

We choose the path where you saved our files and select the file with the number of digits in price from your broker (4-digit or 5-digit broker)

Configuring parameters optimized:

After loading, you will see our optimization options

  1. Check or uncheck those options that you want to optimize. (By default, I have set up the file so that you can optimize all the important parameters)
  2. Start (Start) – The initial value of the parameter to optimize.
  3. Step (Step) – a step change in the parameter at each run of the optimizer.
  4. Stop (Stop) – The final value of the parameter to optimize.
  5. Click Start to begin the optimization, which can take anywhere from 1 hour to 1 week. You can also use the cloud to optimize parametrs!
  1. Remember! The more parameters and steps to optimize, the more time is needed to complete the testing and optimization!
  2. Value (Value) – This is a fixed value. The Expert advisor will take this value if this parameter is not optimized. Or testing!

Selection results and save the file “.Set”

After we receive the results of the optimization, we can choose the options you want and save the file Set to use them in the future.

  1. Go to the tab of optimization (Optimization results)
  2. Choose the desired result
  3. Run a single test
  4. Look at the result:

After that, go to the Settings tab 1 ( Inputs ) and save the SET FILE 2 (Click the right mouse button)

Save the settings file where you store all your important files!

Loading configuration file (Set File) in our expert on real chart:

Once you’ve found your settings and the result of the optimization is large enough, you can download an expert with these settings for the job.

Remember! Optimization is a coarse setting method of search and optimization results can not guarantee future profitability in real time!

I recommend to check the system first on a demo account with your broker these settings.

After that, you can open a cent account or a small deposit for verification.

It was only after extensive testing, you can trade on large deposits!

  1. Download our expert on the chart.
  2. Go to the tab Settings (Inputs).
  3. Click LOAD (Load).
  4. Open the folder where your files are saved in settings.
  5. Select a file and click Open.

If you did everything correctly, then the graph will show our panel EAPADPRO with a green smiley!

If you have something not installed or installed incorrectly, you can read the options refusal to trade Expert Adviser (EA): EAPADPRO Do Advisor work?

MetaTrader 4: Setting the optimization and saving the file SET

You can download our files for optimization for The X

Note: Terminal Strategy Tester of MetaTrader 4 is not accurate and does not include floating spread and delay performance, so its results are exemplary!

To optimize an expert, you need to open Optimizer MT4

After that, we have to adjust our Strategy Tester for optimization:

  1. Choosing an expert for optimization.
  2. Selecting the trading symbol (currency pair) that we want to get results.
  3. Be sure to choose a model “Every Tick”!
  4. Period optimization (can be optimized over the last year; it makes no sense to optimize for over 10 years!)
  5. Timeframe (Our expert can optimize the TF of each indicator, so skip this step)
  6. Set the tick on Optimization ( Optimization )
  7. Go into setting input parameters Inputs.

Load your file to optimize or configure the settings to your liking!

Click the right mouse button – Load (Load)

We choose the path where you saved our files and select the file with the number of digits in price from your broker (4-digit or 5-digit broker)

Configuring parameters optimized:

After loading, you will see our optimization options

  1. Check or uncheck those options that you want to optimize. (By default, I have set up the file so that you can optimize all the important parameters)
  2. Start (Start) – The initial value of the parameter to optimize.
  3. Step ( Step) – a step change in the parameter at each run of the optimizer.
  4. Stop (Stop) – The final value of the parameter to optimize.
  5. Click Start to begin the optimization, which can take anywhere from 1 hour to 1 week. You can also use the cloud to optimize parametrs!
  1. Remember! The more parameters and steps to optimize, the more time is needed to complete the testing and optimization!
  2. Value (Value) – This is a fixed value. The Expert advisor will take this value if this parameter is not optimized. Or testing!

Selection results and save the file “.Set”

After we receive the results of the optimization, we can choose the options you want and save the file Set to use them in the future.

  1. Go to the tab of optimization (Optimization results)
  2. Choose the desired result
  3. Apply settings for testing.

Run a single test:

  1. Look at the result:

After that, go to the Settings tab ( Inputs ) and save the SET FILE

Save the settings file where you store all your important files!

Loading configuration file (Set File) in our expert on real chart:

Once you’ve found your settings and the result of the optimization is large enough, you can download an expert with these settings for the job.

Remember! Optimization is a coarse setting method of search and optimization results can not guarantee future profitability in real time!

I recommend to check the system first on a demo account with your broker these settings.

After that, you can open a cent account or a small deposit for verification.

It was only after extensive testing, you can trade on large deposits!

  1. Install our expert on the chart.
  2. Go to the tab Settings (Inputs).
  3. Click LOAD (Load).
  4. Open the folder where your files are saved settings.
  5. Select a file and click Open.

If you did everything correctly, then the graph will show our panel EAPADPRO with a green smiley!

If you have something not installed or installed incorrectly, you can read the options refusal to trade Expert Adviser (EA): EAPADPRO Do Advisor work?

Optimization results

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

It’s long enough, but you’ll get the results of all the passes.

We spent about $6 on optimization for more than 20,000 passes. 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 finished, 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 ones and that you can trade:

Customize the optimization by symbols:

Run the optimization and get the results:

These actions allow you to search for universal Expert Advisors (EA) parameters for use on any currency pair.

The results of optimization for currency pairs show that this set of settings gives a good result in only four currencies out of 11!

In our Expert Advisors (EA) for MT5, there is the possibility of working simultaneously with 10 or more currency pairs and the same settings.

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 Expert Adviser (EA), who simultaneously trades on 10 currency pairs.

To do this, use the following options:

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

These parameters should be written as symbol names are written in your broker. e.g., 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 to make a profit when trading simultaneously on 11 currency pairs!!!

OnTester Additional criteria for optimization selection of the best results

In the new versions of the terminal, it became possible to select the best optimization results based on user criteria!

For example, You can set the Minimum number of trades to be obtained as a result of optimization.

All other passes in which there are fewer trades than specified in the settings will have a result of 0, and they can be filtered!

General information:

The function is called immediately before the call to the OnDeinit () function and has a return type of double. The OnTester () function can be used only on Expert Advisors during testing and is intended primarily for calculating a certain value used as a Custom max criterion for the genetic optimization of input parameters.

In genetic optimization, results are sorted within one generation in descending order. That is, the best results from the optimization criterion’s Point of view are the results with the highest value (for the Custom max optimization criterion, the values ​​returned by the OnTester function are taken into account). In this sorting, the worst values ​​are placed at the end and subsequently discarded, and they do not take part in the formation of the next generation.

Optimization settings in MetaTrader 4

Configure the terminal for optimization and make sure to checkmark “Optimization.” 
After that, open the Expert Advisor settings and configure the fields for optimization:

Start – The start value of the parameter that you want to optimize. 
Step – The step of changing the value of the parameter that you want to optimize. 
Stop – The final value of the parameter that you want to optimize. 
Be sure to checkmark the parameter that you are going to optimize. 

For example:

This means that we want the StopLoss and TakeProfit to be tested from the initial value of 100 Points(Pips), with a step of 100 (100, 200, 300, 400 ….) and a value of 600 
In total, the optimizer must pass 6 * 6 passes = 36 results. 

You can see the optimization results in the “Optimization Results” tab.

After optimization, you can look at the 3D optimization chart:

If you want to get a report on the tested values ​​and the result of optimization, you need to select the right results with the right button and press the “Set Inputs Parameter” button; after that, you can click the “START” button again and get the full test report. 

To save the settings you have tested, open the parameters of the Expert Advisor (EA) in the strategy tester and click the “SAVE” button.


You can download these settings to your Expert Advisor on a real chart. 

As a result, you can see that all optimization passes that do not meet the conditions of the set parameters will have a result of 0!

And all other test results will have the result specified in the OnTester_Custom_max () parameter

Setting up optimization in MetaTrader 5

To start working in the custom optimization mode, you need to configure your terminal.

Set Optimization Mode ( Optimized Parameter ) to CUSTOM

Set the desired custom criteria for genetic optimization:

As a result of this function, you can sort the result by the column OnTester result.

As a result, you can see that all optimization passes that do not meet the conditions of the set parameters will have a result of 0!

And all other test results will have the result specified in the OnTester_Custom_max () parameter

Options for calling OnTester_Custom_max:

The first parameter is the general formula for getting the result of the optimizer run!

By default: (Profit * Number of Trades) / Percentage of drawdown of available funds

OnTester_Custom_maxYour own criterion for genetic
optimization.
More information about the test results: Statistics
Recording in the form of a formula.For example :OnTester_Custom_max = “STAT_PROFIT * STAT_TRADES / STAT_EQUITY_DD”
Be sure to specify the names of variables, as in the reference!

Options for calling OnTester _ ****:

OnTester_Min_TradesMin Deals for optimizationMinimum Balance (in the deposit currency), which will be at the end of testing, for a successful optimization result.
For example, 1000 (Same as the initial deposit) = If the Balance in this run of the optimizer is less than the Initial deposit, then this result will be equal to 0
OnTester_Min_ProfitMin Profit for optimizationMinimum free funds (in the deposit currency), which will be at the end of testing, for a successful optimization result.
For example, 500 = If Equity in this run of the optimizer is less than 500 (in the deposit currency), then this result will be equal to 0
OnTester_Min_ProfitFactorMy ProfitFactor for optimizationMinimum Balance (in the deposit currency), which will be at the end of testing, for a successful optimization result.
For example, 1000 (Same as the initial deposit) = If the Balance in this run of the optimizer is less than the Initial deposit, then this result will be equal to 0
OnTester_Min_BalanceMin Balance for optimizationMinimum Balance (in the deposit currency), which will be at the end of testing, for a successful optimization result.
For example, 1000 (Same as the initial deposit) = If the Balance in this run of the optimizer is less than the Initial deposit, then this result will be equal to 0
OnTester_Min_EquityMin Equity for optimizationThe minimum number of trades opened by the Expert Advisor (EA) for a successful optimization result.
For example, 50 = If the number of trades in this run of the optimizer is less than 50, then this result will be 0
OnTester_Max_Balance_DDMax Balance DD % for optimizationMinimum Balance (in the deposit currency), which will be at the end of testing, for a successful optimization result.
For example, 1000 (Same as the initial deposit) = If the Balance in this run of the optimizer is less than the Initial deposit, then this result will be equal to 0
OnTester_Max_Equity_DDMax Equity DD %for optimizationMinimum Balance (in the deposit currency), which will be at the end of testing, for a successful optimization result.
For example 1000 (Same as the initial deposit) = If the Balance in this run of the optimizer is less than the Initial deposit, then this result will be equal to 0

Conclusions

Optimization and testing of Expert Advisors (EA) is quite a permanent occupation.

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

It would be best if you understood that Forex is not easy. Every EA is just an algorithm built into 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 Expert Advisor (EA), study the log and the log files, and be attentive to the Expert Advisor (EA)!
  4. Adjust the parameters of the Expert Advisors (EA) depending on the news.

Learn the materials on Forex trading.

Questions?

If you have any questions, please ask them. We do not sell the pig in a poke.

And each of our products can be checked before the purchase.

We appreciate your attitude and wishes for our products and try to keep the quality standard high.

Thank you for being with us!

Do you have a question?

Leave a Reply

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


    This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.
    Read more