Skip to main content
Version: 2.0

Example with CA3 and CA4 combined

On this page, you can explore an example that utilizes the chart analyzer submodules CA3 and CA4. Please note that this example is intended solely for educational purposes and does not purport to be a ready-to-use trading strategy. A functional trading strategy always requires appropriate adjustments to the underlying symbol and timeframe. However, this example can be a foundation for building your trading strategy using the chart analyzer's signal generation. Each step in the example is accompanied by a chart displaying the resulting output and the necessary input parameters to replicate the example chart.

Concept diagram

The concept diagram provided below depicts the function block associated with this page.

Chart Analyzers, Example, Concept diagram.png

The table below lists all input parameters associated with the chart analyzer submodule CA3. While numerous parameters exist, only a few must be configured and understood for successful signal generation. Please refer to the relevant article in the user manual for a comprehensive guide on configuring a chart analyzer.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (CA3) CONF, Signal in use
(IN_enmCa3SignalInUse)
OFFThe configuration article explains the meaning and usage of each input parameter.
> (CA3) CONF, Signal visualization
(IN_enmCa3SignalVisualization)
OFF
> (CA3) CONF, Symbol
(IN_strCa3Symbol)
CURRENT
> (CA3) CONF, Exclusion (HH:MM:SS-HH:MM:SS)
(IN_strCa3Exclusion)
00:00:00-00:00:00
> (CA3) CONF, Timeframe
(IN_enmCa3Timeframe)
CURRENT
> (CA3) CONF, Shift
(IN_nCa3Shift)
0
> (CA3) CONF, Width
(IN_nCa3Width)
200
> (CA3) CONF, Prominence
(IN_dCa3Prominence)
0.1
> (CA3) CONF, Breakout factor
(IN_dCa3BreakoutFactor)
1.0
> (CA3) CONF, Mid vola min swings
(IN_nCa3MidVolaMinSwings)
6
> (CA3) CONF, Mid vola min ROC
(IN_dCa3MidVolaMinROC)
0.003
> (CA3) CONF, Mid vola min filled
(IN_dCa3MidVolaMinFilled)
7.0
> (CA3) CONF, High vola min swings
(IN_nCa3HighVolaMinSwings)
9
> (CA3) CONF, High vola min ROC
(IN_dCa3HighVolaMinROC)
0.0045
> (CA3) CONF, High vola min filled
(IN_dCa3HighVolaMinFilled)
9.0
> (CA3) CONF, Draw base
(IN_enmCa3DrawBase)
ON
> (CA3) CONF, Draw extrema
(IN_enmCa3DrawExtrema)
ON
> (CA3) CONF, Draw sup res
(IN_enmCa3DrawSupRes)
ON
> (CA3) CONF, Draw swing phase
(IN_enmCa3DrawSwingPhase)
ON
> (CA3) CONF, Sup res for limits (+A;-B;-C;+D, ALL, NONE)
(IN_strCa3SupResForLimits)
ALL
> (CA3) CONF, Stop loss multiplier
(IN_dCa3StopLossMultiplier)
1.0
> (CA3) CONF, Take profit multiplier
(IN_dCa3TakeProfitMultiplier)
1.0
> (CA3) COND, Regression angles min
(IN_dCa3RegressionAnglesMin)
-25000000.0
> (CA3) COND, Regression angles max
(IN_dCa3RegressionAnglesMax)
25000000.0
> (CA3) COND, Trade volatility low
(IN_enmCa3TradeVolatilityLow)
ON
> (CA3) COND, Trade volatility middle
(IN_enmCa3TradeVolatilityMiddle)
ON
> (CA3) COND, Trade volatility high
(IN_enmCa3TradeVolatilityHigh)
ON
> (CA3) COND, Trade swing phase overstatement
(IN_enmCa3TradeSwingPhaseOverstatement)
ON
> (CA3) COND, Trade swing phase understatement
(IN_enmCa3TradeSwingPhaseUnderstatement)
ON
> (CA3) COND, Trade swing phase over correction
(IN_enmCa3TradeSwingPhaseOverCorrection)
ON
> (CA3) COND, Trade swing phase under correction
(IN_enmCa3TradeSwingPhaseUnderCorrection)
ON
> (CA3) COND, Trade swing phase upswing
(IN_enmCa3TradeSwingPhaseUpswing)
ON
> (CA3) COND, Trade swing phase downswing
(IN_enmCa3TradeSwingPhaseDownswing)
ON
> (CA3) COND, Trade swing phase undefined
(IN_enmCa3TradeSwingPhaseUndefined)
ON
> (CA3) COND, Current swing angle min
(IN_dCa3CurrentSwingAngleMin)
-25000000.0
> (CA3) COND, Current swing angle max
(IN_dCa3CurrentSwingAngleMax)
25000000.0
> (CA3) COND, Current swing pos min
(IN_dCa3CurrentSwingPosMin)
0.0
> (CA3) COND, Current swing pos max
(IN_dCa3CurrentSwingPosMax)
1.0
> (CA3) COND, Swing A number (0 = OFF)
(IN_nCa3SwingANumber)
0
> (CA3) COND, Swing A height max
(IN_dCa3SwingAHeightMax)
10000.0
> (CA3) COND, Swing A height min
(IN_dCa3SwingAHeightMin)
-10000.0
> (CA3) COND, Swing A width max
(IN_dCa3SwingAWidthMax)
10000.0
> (CA3) COND, Swing A width min
(IN_dCa3SwingAWidthMin)
0.0
> (CA3) COND, Swing A range height max
(IN_dCa3SwingARangeHeightMax)
1.0
> (CA3) COND, Swing A range height min
(IN_dCa3SwingARangeHeightMin)
0.0
> (CA3) COND, Swing A range width max
(IN_dCa3SwingARangeWidthMax)
1.0
> (CA3) COND, Swing A range width min
(IN_dCa3SwingARangeWidthMin)
0.0
> (CA3) COND, Swing A range upper point max
(IN_dCa3SwingARangeUpperPointMax)
1.0
> (CA3) COND, Swing A range upper point min
(IN_dCa3SwingARangeUpperPointMin)
0.0
> (CA3) COND, Swing A range lower point max
(IN_dCa3SwingARangeLowerPointMax)
1.0
> (CA3) COND, Swing A range lower point min
(IN_dCa3SwingARangeLowerPointMin)
0.0
> (CA3) COND, Swing A range left point max
(IN_dCa3SwingARangeLeftPointMax)
1.0
> (CA3) COND, Swing A range left point min
(IN_dCa3SwingARangeLeftPointMin)
0.0
> (CA3) COND, Swing A range right point max
(IN_dCa3SwingARangeRightPointMax)
1.0
> (CA3) COND, Swing A range right point min
(IN_dCa3SwingARangeRightPointMin)
0.0
> (CA3) COND, Swing X number (0 = OFF)
(IN_nCa3SwingXNumber)
0
> (CA3) COND, Swing X height max
(IN_dCa3SwingXHeightMax)
10000.0
> (CA3) COND, Swing X height min
(IN_dCa3SwingXHeightMin)
-10000.0
> (CA3) COND, Swing X width max
(IN_dCa3SwingXWidthMax)
10000.0
> (CA3) COND, Swing X width min
(IN_dCa3SwingXWidthMin)
0.0
> (CA3) COND, Swing X range height max
(IN_dCa3SwingXRangeHeightMax)
1.0
> (CA3) COND, Swing X range height min
(IN_dCa3SwingXRangeHeightMin)
0.0
> (CA3) COND, Swing X range width max
(IN_dCa3SwingXRangeWidthMax)
1.0
> (CA3) COND, Swing X range width min
(IN_dCa3SwingXRangeWidthMin)
0.0
> (CA3) COND, Swing X range upper point max
(IN_dCa3SwingXRangeUpperPointMax)
1.0
> (CA3) COND, Swing X range upper point min
(IN_dCa3SwingXRangeUpperPointMin)
0.0
> (CA3) COND, Swing X range lower point max
(IN_dCa3SwingXRangeLowerPointMax)
1.0
> (CA3) COND, Swing X range lower point min
(IN_dCa3SwingXRangeLowerPointMin)
0.0
> (CA3) COND, Swing X range left point max
(IN_dCa3SwingXRangeLeftPointMax)
1.0
> (CA3) COND, Swing X range left point min
(IN_dCa3SwingXRangeLeftPointMin)
0.0
> (CA3) COND, Swing X range right point max
(IN_dCa3SwingXRangeRightPointMax)
1.0
> (CA3) COND, Swing X range right point min
(IN_dCa3SwingXRangeRightPointMin)
0.0

As stated earlier, this example uses two chart analyzer submodules. Consequently, the following table lists all the input parameters linked with the chart analyzer's submodule CA4. Despite the extensive list of parameters, only a few are essential to set up and comprehend for generating signals effectively. For a detailed walkthrough on configuring a chart analyzer, please consult the corresponding section in the user manual.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (CA4) CONF, Signal in use
(IN_enmCa4SignalInUse)
OFFThe configurations article explains the meaning and usage of each input parameter.
> (CA4) CONF, Signal visualization
(IN_enmCa4SignalVisualization)
OFF
> (CA4) CONF, Symbol
(IN_strCa4Symbol)
CURRENT
> (CA4) CONF, Exclusion (HH:MM:SS-HH:MM:SS)
(IN_strCa4Exclusion)
00:00:00-00:00:00
> (CA4) CONF, Timeframe
(IN_enmCa4Timeframe)
CURRENT
> (CA4) CONF, Shift
(IN_nCa4Shift)
0
> (CA4) CONF, Width
(IN_nCa4Width)
200
> (CA4) CONF, Prominence
(IN_dCa4Prominence)
0.1
> (CA4) CONF, Breakout factor
(IN_dCa4BreakoutFactor)
1.0
> (CA4) CONF, Mid vola min swings
(IN_nCa4MidVolaMinSwings)
6
> (CA4) CONF, Mid vola min ROC
(IN_dCa4MidVolaMinROC)
0.003
> (CA4) CONF, Mid vola min filled
(IN_dCa4MidVolaMinFilled)
7.0
> (CA4) CONF, High vola min swings
(IN_nCa4HighVolaMinSwings)
9
> (CA4) CONF, High vola min ROC
(IN_dCa4HighVolaMinROC)
0.0045
> (CA4) CONF, High vola min filled
(IN_dCa4HighVolaMinFilled)
9.0
> (CA4) CONF, Draw base
(IN_enmCa4DrawBase)
ON
> (CA4) CONF, Draw extrema
(IN_enmCa4DrawExtrema)
ON
> (CA4) CONF, Draw sup res
(IN_enmCa4DrawSupRes)
ON
> (CA4) CONF, Draw swing phase
(IN_enmCa4DrawSwingPhase)
ON
> (CA4) CONF, Sup res for limits (+A;-B;-C;+D, ALL, NONE)
(IN_strCa4SupResForLimits)
ALL
> (CA4) CONF, Stop loss multiplier
(IN_dCa4StopLossMultiplier)
1.0
> (CA4) CONF, Take profit multiplier
(IN_dCa4TakeProfitMultiplier)
1.0
> (CA4) COND, Regression angles min
(IN_dCa4RegressionAnglesMin)
-25000000.0
> (CA4) COND, Regression angles max
(IN_dCa4RegressionAnglesMax)
25000000.0
> (CA4) COND, Trade volatility low
(IN_enmCa4TradeVolatilityLow)
ON
> (CA4) COND, Trade volatility middle
(IN_enmCa4TradeVolatilityMiddle)
ON
> (CA4) COND, Trade volatility high
(IN_enmCa4TradeVolatilityHigh)
ON
> (CA4) COND, Trade swing phase overstatement
(IN_enmCa4TradeSwingPhaseOverstatement)
ON
> (CA4) COND, Trade swing phase understatement
(IN_enmCa4TradeSwingPhaseUnderstatement)
ON
> (CA4) COND, Trade swing phase over correction
(IN_enmCa4TradeSwingPhaseOverCorrection)
ON
> (CA4) COND, Trade swing phase under correction
(IN_enmCa4TradeSwingPhaseUnderCorrection)
ON
> (CA4) COND, Trade swing phase upswing
(IN_enmCa4TradeSwingPhaseUpswing)
ON
> (CA4) COND, Trade swing phase downswing
(IN_enmCa4TradeSwingPhaseDownswing)
ON
> (CA4) COND, Trade swing phase undefined
(IN_enmCa4TradeSwingPhaseUndefined)
ON
> (CA4) COND, Current swing angle min
(IN_dCa4CurrentSwingAngleMin)
-25000000.0
> (CA4) COND, Current swing angle max
(IN_dCa4CurrentSwingAngleMax)
25000000.0
> (CA4) COND, Current swing pos min
(IN_dCa4CurrentSwingPosMin)
0.0
> (CA4) COND, Current swing pos max
(IN_dCa4CurrentSwingPosMax)
1.0
> (CA4) COND, Swing A number (0 = OFF)
(IN_nCa4SwingANumber)
0
> (CA4) COND, Swing A height max
(IN_dCa4SwingAHeightMax)
10000.0
> (CA4) COND, Swing A height min
(IN_dCa4SwingAHeightMin)
-10000.0
> (CA4) COND, Swing A width max
(IN_dCa4SwingAWidthMax)
10000.0
> (CA4) COND, Swing A width min
(IN_dCa4SwingAWidthMin)
0.0
> (CA4) COND, Swing A range height max
(IN_dCa4SwingARangeHeightMax)
1.0
> (CA4) COND, Swing A range height min
(IN_dCa4SwingARangeHeightMin)
0.0
> (CA4) COND, Swing A range width max
(IN_dCa4SwingARangeWidthMax)
1.0
> (CA4) COND, Swing A range width min
(IN_dCa4SwingARangeWidthMin)
0.0
> (CA4) COND, Swing A range upper point max
(IN_dCa4SwingARangeUpperPointMax)
1.0
> (CA4) COND, Swing A range upper point min
(IN_dCa4SwingARangeUpperPointMin)
0.0
> (CA4) COND, Swing A range lower point max
(IN_dCa4SwingARangeLowerPointMax)
1.0
> (CA4) COND, Swing A range lower point min
(IN_dCa4SwingARangeLowerPointMin)
0.0
> (CA4) COND, Swing A range left point max
(IN_dCa4SwingARangeLeftPointMax)
1.0
> (CA4) COND, Swing A range left point min
(IN_dCa4SwingARangeLeftPointMin)
0.0
> (CA4) COND, Swing A range right point max
(IN_dCa4SwingARangeRightPointMax)
1.0
> (CA4) COND, Swing A range right point min
(IN_dCa4SwingARangeRightPointMin)
0.0
> (CA4) COND, Swing X number (0 = OFF)
(IN_nCa4SwingXNumber)
0
> (CA4) COND, Swing X height max
(IN_dCa4SwingXHeightMax)
10000.0
> (CA4) COND, Swing X height min
(IN_dCa4SwingXHeightMin)
-10000.0
> (CA4) COND, Swing X width max
(IN_dCa4SwingXWidthMax)
10000.0
> (CA4) COND, Swing X width min
(IN_dCa4SwingXWidthMin)
0.0
> (CA4) COND, Swing X range height max
(IN_dCa4SwingXRangeHeightMax)
1.0
> (CA4) COND, Swing X range height min
(IN_dCa4SwingXRangeHeightMin)
0.0
> (CA4) COND, Swing X range width max
(IN_dCa4SwingXRangeWidthMax)
1.0
> (CA4) COND, Swing X range width min
(IN_dCa4SwingXRangeWidthMin)
0.0
> (CA4) COND, Swing X range upper point max
(IN_dCa4SwingXRangeUpperPointMax)
1.0
> (CA4) COND, Swing X range upper point min
(IN_dCa4SwingXRangeUpperPointMin)
0.0
> (CA4) COND, Swing X range lower point max
(IN_dCa4SwingXRangeLowerPointMax)
1.0
> (CA4) COND, Swing X range lower point min
(IN_dCa4SwingXRangeLowerPointMin)
0.0
> (CA4) COND, Swing X range left point max
(IN_dCa4SwingXRangeLeftPointMax)
1.0
> (CA4) COND, Swing X range left point min
(IN_dCa4SwingXRangeLeftPointMin)
0.0
> (CA4) COND, Swing X range right point max
(IN_dCa4SwingXRangeRightPointMax)
1.0
> (CA4) COND, Swing X range right point min
(IN_dCa4SwingXRangeRightPointMin)
0.0

For simplicity, the tables do not list each input parameter related to swing analysis. In this context, Swing X can represent Swing B, Swing C, Swing D, or Swing E.

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.

Chart Analyzers, Example, Reset of inputs.png

The default input parameters of the Expert Advisor Builder are designed to be highly functional. This implies that not every parameter needs to be adjusted when creating a new strategy. Instead, only the differences from the default parameters need to be considered. As a result, even with minimal reconfiguration, the output strategy can be significantly different.

Trend detection with CA3

These examples illustrate that the initial chart analyzer is employed to identify long-term trends. It explicitly evaluates phases where the overall market is in a state of decline, deeming them suitable for initiating short trades. This process begins with the configuration of the chart analyzer module CA3. However, it's worth noting that any chart analyzer submodule could perform the same function. The chart analyzer under discussion in this section is highlighted in green in the subsequent illustration.

Chart Analyzers, Example, Concept diagram, Block details, CA3.png

The sketching phase typically marks the commencement of the development process for an automated trading strategy. Hence, it's advisable to utilize the strategy tester in visual mode. Combining the input parameter > (MIS) General signal visualization with the SHORT SIGNAL ONLY operation mode allows the Expert Advisor Builder to plot a vertical red line when the general trading signal is positive at each instance. This results in a consistently positive output signal. For trend detection, it's a common practice to observe a higher timeframe. Assuming that trading is to occur in the M15 timeframe, trend detection can be performed in the H1 timeframe. Consequently, the chart analyzer's input parameter > (CA3) CONF, timeframe is set to H1. Additionally, the output of any visual element is disabled, resulting in the chart below.

Chart Analyzers, Example, Trend detection with CA3, Example chart 1.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_cca34_4_v_2_0.zip.

Utilizing the ready-to-use swing phase input parameters makes it straightforward to generate a positive signal during underestimation, overestimation correction, or downswing market phases. Given that all chart analyzer outputs are logically AND combined, the signal from the first chart analyzer can be used to constrain the signal for the second chart analyzer. This is a prevalent signal filter combination, where the filter can produce a positive trading signal for an extended duration but not the actual trading signal generator.

Chart Analyzers, Example, Trend detection with CA3, Example chart 2.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_cca34_5_v_2_0.zip.

Considering the current swing position is crucial to enhance the filtering process. This approach allows us to eliminate phases where the current price is nearing the upper boundary of the chart analyzer. As depicted in the subsequent illustration, this method effectively filters out a significant portion of the filter signal, thereby indicating phases of a bullish market.

Chart Analyzers, Example, Trend detection with CA3, Example chart 3.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_cca34_6_v_2_0.zip.

Momentum detection with CA4

In this example, the second chart analyzer employs the submodule CA4. However, they could also be potential options since neither CA1 nor CA2 are used. The module currently in use is marked in green in the subsequent illustration. This particular chart analyzer is designed to generate the actual trading signal in real time.

Chart Analyzers, Example, Concept diagram, Block details, CA4.png

As is standard procedure, the first step involves activating the chart analyzer submodule using the input parameters > (CA4) CONF, Signal in use. To avoid confusion while configuring the trading signal, turn off the signals from the previously configured chart analyzer submodule using > (CA3) CONF, Signal in use.

Chart Analyzers, Example, Momentum detection with CA4, Example chart 1.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_cca34_8_v_2_0.zip.

The chart analyzer width can be reduced to 50 bars because the focus is on the most recent movements. Please adjust the input parameter > (CA4) CONF, Width to do this. Modify the input parameter > (CA4) CONF, Prominence to maintain sensitivity. As observed, the swings that follow the actual price movement are narrow.

Chart Analyzers, Example, Momentum detection with CA4, Example chart 2.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_cca34_9_v_2_0.zip.

Like the trend filter, this chart analyzer utilizes the pre-set swing phase input parameters to restrict its signal to market phases when the price movement is corrected after an overstatement. This configuration yields a reasonable volume of signals when the overall market exhibits a bullish trend. As demonstrated in the following image, the signals generated are pretty accurate.

Chart Analyzers, Example, Momentum detection with CA4, Example chart 3.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_cca34_10_v_2_0.zip.

For the final configuration step, the swing analysis for swing A is activated, necessitating that the swing width isn't overly large. This helps minimize the number of false signals during bearish market conditions.

Chart Analyzers, Example, Momentum detection with CA4, Example chart 4.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_cca34_11_v_2_0.zip.

Congratulations, you have configured both chart analyzer modules. One is set up as a trend filter, while the other is prepared for actual trading signal generation.

Combination of both signals

The final signal output of the chart analyzer turns positive when all individual chart analyzer submodules enabled simultaneously are evaluated as positive sub-signals. In other words, the chart analyzer submodules are logically combined using an AND operation. This specific example aims to combine chart analyzer CA3 and chart analyzer CA4, both highlighted in the following block diagram.

Chart Analyzers, Example, Concept diagram, Block details, CA3 and CA4.png

To put this into practice, activate the chart analyzer CA3. This straightforward step filters out signals that don't occur during bullish market phases. The subsequent chart example illustrates that the remaining trading signal is highly advantageous for initiating short trades.

Chart Analyzers, Example, Combination of both signals, Example chart.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_cca34_13_v_2_0.zip.

Enabling of trading

Currently, the trading module merely visualizes the trading signals and doesn't execute any actual trades. This behavior is controlled by the input parameter > (ORM) Operation. By switching this parameter from SHORT SIGNAL ONLY to SHORT, you direct the trading module to open short trades whenever a trading signal emerges, and no other trade is already open. As shown in the image below, short trades are executed.

Chart Analyzers, Example, Enabling of trading, Example chart.png
tip

To reproduce the chart from above, you can download and use the SET file package um_eab_cca34_14_v_2_0.zip.