Skip to main content
Version: 2.0

No.39: Oscillators - Four oscillator lines combined

Description

You can find an example for the Expert Advisor Builder on this page. If you need to familiarize yourself with the MetaTrader strategy tester and the Expert Advisor Builder, please begin with the Getting Started article.

This example demonstrates the process of signal generation using oscillators. Oscillators are tools often used to simplify a price chart, making the information more accessible for human interpretation or automated processing. Unlike indicators, an oscillator typically swings around a specific value, while indicator values are mainly on a similar level as the price. This characteristic makes oscillators very useful as a tool for simplification, which is symbol-independent.

By combining oscillator values, signal generation is realized, as depicted in the chart on this page. Here, the MACD trading system used in example no 37 is integrated with a Price Profile oscillator. The Price Profile oscillator is a complex algorithm that can be used to detect support and resistance levels and consolidation phases. The price profile oscillator is evaluated so that the filter condition is considered valid only when the price is between a support and resistance level. As is typical with many examples for the Expert Advisor Builder, only one trade is allowed to be open at a time, which implies that some signals may be missed.

Please note that this is not a plug-and-play trading strategy. A trading strategy needs suitable adjustments, fine-tuning to the timeframe and symbol, and thorough backward and forward testing. Therefore, providing fully working trading strategies as read-to-use examples is impossible. However, this example could serve as a foundation for your trading strategy.

Reset of inputs

Locate the Expert Advisor Builder application in the dropdown menu of the strategy tester settings under FEA Trading\MT4\Expert Advisor Builder 2.0 if you're using a MetaTrader 4 instance or FEA Trading\MT5\Expert Advisor Builder 2.0 if you're using a MetaTrader 5 instance. You can replicate the entire example in minutes by following the steps outlined in this article. To begin, kindly reset the strategy tester input as indicated.

Reset of MetaTrader strategy tester inputs.png

The default input parameters of the Expert Advisor Builder are designed to be highly functional. This implies that only some parameters must be adjusted when creating a new strategy. As a result, even with minimal reconfiguration, the output strategy can be significantly different.

Inputs configuration

Most examples can be executed in any timeframe and on any symbol. However, please set EURUSD as the symbol to be tested, M15 as the timeframe, select Open prices only (MT4) or 1 minute OHLC (MT5) as the model, and the previous four weeks as the test period. Finally, enable the visual testing mode.

Refer to the table below to set up the input parameters for the Expert Advisor Builder.

Input variable within MetaTrader
(Identifier in SET file)
Example valueUser manual chapters
> (OUF) Idea output description (max 63 characters)
(IN_strOufIdeaOutputDescription)
No.39: Oscillators - Four oscillator lines combinedOutput Folder
> (OSA) CONF, Signal in use
(IN_enmOsaSignalInUse)
ONConfiguration
Available Oscillators and Default Values
Example
> (OSA) COND, Relation 1 OSA1 to OSA2
(IN_enmOsaRelation1)
ANGLE 1 GREATER ANGLE 2
> (OSA1) CONF, Signal in use
(IN_enmOsa1SignalInUse)
ON
> (OSA1) COND, Angle limit condition
(IN_enmOsa1AngleCondition)
GREATER LIMIT 1
> (OSA1) COND, Value limit condition
(IN_enmOsa1ValueCondition)
SMALLER LIMIT 1
> (OSA2) CONF, Signal in use
(IN_enmOsa2SignalInUse)
ON
> (OSA2) COND, Angle limit condition
(IN_enmOsa2AngleCondition)
GREATER LIMIT 1
> (OSA2) COND, Value limit condition
(IN_enmOsa2ValueCondition)
SMALLER LIMIT 1
> (OSB) CONF, Signal in use
(IN_enmOsbSignalInUse)
ON
> (OSB) COND, Relation 1 OSB1 to OSB2
(IN_enmOsbRelation1)
VALUE 1 SMALLER VALUE 2
> (OSB1) CONF, Signal in use
(IN_enmOsb1SignalInUse)
ON
> (OSB1) CONF, Selection
(IN_enmOsb1Selection)
PPR - Price Profile
> (OSB1) CONF, Parameter 1
(IN_dOsb1Parameter1)
6000
> (OSB1) CONF, Parameter 2
(IN_dOsb1Parameter2)
40
> (OSB1) CONF, Parameter 3
(IN_dOsb1Parameter3)
1
> (OSB1) COND, Value limit condition
(IN_enmOsb1ValueCondition)
SMALLER LIMIT 1
> (OSB1) COND, Value limit 1
(IN_dOsb1ValueLimit1)
40.0
> (OSB2) CONF, Signal in use
(IN_enmOsb2SignalInUse)
ON
> (OSB2) CONF, Selection
(IN_enmOsb2Selection)
PPR - Price Profile
> (OSB2) CONF, Line index
(IN_nOsb2LineIndex)
1
> (OSB2) CONF, Parameter 1
(IN_dOsb2Parameter1)
6000
> (OSB2) CONF, Parameter 2
(IN_dOsb2Parameter2)
40
> (OSB2) CONF, Parameter 3
(IN_dOsb2Parameter3)
1
> (OSB2) COND, Value limit condition
(IN_enmOsb2ValueCondition)
BETWEEN LIMIT 1 AND LIMIT 2
> (OSB2) COND, Value limit 1
(IN_dOsb2ValueLimit1)
20.0
> (OSB2) COND, Value limit 2
(IN_dOsb2ValueLimit2)
80.0

Confirm the inputs by pressing OK, and finally, start the test run with Start.

Chart example and SET file download

The underlying algorithm is highly optimized for execution speed. Generally, it only takes a few minutes until the entire test period is simulated. At the end, you will see a chart similar to the following.

Expert advisor builder example chart 0, Oscillators - Four oscillator lines combined.png
tip

To reproduce the chart from this example, you can download and use the SET file package eab_example_39_v_2_0.set.