EVT - Events
Without a doubt, staying updated with the latest news is crucial when trading based on market analysis. Regularly released economic indicators often significantly impact various charts. For example, the US unemployment rate frequently affects the EURUSD exchange rate, particularly when the actual results do not align with forecasts.
MetaTrader 5 includes a built-in economic news calendar that informs you about various news events. The image below provides a typical representation of the calendar output in a MetaTrader 5 trading platform.
Until recently, MetaTrader 4 lacked this feature. However, the Expert Advisor Builder now utilizes a proprietary news API, making news events accessible for automated trading, irrespective of whether you're using the MetaTrader 4 or MetaTrader 5 trading platform. You can generate trading modules that automatically open trades based on signals generated by news events.
Concept diagram
The concept diagram provided below depicts the function block associated with this page.
Enabling of signal
By default, the signal generation of this module is inactive. This implies that none of the input parameters associated with the EVT input group will be used when the > (EVT) Signal in use is set to OFF.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Signal in use (IN_enmEvtSignalInUse) | OFF | Numeric values usable in SET files: 0 - OFF 1 - ON |
Once the functional block is activated, you'll notice that vertical lines with the event names visualize the events. Please refer to the subsequent series of examples to understand the effect of this input parameter.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_3_v_2_0.zip.
Signal visualization
The events module provides a feature that visualizes generated signals using high-contrast blue vertical lines. As depicted in the subsequent charts, the events module, by default, draws a vertical red line with an accompanying caption for each event.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Signal visualization (IN_enmEvtSignalVisualization) | OFF | Numeric values usable in SET files: 0 - OFF 1 - ON |
As you'll learn further in this document, the occurrence of an event does not necessarily equate to the actual trading signal. A period can be configured before and after the actual event, during which the signal output is already processed as positive. For instance, if an event occurs at 10:00:00, you can use the > (EVT) Pre signal time and > (EVT) Post signal time settings to define a time range before and after the actual event. This range will also be interpreted as a period with positive signals, for example, from 09:30 to 10:30. To see the signal output of the entire events module, you can utilize the > (EVT) Signal visualization input parameters. The effect of this input is demonstrated in the example charts below.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_4_v_2_0.zip.
Draw events table and event lines in chart
The event module can visualize the received news data in two distinct ways: as a table embedded within your chart or as event lines on the chart. To toggle these visualization options, please refer to the input parameters below.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Draw table (IN_enmEvtDrawTable) | OFF | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Draw chart (IN_enmEvtDrawChart) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
The news data table, enabled with > (EVT) Draw table, displays the filtered news data in a compact in-chart table, as depicted in the illustration below. Notably, only the events that result in a trading signal are listed as upcoming events.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_5_v_2_0.zip.
A subtler form of event visualization is the in-chart event lines. These lines indicate an event shortly before it occurs and label it. Please use the input parameters > (EVT) Draw chart to enable this feature. As shown in the table above, this option is enabled by default.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_6_v_2_0.zip.
Cache for drawed event lines
As discussed in the previous section, the events module can visually represent each occurring event with a vertical red line. The number of vertical lines drawn can be defined using the input parameters > (EVT) Draw keep in cache.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Draw keep in cache (IN_nEvtDrawKeepInCache) | 20 | The input value cannot be smaller or equal to 0. |
The larger this input parameter is, the more previous event lines will be displayed on your chart. By default, only the 20 most recent event lines are illustrated. However, there is no upper limit. The following example effectively demonstrates the effect of this input parameter.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_7_v_2_0.zip.
Signal negation
Typically, a news event initiates the opening of a trade. However, for many trading strategies, avoiding certain events is beneficial. For instance, Federal Reserve (FED) releases can significantly impact the price, and these spike-like price changes often confuse conservative indicators and oscillators based trading strategies. As such, you can negate the signals generated by the events module to allow trading only when no recent or upcoming events are expected. Please use the input parameter > (EVT) Signal negation to enable this feature.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Signal negation (IN_enmEvtSignalNegation) | OFF | Numeric values usable in SET files: 0 - OFF 1 - ON |
With the aid of the input parameter > (EVT) Signal visualization, in conjunction with > (EVT) Pre signal time and > (EVT) Post signal time, the following chart illustrates two events and their resulting trading signals. In the example chart a), a positive trading signal is evaluated when an event occurs. Conversely, in example chart b), a positive signal is considered when no event occurs. The second chart effectively demonstrates how to use the events module as a filter to avoid certain news events.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_8_v_2_0.zip.
Signal shift
The input parameter > (EVT) Shift in sec allows you to adjust the timing of all news events by a specified number of seconds, either positively or negatively. All news events received from the news API, including historical events, are preconfigured for UTC+2. However, as not all brokers operate in the same time zone, this input parameter helps align the entire news module with your trading server's time zone.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Shift in sec (IN_nEvtShiftInSec) | 0 | Default time zone of all news data is UTC+2. |
The following example series demonstrates that positive values for this input parameter can result in earlier signal indications, while negative values can delay them.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_9_v_2_0.zip.
Pre and post signal time
The input parameters > (EVT) Pre signal time and > (EVT) Post signal time allow you to establish a time range before and after each event, during which the signal is evaluated as true, either in anticipation of or following the actual event. These parameters can enable the activation of a trading module before the occurrence of the actual event.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Pre signal time (IN_nEvtPreSignalTime) | 1800 | The input value is processed as a duration, measured in seconds. |
> (EVT) Post signal time (IN_nEvtPostSignalTime) | 1800 | The input value is processed as a duration, measured in seconds. |
As demonstrated in the example series below, these input parameters extend the duration of positive trading signals, both preceding and succeeding the actual event.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_10_v_2_0.zip.
Events filtered by region
In many scenarios, only a few regional events are relevant to your trading strategy. Consequently, you can use the toggle switches below to turn specific regions on or off.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Region ALL (IN_enmEvtRegionAll) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region AUD (IN_enmEvtRegionAud) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region BRL (IN_enmEvtRegionBrl) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region CAD (IN_enmEvtRegionCad) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region CHF (IN_enmEvtRegionChf) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region CNY (IN_enmEvtRegionCny) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region EUR (IN_enmEvtRegionEur) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region GBP (IN_enmEvtRegionGbp) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region HKD (IN_enmEvtRegionHkd) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region INR (IN_enmEvtRegionInr) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region JPY (IN_enmEvtRegionJpy) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region KRW (IN_enmEvtRegionKrw) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region MXN (IN_enmEvtRegionMxn) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region NOK (IN_enmEvtRegionNok) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region NZD (IN_enmEvtRegionNzd) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region SEK (IN_enmEvtRegionSek) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region SGD (IN_enmEvtRegionSgd) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region USD (IN_enmEvtRegionUsd) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Region ZAR (IN_enmEvtRegionZar) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
The subsequent illustration demonstrates how to deactivate all USD and EUR events. As evident in the in-chart table, this action results in the filtering out all USD and EUR events. Adjusting these settings to align with your market preferences is strongly recommended.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_11_v_2_0.zip.
Events filtered by importance
As displayed by the in-chart table, most events are accompanied by an indication of their importance. Please remember that this indicator is an estimate, not a certainty. The following list comprises all input parameters used to filter for specific values.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Importance undefined (IN_enmEvtImportanceUndefined) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Importance low (IN_enmEvtImportanceLow) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Importance moderate (IN_enmEvtImportanceModerate) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Importance high (IN_enmEvtImportanceHigh) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
The following illustration shows how to filter for specific importance using the input parameters in the table above.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_12_v_2_0.zip.
Events filtered by impact
Another valuable piece of meta-information to consider is the expected impact of an event. You can filter based on the desired effect using the input parameters below. This is especially useful when deciding whether an event should trigger a short or long trade. The impact information is an estimate derived from previous and forecasted values. Please treat this information as an estimation, not a fact, as future events cannot be predicted completely.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Impact undefined (IN_enmEvtImpactUndefined) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Impact positive (IN_enmEvtImpactPositive) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
> (EVT) Impact negative (IN_enmEvtImpactNegative) | ON | Numeric values usable in SET files: 0 - OFF 1 - ON |
As is customary in this user manual, examples of using these input parameters can be found in the illustration below.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_13_v_2_0.zip.
Events filtered by name
The input parameters provided below allow you to filter events by their names. You have the option to select between Exclude and Exclusive filter modes. The Exclude mode ensures that any event containing the value from the corresponding input field is omitted from the news event list. On the other hand, the Exclusive mode filters for only those events that include the input text. For instance, if you want to use ECB news events for your trading module exclusively, set Filter type 1 to Exclusive and enter ECB in the Filter text 1 input field. Altogether, three filter modes are available as selection, while OFF turns off the filter.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Title 1 filter type (IN_enmEvtTitle1FilterType) | OFF | Numeric values usable in SET files: 0 - OFF 1 - EXCLUDE 2 - EXCLUSIVE |
> (EVT) Title 1 filter string (max 63 characters) (IN_strEvtTitle1FilterString) | The input value has to have less than 63 characters. | |
> (EVT) Title 2 filter type (IN_enmEvtTitle2FilterType) | OFF | Numeric values usable in SET files: 0 - OFF 1 - EXCLUDE 2 - EXCLUSIVE |
> (EVT) Title 2 filter string (max 63 characters) (IN_strEvtTitle2FilterString) | The input value has to have less than 63 characters. | |
> (EVT) Title 3 filter type (IN_enmEvtTitle3FilterType) | OFF | Numeric values usable in SET files: 0 - OFF 1 - EXCLUDE 2 - EXCLUSIVE |
> (EVT) Title 3 filter string (max 63 characters) (IN_strEvtTitle3FilterString) | The input value has to have less than 63 characters. | |
> (EVT) Title 4 filter type (IN_enmEvtTitle4FilterType) | OFF | Numeric values usable in SET files: 0 - OFF 1 - EXCLUDE 2 - EXCLUSIVE |
> (EVT) Title 4 filter string (max 63 characters) (IN_strEvtTitle4FilterString) | The input value has to have less than 63 characters. |
Refer to the following example to understand how to filter for ECB or Fed events exclusively or specifically avoid these text snippets.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_14_v_2_0.zip.
Events filtered by actual, forecast, and previous value
The table below lists the input parameters that you can use to specify the minimum and maximum values for the actual, forecast, and previous values that constitute a positive trading signal. By default, each filter is deactivated, indicated by a configuration of 0. For simplicity, the actual, forecast, and previous values are unitless numbers that sometimes correspond to an absolute or relative value. Please refer to the MetaTrader 5 calendar to understand each news value in detail.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Actual min (0 -> OFF) (IN_lEvtActualMin) | 0 | The input is processed as a number without any associated units. |
> (EVT) Actual max (0 -> OFF) (IN_lEvtActualMax) | 0 | The input is processed as a number without any associated units. |
> (EVT) Forecast min (0 -> OFF) (IN_lEvtForecastMin) | 0 | The input is processed as a number without any associated units. |
> (EVT) Forecast max (0 -> OFF) (IN_lEvtForecastMax) | 0 | The input is processed as a number without any associated units. |
> (EVT) Previous min (0 -> OFF) (IN_lEvtPreviousMin) | 0 | The input is processed as a number without any associated units. |
> (EVT) Previous max (0 -> OFF) (IN_lEvtPreviousMax) | 0 | The input is processed as a number without any associated units. |
The examples provided below illustrate how to utilize these input parameters. As can be seen, only news events with a maximum of 5.000.000 as actual value are left over in example table b).
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_15_v_2_0.zip.
Events filtered by actual, forecast, and previous relation
The relational input parameters enable to filter for relationships between the actual, forecast, and previous values. For example, selecting ACTUAL GREATER PREVIOUS will generate signals only from news events with the economic indicator's value rising. This filter doesn't necessitate knowledge of absolute numbers, making it easily applicable to all event types.
Input variable within MetaTrader (Identifier in SET file) | Default value | Comment |
---|---|---|
> (EVT) Relation condition 1 (IN_enmEvtRelationCondition1) | OFF | Numeric values usable in SET files: 0 - OFF 1 - ACTUAL GREATER FORECAST 2 - ACTUAL GREATER PREVIOUS 3 - ACTUAL SMALLER FORECAST 4 - ACTUAL SMALLER PREVIOUS 5 - FORECAST GREATER PREVIOUS 6 - FORECAST SMALLER PREVIOUS |
> (EVT) Relation condition 2 (IN_enmEvtRelationCondition2) | OFF | Numeric values usable in SET files: 0 - OFF 1 - ACTUAL GREATER FORECAST 2 - ACTUAL GREATER PREVIOUS 3 - ACTUAL SMALLER FORECAST 4 - ACTUAL SMALLER PREVIOUS 5 - FORECAST GREATER PREVIOUS 6 - FORECAST SMALLER PREVIOUS |
> (EVT) Relation condition 3 (IN_enmEvtRelationCondition3) | OFF | Numeric values usable in SET files: 0 - OFF 1 - ACTUAL GREATER FORECAST 2 - ACTUAL GREATER PREVIOUS 3 - ACTUAL SMALLER FORECAST 4 - ACTUAL SMALLER PREVIOUS 5 - FORECAST GREATER PREVIOUS 6 - FORECAST SMALLER PREVIOUS |
Please consult the examples below to comprehend the effect of these input parameters.
To reproduce the chart from above, you can download and use the SET file package um_eab_cevt_16_v_2_0.zip.