Setup — Expert Optimization — Auto Trading — MetaTrader 4 Help


Optimization represents consecutive passes of the same expert with different inputs on the same data. At that, such parameters can be taken that make the expert efficiency maximal. The terminal possesses in-built means that allow to automate this process. Before beginning to optimize expert parameters, one has to set them up. It means that one has to:

A special window named «Tester» is used for testing and optimization of experts in the terminal. All settings listed above can be made in the «Settings» tab of this window.

Expert Advisor and Its Parameters #

One has to select expert the parameters of which should be optimized in the «Tester – Experts» window. Not any expert file can be selected in this field, but only those that are available in the client terminal. For this, they must be compiled and placed in the /EXPERTS folder.

After the expert has been selected, one has to make an additional setup and set the inputs. This can be done by pressing of the «Expert properties» button.

At that, a new window containing the following three tabs will appear:


General optimization parameters are set in this tab. They include the initial deposit volume and currency to be specified in the corresponding fields. It is this deposit that will be operated by the expert during optimization.

Types of positions to be opened are selected in this tab, as well: Only Long, Only Short, or Long and Short. Whatever expert algorithm is used, it will open positions only in the directions defined here.

One can turn on the genetic algorithm of optimization here. Detailed information about it is available in «Genetic algorithms: Mathematics» article.

An optimized parameter is a certain factor, whose value defines the quality of a tested set of parameters. The higher the value of the optimization criterion is, the better the testing result with the given set of parameters is considered to be. The following parameter are available for optimization:

  • Balance – the highest value of the balance;
  • Profit Factor – the highest value of the profit factor;
  • Expected Payoff – the highest value of the expected payoff;
  • Maximal Drawdown – the lowest value of the maximal drawdown;
  • Drawdown Percent – the lowest value of the relative drawdown (in percentage terms);
  • Custom – the optimization criterion here is the value of the OnTester() function in the Expert Advisor. This parameter allows using any custom value for the optimization of the Expert Advisor.


All inputs are listed here as a table. Inputs are variables that influence the expert operation and can be changed directly from the client terminal. For these parameters to be changed, there is no need to change the expert code. The amount of inputs can vary depending of experts.

At optimization, the expert inputs are set in the fields of «Start», «Step», and «Stop». Initial values, change interval, and final values of external variables will be set in these fields, respectively. There are checkboxes to the left of variable names that include the parameter into optimization process. If a variable is not checked in this checkbox, it will not be involved into optimization. Its value will not be changed within the optimization process, and the parameter given in the «Value» field will be written here. The amount of expert passes depends on these parameters directly. Data written in the «Value» field do not influence the expert optimization and are necessary only for its testing.

The set of inputs already saved before (including those given in the fields of «Start», «Step», and «Stop») can be downloaded. This can be done by pressing of the «Load» button and having selected the preliminarily saved set of parameters. The current set of external variables can be saved by pressing of the corresponding button.


Optimization – this tab allows to manage limitations during optimization. If any of conditions is met during a separate pass, this pass of the expert will be interrupted. Optimization will continue with the next pass.

To enable a limit in condition, one has to flag it in the checkbox to the left of it. Double click with the left mouse button in the «Value» field can be used to change the existing parameter; after typing new value, press «Enter». Limiting parameters are:

  • Balance minimum – the smallest balance value in the deposit currency;
  • Profit maximum – the largest profit in the deposit currency;
  • Minimal margin level % – the lowest margin level in per cents;
  • Maximal drawdown % – the largest drawdown in per cents;
  • Consecutive loss – the largest loss within a series. Loss series is a number of consecutive loss trades;
  • Consecutive loss trades – the largest amount of loss trades within a series;
  • Consecutive win – the largest total profit within a series. Profitable series is a number of consecutive profitable trades;
  • Consecutive win trades – the largest amount of profitable trades within a series.

Symbol and Its Period #

It is not enough just to select an expert and set it up to start optimization: a symbol and its period (timeframe) must be selected for tests. These are the data on which all tests will be made. A symbol available in the terminal or an external data file can be used for tests. History data files in *.FXT format to be stored in the /TESTER directory are used in tests. These files are created at tests automatically if the corresponding symbol available in the terminal was selected.

Symbol is defined in the «Symbol» field, and timeframe is in the «Period». If there is no data file for this symbol, period, and modeling method, it will be created automatically. If there are no history data for the symbol and period, the tester will download 512 latest history bars automatically.

Attention: If there are any data outside the latest 512 bars for a symbol, the data will be downloaded automatically up to the last available bar. This can cause sharp increase of incoming traffic.

Modeling methods #

History data are saved in the terminal only as bars and represent records appearing as TOHLCV (HST format). These data can be used for modeling of price changes at testing experts. In some cases, such information is not enough for testing. For example, for the daily timeframe, price changes within a bar can result in triggering of the expert. At the same time, no triggering can occur at testing. In other words, testing an expert based on only bars can be inaccurate and give a false idea about the expert efficiency.

Terminal allows to test experts by various methods of history data modeling. Using history data from smaller periods, it is possible to see price fluctuations within bars, i.e., price changes will be emulated more precisely. For example, when an expert is tested on one-hour data, price changes for a bar can be modeled on one-minute data. Thus, modeling brings history data near the real price fluctuations and makes expert testing more authentic.

One of three history data modeling methods can be chosen for testing:

  • Open prices only (fastest method to analyze the bar just completed)
    Some mechanical trading systems do not depend on properties of modeling within a bar, they trade on completed bars. The bar is completed if the next one has appeared. These are such experts for which this modeling method was developed.

    In this mode, the bar opening is modeled first (Open = High = Low = Close, Volume=1) what allows the expert to identify the completion of the preceding bar precisely. It is this incipient bar that is used to start testing the expert. At the next step, the fully completed current bar will be given, but no testing is performed on it!

  • Control points (based on the nearest less timeframe with fractal interpolation of 12 control points)
    The control points modeling method is intended for a crude estimate of experts efficiency that trade within the bar. The history data of the nearest less timeframe must be available to apply this method. In the most cases, the available data of the less timeframe do not completely cover the time range of the timeframe under test. If the data of the less timeframe are missing, the further bar development will be generated on close prices of 12 preceding bars. It means that the changes within the bar are the same as those of price within the last 12 periods. It is fractal interpolation.

    As soon as history data of the less timeframe appear, fractal interpolation will be applied to these new data. But there will be used not 12, but just 6 preceding bars. It means that really existing Open, High, Low, Close prices are reproduced, and two generated prices more. Values and locations of these two generated prices depend on that on 6 preceding bars.

  • Every tick (based on all available least timeframes with fractal interpolation of every tick)
    This is the most accurate method of modeling prices within a bar. Unlike that of «control points», this method uses for generation not only data of the nearest less timeframe, but also those of all available nearest timeframes. At that, if there are data of more than one period for the same timeframe at the same time, the data of the least timeframe will be used for modeling. Like in the preceding method, control points are generated by fractal interpolation. It is also used for modeling of price changes between control points. It is possible that several similar ticks are modeled one after another. In this case, the doubled quotes will be filtered out, and the volume of the last of them will be fixed.

    One has to consider the possible large amount of tick data modeled. This can influence the consumed resources of the operation system and testing speed.

    • it is not recommended to launch testing on every tick if there are no available less timeframes that completely cover the period under test, otherwise, the results will not be accurate;
    • modeling on control points is basically used at optimization of experts, and all ticks modeling is for a close testing.

The price history stored in the client terminal includes only Bid prices. On default, to model Ask prices, the strategy tester uses the current spread of a symbol at the beginning of testing. However a user can set a custom spread for optimization in the «Spread» field.

Time Range #

The range of dates allows to test experts not on all available data, but within a certain time space only. This can be useful if there is a need to test a certain part of history data. Date range can be used not only for expert testing, but also for modeling of the testing succession of bars (file of data modeled to be used for testing). It is often no need to model data of the entire history, especially for every-tick modeling where the amount of unused data can be very large. That is why, if data range was allowed to be set at the initial modeling of testing succession, bars that are beyond this range will not be modeled, but just transcribed into the output succession. The data will not be excluded from the succession in order the correct calculation of indicators on the entire received history to be possible. It must be noted that the first 100 bars will not be modeled either. This limitation does not depend on the date range defined.

To enable date range limitation, one has to flag «Use date» and specify the necessary values in the fields of «From» and «To». After all settings have been made, one can press the «Start» button and start testing. After testing has started, the approximate time of completing of this process can be viewed in the lower part of the window.

Analysis for Microsoft Excel Unable to Load/Use

I’m not able to use the Analysis for Microsoft Excel after some updates run in my laptop.

The message show in Load Behavior: Not loaded. A run time error occurred during the loading of the COM Add-in.

The error message appeared when try to add Analysis in the COM Add-in: The given assembly name or codebase was invalid (Exception from HRESULT: 0x80131047).

Question Info

Replies (9) 

Did this solve your problem?

Sorry this didn’t help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Here are my suggestions may help you:

1. You system version and Office version(go to Excel>select File>Account and take the screenshot of Product Information, do not click About Excel)

Did this solve your problem?

Sorry this didn’t help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Thanks for your reply.

I tried to use the online repairing and updated to latest version. issue still not resolve.

I’m going to get admin to help me uninstall and see how it goes.

Thanks & best regards,

Did this solve your problem?

Sorry this didn’t help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Did this solve your problem?

Sorry this didn’t help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

IT admin already helped me to uninstalled and re-installed the App (Analysis for Microsoft Excel), but issue still unable to resolve.

please see below screen shots as requested:

1. Office version

2. System version

3. Error message — This is the error prompt when I try to start the launcher

4. Error message — This is the error prompt when I try to tick «Analysis» in COM Add-ins

Hope I’ve provided all necessary information to you.

Thanks & best regards,

[PII is masked by George Jiang MSFT Support]

Did this solve your problem?

Sorry this didn’t help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.

Thanks for posting back. Sorry for my late reply.

According to the error message in the screenshot, I recommend you can follow the steps below to troubleshoot your issue:

1. Open registry editor and go to “HKEY_CURRENT_USERSoftwareMicrosoftOfficeExcelAddins” to check whether your add-in is installed correctly. By default, the value of LoadBehavior is “3”, with which the Analysis Add-in will be loaded when you launch Excel, if LoadBehavior value of your add-in is not “3”, you can try to change it to “3”. Open Excel to check whether the add-in works well.

2. Since the error message shows it is a vsto add-in, you could try to re-enable the add-in and check whether the add-in works well.

If you have any concerns, please feel free and come back to share with us. We are always willing to help you.

An Example of Developing a Spread Strategy for Moscow Exchange Futures

The MetaTrader 5 platform allows developing and testing trading robots that simultaneously trade multiple financial instruments. The built-in Strategy Tester automatically downloads required tick history from the broker’s server taking into account contract specifications, so the developer does not need to do that manually. This makes it possible to easily and reliably reproduce trading environment conditions, including even millisecond intervals between the arrival of ticks on different symbols. In this article we will demonstrate the development and testing of a spread strategy on two Moscow Exchange futures.

Negative Correlation of Assets: Si and RTS

Si-M.Y and RTS-M.Y futures are traded on Moscow Exchange. These futures types are tightly correlated. Here M.Y means contract expiration date:

  • M — the number of the month
  • Y — the last two digits of the year

Si is a futures contract on US dollar/Russian ruble exchange rate, RTS is a futures contract on the RTS index expressed in US dollars. The RTS index includes stocks of Russian companies, the prices of which are expressed in rubles, USD/RUR fluctuations also affect index fluctuations expressed in US dollars. Price charts show that when one asset grows, the second asset usually falls.

For a better visualization, we have drawn a standard deviation channel on these charts.

Calculating Linear Regression between Si and RTS

We can express correlation between the two assets using a linear regression equation Y(X)=A(X)+B. Let’s create a script CalcShowRegression_script.mq5, which takes two arrays of close prices, calculates coefficients and shows the distribution diagram with a regression line straight on the chart.

Regression coefficients are calculated using an ALGLIB function, and the values are drawn using graphic classes of the standard library.

Drawing an indicator of spread between Si and a synthetic sequence

We have received linear regression coefficients and can draw a synthetic chart of type Y(RTS) = A*RTS+B. Let us call the difference between the source asset and the synthetic sequence «a spread». This difference will vary at each bar from negative to positive values.

In order to visualize the spread, let us create the TwoSymbolsSpread_Ind.mql5 indicator that displays the histogram of spread on the last 500 bars. Positive values are drawn in blue, negative values are yellow.

The indicator updates and writes to the Experts journal linear regression coefficients when a new bar is opened. Moreover, it waits till the new candlestick opens on both instruments, including Si and RTS. This way the indicator ensures correctness and accuracy of calculations.

Creating a linear regression channel on the spread channel over the last 100 bars

The spread indicator shows that the difference between the Si futures and the synthetic symbol changes from time to time. In order to evaluate the current spread, let us create the SpreadRegression_Ind.mq5 indicator (spread with a linear regression on it) that draws a trend line on a spread chart. The line parameters are calculated using linear regression. Let us launch the two indicators on a chart for debugging.

The slope of the red trend line changes depending on the spread value on the last 100 bars. Now we have a minimum of required data and we can try to build a trading system.

Strategy #1: Linear regression slope change on a spread chart

Spread values in the TwoSymbolsSpread_Ind.mql5 indicator are calculated as the difference between Si and Y(RTS)=A*RTS + B. You can easily check it by running the indicator in the debugging mode (F5 key).

Let us create a simple Expert Advisor that would monitor change of slope of the linear regression attached to a spread chart. Line slope is the A coefficient in the equation: Y=A*X+B. If trend is positive on the spread chart, A>0. If trend is negative, A #include
//| Spread strategy type |
BUY_AND_SELL_ON_UP, // Buy 1-st, Sell 2-nd
SELL_AND_BUY_ON_UP, // Sell 1-st, Buy 2-nd
input int LR_length = 100 ; // Number of bars for a regression on spread
input int Spread_length = 500 ; // number of bars for spread calculation
input ENUM_TIMEFRAMES period = PERIOD_M5 ; // Time-frame
input string symbol1 = «Si-12.16» ; // The first symbol of the pair
input string symbol2 = «RTS-12.16» ; // The second symbol of the pair
input double profit_percent = 10 ; // Percent of profit to lock in
input SPREAD_STRATEGY strategy =SELL_AND_BUY_ON_UP; // Type of a spread strategy
//— Indicator handles
int ind_spreadLR,ind,ind_2_symbols;
//— A class for trading operations
CTrade trade;
//| Expert tick function |
void OnTick ()
//— The A coefficient of the linear regression slope on the spread chart Y(X)=A*X+B
static double Spread_A_prev= 0 ;
if (isNewBar())
PrintFormat ( «New bar %s opened at %s» , _Symbol , TimeToString ( TimeCurrent (), TIME_DATE | TIME_SECONDS ));
//— Wait for indicator data to refresh, because it works on two symbols
if ( BarsCalculated (ind_spreadLR)== Bars ( _Symbol , _Period ))
//— Get linear regression values on the spread chart for bars with indices 1 and 2 («yesterday» and «the day before yesterday»)
double LRvalues[];
double Spread_A_curr;
int copied= CopyBuffer (ind_spreadLR, 1 , 1 , 2 ,LRvalues);
if (copied!=- 1 )
//— Linear regression coefficient on the last completed («yesterday») bar
Spread_A_curr=LRvalues[ 1 ]-LRvalues[ 0 ];
//— If the linear regression slope has changed, the product of current and previous value is less than zero
if (Spread_A_curr*Spread_A_prev 0 )
PrintFormat ( «Slope of LR changed, Spread_A_curr=%.2f, Spread_A_prev=%.2f: %s» ,
Spread_A_curr,Spread_A_prev, TimeToString ( TimeCurrent (), TIME_SECONDS ));
//— If we have no open positions, enter the market with both symbols
if ( PositionsTotal ()== 0 )
DoTrades(Spread_A_curr-Spread_A_prev> 0 , strategy , symbol1 , 1 , symbol2 , 1 );
//— If there are open positions, reverse them
ReverseTrades( symbol1 , symbol2 );
//— LR slope has not changed, check the floating profit — isn’t it time to close?
double profit= AccountInfoDouble ( ACCOUNT_PROFIT );
double balance= AccountInfoDouble ( ACCOUNT_BALANCE );
if (profit/balance* 100 >= profit_percent )
//— Required floating profit level reached, take it
trade.PositionClose( symbol1 );
trade.PositionClose( symbol2 );
//— Remember trend direction to compare at the opening of a new bar

In order to eliminate the necessity to make assumptions on what to buy and what to sell when trend changes, let us add an external parameter that allows reversing trading rules:

Now we can start Expert Advisor testing and debugging.

Testing the trading Strategy #1

The visual testing mode suits best for debugging. Set the required data using the menu Tools-Settings-Debug:

  1. Symbol
  2. TimeFrame
  3. Testing interval
  4. Execution
  5. Deposit
  6. Tick Generation Mode

The recommended mode for exchange instruments is «Every tick based on real ticks«. In this case the EA will be tested using recorded history data, and final results will be very close to real trading conditions.

The MetaTrader 5 trade server automatically collects and stores all ticks received from an exchange and sends the whole tick history to the terminal upon the first request.

This debugging mode allows executing the testing process in the visual mode while checking the values of any variables where necessary using breakpoints. Indicators used in the robot will be automatically loaded to a chart, there is no need to attach them manually.

Once the EA code is debugged, we can optimize parameters.

Optimization of trading Strategy #1

The Strategy1_AngleChange_EA.mq5 Expert Advisor has several external parameters that can be configured by optimization (highlighted in yellow):

In this case we will only optimize profit_percent for two versions of the strategy, in order to understand whether there is a difference between them. In other words, we fix the value of the strategy parameter and optimize based on profit_percent from 0.2 to 3.0%, in order to see the overall picture for the two methods to trade line slope changes.

For the BUY_AND_SELL_ON_UP rule (buy the first asset, sell the second one), when the line slope changes from negative to positive, optimization does not show good results. In general, this market entry method does not look attractive, we get more losses during the two-month testing.

The SELL_AND_BUY_ON_UP rule (sell the first asset, buy the second one) gives better optimization result: 5 of 15 test runs show some profit.

Optimization was performed on history data from August 1 to September 30, 2016 (two months interval). In general, both trading variants do not look promising. Perhaps the problem is that the parameter that we used for entries, i.e. the trend line slope over the last 100 bars, is a lagging indicator. Let’s try to develop a second version of the strategy.

Strategy #2: Spread sign change on a completed bar

In the second strategy, we analyze change of spread sign. We will only analyze values of completed bars, i.e. we will check it at the opening of «today’s» bar. If spread on the «day before yesterday»‘s bar was negative, and it was positive on the «yesterday»‘s bar, we can assume that the spread has turned up. The code still provides for the possibility to trade spread change in any direction. We can change entry direction using the strategy parameter. Here is a block from the Strategy2_SpreadSignChange_EA.mq5 code:

First we debug the EA in the visual testing mode, and then run optimization by profit_percent , like we did for the first strategy. Results:

As you can see, the «sell first and buy second asset» rule applied to the second strategy also gives disappointing testing results. The «Buy first and sell the second asset» gives more losses in all test runs.

Let us try to create the third variant of the strategy.

Strategy #3: Spread sign change on the current bar and confirmation over N ticks

Two previous strategies only worked at bar opening, i.e. they only analyzed changes on fully completed bars. Now we will try to work inside the current bar. Let us analyze spread changes on every tick, and if the spread sign on the completed bar and that on the current bar differ, we should assume that the spread direction has changed.

Also, the spread sign change should be stable over the last N ticks, which will help filter false signals. We need to add the external parameter ticks_for_trade =10 into our Expert Advisor. If the spread sign is negative on the last 10 ticks, and it was positive on the previous bar, the EA should enter the market. Here is the OnTick() function of the Strategy3_SpreadSignOnTick_EA.mq5 Expert Advisor.

In this Expert Advisor we have added the ShowLastTicksComment() function which displays on the chart the values of last N ticks of both symbols once the signal appears. This allows us to visually test the strategy and monitor tick changes with a millisecond precision.

Now we start the same optimization options applied in the first two strategies, and receive the following results:

«Buying the first asset and selling the seconds one»

«Selling the first asset and buying the seconds one»

Results of such a simple optimization are not much improved.

Strategy 4: Spread reaches a preset percent value

Now let us create the fourth and the last strategy for spread trading. It will be as simple as the three previous strategies: a trade signal appears when spread value riches the specified percent of the first asset price — spread_delta . Tick handler OnInit() has changed slightly, here is how it looks like in Strategy4_SpreadDeltaPercent_EA.mq5.

Positions will also be closed when specified profit percent profit_percent =2 is reached. It is a fixed value this time. Start optimization using the spread_delta parameter in the range of 0.1 to 1%.

«Buying the first asset and selling the seconds one»

«Selling the first asset and buying the seconds one»

This time the first «Buy first and sell the second asset» rule looks much better than the second rule. You can further optimize using other parameters.

MetaTrader 5 — Trading strategy developing environment

In this article, we have considered 4 simple strategies for spread trading. Testing and optimization results produced by these strategies should not be used as a guide to action, because they were obtained in a limited interval and can be random to some extent. The original purpose of this article is to show how easy and convenient it is to test and debug trading ideas using MetaTrader 5.

The MetaTrader 5 tester provides the following convenient features for the developers of automated trading systems:

  • automatic download of tick history of all symbols used in the Expert Advisor
  • visual indicator and strategy debugging mode, which includes visualization of trades, trading history and Experts journal
  • automatic launch of all indicators used in the EA in the visual testing mode
  • testing strategies using real recorded history data and reproduction of real trading environment
  • multi-threaded optimization of parameters using a custom target function
  • use of thousands of testing agents for faster optimization
  • visualization of results of optimization in accordance with custom rules
  • testing strategies that trade multiple instruments with synchronization of ticks up to a millisecond
  • debugging strategies straight during the testing process — you can set breakpoints to check the values of required variables and run a step-by-step testing.

In this article, the Strategy Tester was used as a research tool to find the right direction. This was done as an optimization using one parameter, which allowed to make quick qualitative conclusions. You can add new rules, modify existing ones and run full EA optimization. To speed up calculations, use the MQL5 Cloud Network which is specially designed for the MetaTrader 5 platform.

Important notes on the Strategies

Normally when searching for symbols for spread calculation, price increment is used instead of absolute price values. It means Delta[i]=Close[i]-Close[i-1] is calculated instead of the Close[i] series.

For a balanced trading, you should select volume for each spread symbol. In this article, we only used a 1-lot volume for each symbol.

Current settings in Si and RTS contract specifications are used during testing. It is important to mention that:

  • the RTS-12.16 futures is based on the US dollar,
  • the price of the RTS-12.16 futures tick is set every day on Moscow Exchange
  • the tick value is equal to 0.2 of the indicative USD/RUB exchange rate.

Information on index calculation is available on MOEX site at Therefore, you should remember that the results of optimization in the Strategy Tester depend on the dollar rate at the time of testing. The article contains screenshots with optimization results as of October 25, 2016.

The code is written for execution under perfect performance conditions: it does not contain handling of order sending results, handling of errors connected with connection loss, and it does not take into account commission and slippage.

The futures liquidity and chart filling are improved by the end to contract expiration. The code does not contain an explicit handling of the situation, when quotes of one symbol are received, and whole bars are missed on the second symbol (no trading on the exchange for any reason). However, indicators used in the EA wait for synchronization of bars of both symbols to calculate the spread value, and write these events into journal.

The article does not contain analysis of statistics of spread deviation from average values, which is required for creating more reliable trading rules.

Market Depth analysis is not used, because the order book is not simulated in the MetaTrader 5 Strategy Tester.

Attention: Indicators used in this article dynamically recalculate linear regression coefficients for creating spread charts and the trend line. Therefore, by the end of testing, the appearance of charts and indicator values will differ from those displayed during the testing process.

Run the indicators or EAs attached below in the visual testing mode, to see the process in real time.

Programs used in the article:

No comments

Добавить комментарий

Your e-mail will not be published. All fields are required.