Part 19 Technical Analysis – Consolidation and Divergences

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    The Best Binary Options Broker 2020!
    Perfect For Beginners!
    Free Demo Account!
    Free Trading Education!

  • Binomo
    Binomo

    Good choice for experienced traders!

Advanced Technical Analysis

Course Overview

eduCBA brings you this Awesome course on Advanced Technical Analysis Training. This detailed course will help you understand all the important concepts and topics of Advanced Technical Analysis.

Advanced Technical Analysis Training Courses

Study the past to learn the future. That’s the basic idea behind the seemingly complex subject of technical analysis. Those in the profession are often called “chartists”, besides being more popularly known as technical analysts. They use mathematical and statistical formulas and data visualizations on the price movement for studying the performance of an asset class over time. They then advice on buy, sell, or hold recommendations, depending on history repeating itself. There are several technical analysis tools that can be used automatically, or in combination, to arrive at a supply-demand trading strategy.

The advanced technical analysis training course is designed for individual stocks, exchange traded funds, index futures, and similar other instruments for analyzing the market trends and behaviors so as to distinguish, classify, and properly time the trades. In this course you’ll learn how to determine a market’s overall direction and then take a call which is congruous to the market. Curriculum of the advanced technical analysis training course is focused on price-based technical analysis using major indices as forecasting instruments.

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more

There are a number of approaches to technical analyses. These include the Elliot wave theory, Dow Theory, cyclical analysis, Fibonacci analysis, and many others. The most popular methods are divided into two key branches, known as the statistical approach and chart analysis (commonly known as charting). With the chart analysis, the technical analyst tries to hunt for patterns forged by price movements of a particular stock and one that occurs repeatedly. Patterns like double bottoms or head and shoulders, for instance, are taken as typical chart patterns. When the technical analyst detects such a pattern, he/she executes a trade depending on the price direction expected to be followed, depending on the pattern.

The other branch, statistical analysis, is comprised mostly of research and use of many technical indicators. These are derived from the historical market data of the stock and are largely used to forecast changes or reversals regarding the strength of trend. Several of these statistical indicators project buy and sell points. There are various types of indicators, from simple ones like moving averages, to a more complicated one like the swing index, for which complex mathematical formula of several lines is used. Technical analysis monitors the price movement of the stock and may not recommend a buy or sell call. It’s the analyst who has to read into the analysis and decide.

What you’ll learn

Here are some of the key concepts you’ll learn in the advanced technical analysis training course.

  • In-depth introduction to advanced technical analysis along with its merits. Also, understanding trader psychology and how to trade successfully by forging the perfect blend.
  • The key traits required to become a seasoned technical trader along with the disciplines you have to adhere.
  • Understanding how to come up with a healthy trading psychology that has to be different from the crowd.
  • Principles of Dow Theory i.e. interpreting trends and then combining them with all support and resistance levels to sharpen the entry and exit signals for both positional and day trading.
  • Understanding chart patterns, the psychology that works behind a chart pattern and its formation, interpreting the patterns, the importance of volumes while using the patters, and finally, evolving a trading strategy that’s based on the patterns.
  • In-depth study of the moving average concept and the role it plays to determine the trade. Learning the multiple uses of moving averages at different time horizons for the trades.
  • Setting unconventional as well as classical indicators and their application towards positions, investments, and day trading.
  • Using Fibonacci to set price targets.
  • Trading in Futures and Options with a fundamental study of risk, reward, and timing related to the derivative-based trading approach.
  • Exposure to real life circumstances using mechanical systems along with technical analysis. You learn about running scans and stock picking on a real-time basis.
  • Money management and coming up with a mechanical trading system.

What is advanced technical analysis?

Simply put, advanced technical analysis is the study of investment behavior and the effect it has on price action of financial instruments. The key data we need to carry out our study include the price history of the stock or the particular financial instrument, along with the volume and time information. It helps us to form our views, depending on certain facts.

Technical analysis versus fundamental analysis

Fundamental analysis is concerned with determining the value of stocks and similar other trading and investment instruments. Fundamental analysts bother themselves with the complex relationships between demand forecast, financial statements, the quality of the management, growth and earnings, and similar factors. They would then apply their judgment on the stock or commodity, or the financial instrument, which is often relative to the sector or market peers to form a judgment whether it’s over or undervalued.

Most of the stock research carried out by investment banks or brokers are based or company fundamentals. At EduCba, we admire much of this work and take a more practical approach to investing and trading. We analyze the ways by which investors interpret fundamental data and how they behave. This behavior, collectively, is called investor sentiment. It’s often the key factor to determine the fair price of an instrument.

Technical analysis, on the other hand, holds the key to monitor investor sentiment. Many experts and investors believe that technical and fundamental analysis is exclusive of each other. But the fact is that both of them are actually complementary and works together and informs you what and when to sell or buy. Most successful traders use a combination of fundamental stock selection and technical analysis timing filters with profitable results.

It should be remembered that technical analysis, particularly chart reading, is highly subjective. The success is hugely dependent on the experience of the advisor or user. A more experienced analyst will be better equipped to determine the pattern of the price movement or a probable trend reversal. That’s one of the major reasons why most stock traders combine fundamental analysis with the technical part. In such cases, technical analysis is the most suitable to plan the buy and sell points for the positions. It makes the difference between the profit or loss derived from a stock, especially in Futures and Options trading.

Important points of technical analysis

Here are some of the main things we get from technical analysis.

  • Study of the price charts i.e. historical prices of a stock in conjunction with the present
  • Works best for stock that are traded in huge volumes.
  • Largely based on the law of demand and supply
  • Projects the mindset of a greater number of people

Course description

The advanced technical analysis course description is as follows.

  • Introduction: You are introduced to technical analysis concepts in this section.
  • Moving averages: This section is divided into six parts. You get to learn about the types of moving averages, time span, exponential moving average, the 100 day EMA chart, simple versus exponential moving average, and moving average settings.
  • Understanding momentum: Topics covered in this section include introduction to momentum principles, rate of change indicator, selection of the time span, interpretation of momentum characteristics, and oscillatory characteristics in the bull and bear markets.
  • Overbought and oversold: This section is divided into six parts. It includes understanding of the overbought and undersold region, overbought and oversold crossovers, mega overbought, oversold and extreme swings, simple and complex divergence, and smoothed momentum indicator.
  • Float and float turnover: This section is divided into 15 parts. Topics covered include introduction to float analysis, the float and float turnover, smart money and losing money scenario, importance of float analysis at the top and bottom, the principle of float analysis, 10 discoveries to understand float formation, inverted flag formation, understanding and profiting from the float turnover, redefining support and resistance, valid breakouts, successful strategies, playing the upside and downside, and float analysis formation.
  • The art of asset allocation: This is the last part of the curse. You’re introduced to the art of asset allocation, followed by the process, personal investment strategy, suggested allocation, and seven steps to plan your financial life.

Requirements

This is an expert level course and a bachelor’s or a master’s degree in a business major, like finance or economics is required to pursue it. Mathematics or statistics graduates are also eligible. Some firms require their technical analysts to be MBAs. Though it’s an expert-level course, it begins with the fundamentals of technical analysis, following which you’ll learn about the various advanced strategies. Every individual who wants to make a career out of the stock market can join this course. It’s open to working professionals, students, retired officers, housewives, novice traders, business personnel and any other interested person.

Technical analysts must have both analytical and critical thinking skills. They have to deal with the public in general and present strategies and financial data. They should have good communication skills. Those wanting to join the advanced technical analysis training course must have experience in working with electronic spreadsheets and analysis software. We recommend participants to take the technical analysis with iCharts training before joining this advanced course.

Target audience

The advanced technical analysis training course is targeted at the following.

  • Undergraduates who want to make a career in technical analysis.
  • Students wanting to seriously pursue technical analysis as a career.
  • Investors and traders who want to make money in the capital markets using advanced technical analysis.
  • Non-finance professionals and career changers who want to cultivate an extra area of proficiency or people seeking to change their career into stock trading.
  • Investment and treasury professionals working with banks or nonbanking financial institutions.

FAQs: Some general questions

  1. How can I take the course?

The entire course will be conducted online with video tutorials. There are more than seven hours of HD videos with over 38 lectures by expert faculty.

  1. Do you provide any placement services?

No. EduCba trains professionals to become leaders of the market. They emerge as experts in their own fields. Our trainees have reportedly got better job offers than others.

  1. Can I take a break from the course?

All our courses are self-study and you can take them at your convenience. But a long gap between two sections is not advisable because that disturbs the flow of learning.

  1. From where can I access the tutorials?

Since all our courses are conducted online, you can access them from all over the world. A computer and a broadband connection are all that you need.

Testimonials

Sudhindra Khaitan

“The advanced technical analysis course by EduCba really helped me to make a mark in by stock broking career. I can now advice my clients better on trading strategy.”

Pushpa Kedia

“I am a chartered accountant by profession. I would like to thank EduCba for all the quality technical analysis training they gave us. I got to know many important concepts that I couldn’t understand before.”

Sushil Ayyar

“EduCba doesn’t support the mugging up concept. You have to understand all the concepts and only then you can make a mark as a technical analyst. The course was very enjoyable.”

Pratik Poddar

“Thanks to EduCba, I am working as a technical analyst in a top broking firm. I got several job offers after I took the course. I joined it after completing the technical analysis with iCharts training course from EduCba.”

Career benefits

Some of the major career of the course is given below.

  • Know how to prepare for the trading day and according to market conditions
  • Identify the market moves before they take place
  • Pocket large one-three daily gains using the swing trading technique
  • Have control on your order flow and act like a market maker
  • Identify the correct trading style, develop it, and know how to adapt to the changing market conditions.
  • Master and operate a good and sophisticated trading platform with a technical analysis software which is used by professional traders.
View Offline

View Offline – Internet-free viewing with your iOS or Android App

Watch offline with your iOS/Android app.

Start Your Free Trial Now

You can download courses from your iOS/Android App.

Auto search for divergences and convergences

Contents

Introduction

The term “divergence” comes from the Latin word “divergere” (“to detect discrepancy”). The divergence is usually defined as a discrepancy in the indicator readings and the price movement. The antonymous term is “convergence” coming from the Latin word “convergo” (“I bring together”). There are broader divergence/convergence classification systems, including such definitions as “hidden divergence”, “extended divergence”, divergences of A, B and C classes etc.

In this article, we will first deal with the basic terms: divergence and convergence. Then we will dwell on other methods of their classification, perform their comparative analysis as well as identify the advantages and disadvantages. Finally, we will develop our own classification which is more complete and has no evident drawbacks, as well as a universal indicator for searching and displaying convergences/divergences on the chart.

Divergence and convergence (concept definition)

So, divergence is a discrepancy in the indicator readings and the price movement. We also have the second term — convergence — having the opposite meaning. According to this logic, if divergence is a discrepancy in the indicator readings and the price movement, then convergence means conformity. However, this is not the case since conformity cannot be equated to convergence.

In order for both terms — divergence and convergence — to have a more precise meaning, they need more narrow definitions. Let’s look at the price and indicator charts. If the price moves up, while the indicator goes down, we have a divergence. If the price moves down, while the indicator goes up, we have a convergence (Fig. 1).

Fig. 1. Discrepancy in the price and the indicator movements. On the left, the price moves up,
while the indicator moves down — divergence. On the right, the price moves down, while the indicator moves up — convergence

We are used to the fact that the indicator is usually placed below the price chart, so this definition seems acceptable at first glance. However, if we reverse the positions of the indicator and the price chart, everything changes radically: divergence turns into convergence and vice versa (Fig. 2).

Fig. 2. Discrepancy in the price and the indicator movements. On the left, the price moves up,
while the indicator moves down — convergence. On the right, the price moves down, while the indicator moves up — divergence

Now have a look at Figures 1 and 2 from the point of view of choosing the direction of trade. Suppose that the price moves up, while the indicator moves down, so we have decided to sell. Following the analogy, we should sell when the price moves down, while the indicator moves up (Fig. 3).

Fig. 3. Left: conditions for selling, the price and the indicator diverge. Right: conditions
for buying (similar to selling ones), the price and the indicator converge

It turns out that in case of selling, the price and the indicator diverge, while in case of buying, they converge, although buy and sell conditions are identical albeit opposite. This means, we can call one of the conditions bearish, while the second one is bullish. This means the location of the indicator below the price chart is not enough to define convergence and divergence.

All provided definitions have to do with selling direction, while the case is opposite for buying. But there is a simpler and more precise version of the definition based on the very essence of technical analysis. If we add the assumption of the further price movement to the definition of divergence and convergence, it becomes simple and concise.

Divergence is a price reversal signal in the form of a discrepancy of the indicator readings and the price movement direction

Since this is a reversal signal, the price should first move up for selling and down — for buying. In order for the said discrepancy to appear, the indicator should move down and up respectively. In this definition, selling is used as a specimen direction, while the indicator should be placed under the price chart. Divergence shown on Fig. 3 follows this definition.

Convergence represents the opposite case: now, the price should move down, while the indicator moves up. However, the estimated price direction does not change. Hence, the following convergence definition:

Convergence is a trend continuation signal in the form of a discrepancy of the indicator readings and the price movement direction

Since this is a continuation signal, the price should move down for selling and up — for buying. The indicator should move up and down respectively (Fig. 4).

Fig. 4. Convergence signals

Of course, one can argue whether the divergence is a reversal signal, and convergence is a continuation signal. But this is already a matter of practical application of the technical analysis possibilities.

The Fig. 5 shows divergence and convergence signals simultaneously to let you master the terminology.

Fig. 5. Divergence and convergence signals

Methods for determining the price and indicator movement direction

The indicator and price chart line have been straight so far. But this is an abstraction that has nothing to do with the real price movement. Therefore, let’s consider the methods that can be used to define the price and indicator direction and detect a divergence. Then, we will have a look at the divergences classification systems in practice.

In general, we first need to identify the prices or the tops and bottoms on the chart, then compare their values. The bullish divergence (buy signals) is detected by bottoms: if one bottom is higher than the previous one, then the indicator is pointing upwards, and vice versa. The bearish divergence (sell signals) is detected by the tops.

There are three ways to detect extreme points on the chart.

  1. By bars.
  2. By overcoming the threshold value from the last High/Low.
  3. Maximum/minimum value is above/below the center line of the indicator.

Detecting tops/bottoms by bars. We use the number of top/bottom bars. For example, if the parameter is 2, the indicator value at the top bar should exceed two bars to the left and two bars to the right. Accordingly, the value for the bottom should be lower than the one for the neighboring bars (Fig. 6).

Fig. 6. Defining tops and bottoms by two bars. The definition of the top is to the left. On the bar marked with arrow, it became known
of the top marked by a check mark. The definition of the bottom is to the right

The required number of bars to the left and right of the top/bottom may vary: for example, 5 to the left and 2 to the right (Fig. 7).

Fig. 7. The top defined by five bars to the left and two bars to the right

Defining tops/bottoms by a threshold value. When the indicator moves up, the system tracks its maximum value. On the bars without a new extreme value, the current value is compared with the previously fixed top/bottom. If the difference exceeds the threshold set by the external parameter, it is assumed that the indicator has changed direction, while the bar, at which the maximum/minimum value has been reached is considered the top/bottom (Fig. 8).

Fig. 8. Defining tops and bottoms by the threshold value. The threshold value is displayed in the upper left corner.
Up to bar 2, the indicator moved up, the maximum value has been fixed at bar 2, while at bar 5, the value
has decreased by the threshold value meaning the indicator changes its direction . At bar 6, the indicator
has overcome the threshold value again and changed direction etc.

Defining by bars is the most convenient since it does not depend on the indicator at all. On the contrary, the value of the threshold value depends on the indicator type. For example, for RSI with the oscillation range 0-100, the threshold value can be about 5. For Momentum, the threshold is 0.1-1, since the indicator slightly fluctuates around the level of 100. Besides, the magnitude of these fluctuations depends on the timeframe. This further complicates the use of the threshold value.

Maximum/minimum value is above/below the center line of the indicator. This method is used less often than other ones. It also depends on the applied indicator since not all indicators have an average value of 0 (for example, the average value of RSI is 50). But its main drawback is a strong lag (Fig. 9).

Fig. 9. Defining tops and bottoms by crossing the central line. We will know about the top 1
only after the central line is crossed on the bar 2. We will know about the bottom 3
after the crossing on the bar 4

Divergence classification systems

You can find a lot of articles about divergence on the web. They describe a variety of approaches that differ both in terminology and in the principles of systematizing divergence and convergence. You can find simple, classic, hidden and extended divergence. Someone, authors divide it into A, B and C classes. We are not going to analyze the primary sources in this article. Instead, let’s pass through some of the identified types.

Classic divergence. This type has already been described above and shown in Fig. 5.

Hidden divergence. The hidden divergence differs from the classic one by the direction of the price movement and indicator movements. In other words, the hidden divergence is similar to convergence.

Extended Divergence. So far, we have discussed only the up and down directions of the price and the indicator movement. If we add the horizontal movement, the number of options increases. Despite multiple options we can obtain by combining three directions of price movement and three directions of the indicator movement, only one version of the extended divergence has been singled out:

  • Horizontal price movement, the indicator is moving downwards — extended bearish divergence (sell signal)
  • Horizontal price movement, the indicator is moving upwards — extended bullish divergence (buy signal).

Classes: A, B, C. А class is a classic divergence, while B and C classes are extended divergence versions.

    • Horizontal price movement, the indicator is moving downwards — bearish (sell signal).
    • Horizontal price movement, the indicator is moving upwards — bullish (buy signal).
    • The price goes up, the indicator tops are at one level — bearish (sell signal).
    • The price goes down, the indicator bottoms are at one level — bullish (buy signal).

As we can see, B and С classes are the methods of extended divergence. The B class fully repeats the above definition.

The main conclusion I have made while browsing through available materials on divergence is the lack of clear terminology and incomplete coverage of possible versions. Therefore, we will analyze the various options for combining the price and the indicator directions and systematize them.

Complete systematization of the price and indicator movement

First, let’s define two possible price and indicator movement directions.

  1. Two movement directions: up and down.
  2. Three movement directions: up, down and horizontal.

The first case provides only four possible combinations. Let’s have a look at them using sell signals as an example.

  1. Price up, indicator up.
  2. Price up, indicator down (divergence).
  3. Price down, indicator up (convergence).
  4. Price down, indicator down.

Now that we have dealt with direction defining methods, let’s visualize these options (Fig. 10).

Fig. 10. All possible combinations of the price and the indicator movements in case of two available directions

In case of three directions, there already may be nine combinations.

  1. Price up, indicator up.
  2. Price up, indicator horizontal.
  3. Price up, indicator down (divergence).
  4. Price horizontal, indicator up.
  5. Price horizontal, indicator horizontal.
  6. Price horizontal, indicator down.
  7. Price down, indicator up (convergence).
  8. Price down, indicator horizontal.
  9. Price down, indicator down.

All these combinations are displayed in Fig. 11.

Fig. 11. All possible combinations of the price and the indicator movements in case of three available directions

If you create an indicator that allows you to choose any of the options considered, then you are able to choose the divergence, convergence, hidden or extended divergence you think to be correct. In other words, we get a universal indicator useful even for those who do not agree with the systematization and the definitions given in this article.

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    The Best Binary Options Broker 2020!
    Perfect For Beginners!
    Free Demo Account!
    Free Trading Education!

  • Binomo
    Binomo

    Good choice for experienced traders!

Triple divergence

Until now, the direction of the price and the indicator movement was determined by two points: up, down and horizontally. We may add the third point to increase the number of possible price and indicator movement options. In total, there are nine options:

  1. Up, up.
  2. Up, horizontal.
  3. Up, down.
  4. Horizontal, up.
  5. Horizontal, horizontal.
  6. Horizontal, down.
  7. Down, up.
  8. Down, horizontal.
  9. Down, down.

In this case, it would be more correct to speak of the form of movement rather than direction. Movement types defined by three tops are displayed in Fig. 12.

Fig. 12. Various possible movements based on three tops

The appropriate movements based on bottoms are displayed in Fig. 13.

Fig. 13. Various possible movements based on three bottoms

By combining 9 types of the price movement with 9 types of the indicator movement, we may obtain 81 variations of the triple divergence.

Thus, you can determine the movement by any number of points. If we add the fourth point, we will have 81 variations of the price or indicator movement and 6561 (81*81) possible versions of their combination. Of course, the more possible options, the less likely they are. Perhaps, there is no sense in applying the fourth point, but the indicator in the current article is to have no limitations on the number of points used to define the movement type.

Universal indicator for defining divergence

Now that we have dealt with the theory, let’s develop the indicator.

Selecting an oscillator. In order not to be limited by a single oscillator to define divergence, we will use the universal oscillator described in this article. It has the attachments: iUniOsc (universal oscillator) and iUniOscGUI (the same oscillator with the graphical interface). We will use the basic version — iUniOsc.

Creating a new indicator. Let’s create the new iDivergence indicator in MetaEditor. We are going to use the OnCalculate function. The OnTimer() function is not needed. Tick the “Indicator in separate window” option. We create three buffers: an oscillator display line and two arrow buffers for drawing arrows when a divergence occurs. After a new file is opened in the editor, change the buffer names: 1 — buf_osc, 2 — buf_buy, 3 — buf_sell. Names should be changed where the arrays are declared, as well as in the OnInit() function. We can also adjust the buffer properties: indicator_label1, indicator_label2, indicator_label3 — the values of these properties are displayed in the tooltip when hovering the mouse over the line or the indicator label, as well as in the data window. Let’s call them “osc”, “buy” and “sell”.

Applying the universal oscillators. Insert all external parameters of the iUniOsc indicator to the new indicator. The ColorLine1, ColorLine2 and ColorHisto parameters are not needed in the properties window. We will hide them. The Type parameter has the custom OscUni_RSI type described in the UniOsc/UniOscDefines.mqh file. We will include this file. By default, the Type parameter value is set to OscUni_ATR — ATR indicator. But ATR does not depend on the price movement direction which means it is not suitable for defining divergence. Therefore, set OscUni_RSI — RSI indicator — as default:

Declare the handle of the universal oscillator below the external variables:

Access the universal oscillator at the beginning of the OnInit() function:

In the OnCalculate() function, copy the data of the universal oscillator to the buf_osc buffer:

At this stage, we can verify the correctness of the performed actions by attaching the iDivergence indicator to the chart. If everything is done correctly, you can see the line of the oscillator in the subwindow.

Defining the oscillator extreme values. We have already considered three ways of defining extreme values. We will include them in the indicator and provide the possibility to select any of them (external variable with a drop-down list). In the Include folder, we create the UniDiver folder, in which all the additional files with the code are to be located. Create the UniDiver/UniDiverDefines.mqh include file and write the EExtrType enumeration in it:

  • ExtrBars — by bars;
  • ExtrThreshold — by overcoming the threshold from the last High/Low;
  • ExtrMiddle — maximum or minimum value if the indicator is above or below its middle.

In the indicator, create the ExtremumType external parameter and insert it above all other external parameters. When defining extreme values by bars, we will require two parameters — number of bars to the left and right of the extreme value, while when defining by threshold, we will need the parameter for calculating the threshold value:

Let’s implement the possibility to use one parameter, RightBars or LeftBars, in addition to using two at once. RightBars is equal to -1 by default. This means that it is not used and the value of the second parameter is to be assigned to it.

Extreme values definition classes. There is no need in changing the extreme value definition method during the indicator work, therefore it would be more reasonable to use OOP instead of the ‘if’ and ‘switch’ operators. Create the base class and three derived ones for three methods of defining an extreme value. One of these derived classes is to be selected when launching the indicator. These classes are to be used both for defining extreme values and performing all necessary work for finding a divergence. They are different only in the ways of defining extreme values, while the definition of convergence is completely identical in all cases. Therefore, the divergence definition function is to be located in the base class and be called from derived classes. But first, we need to provide an easy access to all indicator extreme values (like it was done with the ZigZag tops in the “Wolfe waves” article).

The SExtremum structure is used to store data about one extreme value. The structure description is located in UniDiverDefines:

The structure fields:

  • SignalBar — bar, on which it became known about the formation of an extreme value
  • ExtremumBar — bar with an extreme value
  • ExtremumTime — time of the bar with an extreme value
  • IndicatorValue — indicator value at the extremum
  • PriceValue — price value on the bar with the indicator extreme value

Two arrays of these structures are to be used to store data about all tops and bottoms. They will be members of the base class.

Classes for defining extreme values are located in the UniDiver/CUniDiverExtremums.mqh file, the base class name is CDiverBase. For now, let’s consider the structure of the class with basic methods only. The rest are to be added later as necessary.

The Calculate() virtual method allows you to select the extreme value definition option. The AddExtremum() and CheckDiver() methods are located in the ‘protected’ section — they are called from the Calculate() method of derived classes. The AddExtremum() method collects data about tops and bottoms to the m_upper[] and m_lower[] arrays. The CheckDiver() method checks if the divergence condition is met and sets the indicator arrows. Below, we will look at all these methods in more detail, but for now let’s get acquainted with the derived classes for other ways of defining extreme values.

Defining extreme values by bars. The class for defining extreme values by bars:

The parameters for defining extreme values (the LeftBars and RightBars external variables) are passed to the class constructor, their values are verified and changed if necessary and additional parameters are calculated:

The parameter values are verified first. If some of them is not positive (not set), the value of the second parameter is assigned to it. If not a single parameter is set, the default values are assigned to them (2). The indent of the initial bar for searching for an extreme value (m_start) and the total number of extremum bars (m_period) are calculated after that.

The Calculate() method is identical to the standard OnCalculate() function but it receives only the necessary price arrays rather than all: time[], high[], low[] and the indicator buffers osc[] (oscillator data), buy[] and sell[] (arrows). As usual, the range of the calculated bars is defined in the OnCalculte() function. The indicator extreme values (the ArrayMaximum() and ArrayMinimum() functions) are defined in the standard indicator cycle afterwards. After detecting an extreme point, the AddExtremum() method is called to add data to the m_upper[] or m_lower[] array. In the end, the CheckDiver() method is called to analyze data from the arrays with extreme values. If the divergence is detected, the arrows are placed.

Let’s consider this code in details. At the very start of the indicator cycle:

m_LastTime variable is declared in the base class. If the time[i] bar time exceeds the variable, the bar is calculated the first time. The bar time is assigned to the m_LastTime variable, while the Cur variable value is assigned to the Pre variable. Inversely, when recalculating the same bar, the Pre variable is assigned to the Cur one. Using the Cur and Pre variables is considered in details in this article. The Pre and Cur variables are of SPseudoBuffers1 type described in the UniDiverDefines file:

The structure includes two fields:

  • UpperCount — number of used m_upper[] array elements;
  • LowerCount — number of used m_lower[] array elements;

The Reset() method was created for fast resetting of all the structure fields.

After working with the Cur and Pre variables, the bar indices for searching for extreme values are calculated:

The index of the bar, from which the search for High/Low starts, is assigned to the ‘sb’ variable. The index of the bar, on which the High/Low is to be located, is assigned to the ‘mb’ variable.

Define the top or bottom using the ArrayMaximum() and ArrayMinimum() functions:

If the ArrayMaximum() or ArrayMinimum() function returns ‘mb’, this means the specified number of bars is located to the left and right of the top/bottom. In turn, this indicates that the desired top/bottom has formed. The AddExtremum() method is called and the data are added to the m_upper[] or m_lower[] array.

Let’s consider the simple AddExtremum() method:

The a[] array, the new data are to be added to, is passed to the method via the parameters. This can be the m_upper[] or m_lower[] array. The number of the occupied elements of the a[] array is passed via the ‘cnt’ variable. This can be the Cur.UpperCnt or Cur.LowerCnt variable. The a[] array and ‘cnt’ variable are passed by references since they are changed in the method.

iv — indicator value based on the extremum, pv — price on the bar with an extreme value, mb — index of the bar with an extreme value, sb — signal bar (at which it has become known about the extreme value arrival), et — time of the bar with an extreme value.

The array size is checked at the beginning of the AddExtremum() method. If it is full, its size increases up to 1024 elements. The data are added and the ‘cnt’ variable is increased afterwards.

We will have a look at the CheckDiver() method later.

Defining the extremum by a threshold value.

The class for defining by a threshold value is different from the class for defining by bars primarily in Cur and Pre variable types: this is the SPseudoBuffers2 type described in the UniDiverDefines.mqh file:

The SPseudoBuffers2 structure has the same fields as SPseudoBuffers1 plus a few more:

  • MinMaxVal — variable for the maximum or minimum indicator value
  • MinMaxBar — variable for the index of the bar, on which the maximum or minimum indicator value is found
  • Trend — variable for the indicator movement direction. The value of 1 means the indicator moves upwards and its maximum value is tracked. In case of -1, the minimum value is tracked.

The external parameter with the threshold value — MinMaxThreshold variable — is passed to the class constructor. Its value is saved to the m_threshold variable declared in the ‘private’ section.

The Calculate() method of this class is different in the extreme value definition method:

If the Cur.Trend variable is 1, the oscillator value is compared with the Cur.MinMaxValue value. If the new oscillator value exceeds the value from the variable, the variable value is updated. The index of the bar, at which the new High is detected, is assigned to the Cur.MinMaxBar variable. It is also ensured that the oscillator value has not decreased from the last known maximum by the m_threshold value. If it has, the oscillator has changed its direction. The AddExtremum() method is called, the data on the new extreme value are saved in the array, Cur.Trend value is replaced with the opposite one, while the initial parameters of the new minimum are set in the Cur.MinMaxVal and Cur.MinMaxBar variables. Since the value of the Cur.Trend variable has changed, another ‘case’ section — tracking the minimum oscillator values and exceeding the threshold upwards — is executed from now on.

Defining extreme values by their position relative to the oscillator’s midpoint. The type of the applied oscillator is passed to the class constructor. Depending on that type, the oscillator middle value is defined:

For Momentum, the value is 100, for RSI and Stochastic, this is 50, for WPR, this is -50, for other oscillators, this is 0.

The very method of determining the extreme value is similar in many respects to the threshold value method:

The only difference is that the direction change is done through a comparison with the middle level of the oscillator: osc[i] m_level.

Method of setting the divergence type. Add the variable for selecting the type of the identified divergence to the external parameters:

By default, the value of the parameter is 3. According to Fig. 11, this means the classic divergence. In total, 9 combinations of the price and indicator movement are displayed in Fig. 11. Let’s add yet another option — “not checked”. Now, we have 10 combinations. Thus, using the usual decimal number, we can describe any combination of different movements in any number (including a triple divergence). It turns out that a single-digit number corresponds to a simple divergence (on two tops/bottoms), a two-digit number is a triple number, and so on. For example, the number of 13 will correspond to the combination displayed in Fig. 14.

Fig. 14. The combination of the indicator and
price movements when Number=13 for selling

Classes for checking divergence conditions. The base and derive classes are created for checking the divergence conditions. The Number parameter value will be analyzed at the indicator launch. The most important attribute is its length since it affects the size of the array of pointers to classes. Then, the appropriate object will be generated for each array element according to the condition type.

Condition verification classes are located in the UniDiver/CUniDiverConditions.mqh file. The base class is named CDiverConditionsBase. Let’s have a look at it:

The class has two virtual methods for comparing two neighboring tops. Their parameters are passed in it:

  • i1 — indicator value in point 1
  • p1 — price value in point 1
  • i2 — indicator value in point 2
  • p2 — price value in point 2

The points are counted from right to left starting with one.

The SetParameters() method is used for setting additional comparison parameters: pt — available difference of the price values, at which the price points are assumed to be located on a single level. it — similar parameter for comparing the indicator tops. The values of these parameters are set via the properties window:

The code of one of the derived classes is shown below:

In the method for CheckBuy(), it is checked whether the point 1 price exceeds the point 2 one. The same goes for the indicator: point 1 price should exceed the value in point 2. The CheckSell() method is mirror-symmetric to the CheckBuy() method. All other classes are similar and differ only in logical expressions, except for CDiverConditions0. The CheckSell() and CheckBuy() methods return ‘true’ at once in that class. It is used when the conditions check is disabled (any option is possible).

Preparing for checking the divergence conditions. The array and the variable for its size are declared in the ‘protected’ section of the CDiverBase class:

In the SetConditions() method, the m_conditions array size is changed and the divergence condition verification objects are created:

The following parameters are passed to the method:

  • num — Number external parameter;
  • pt — PriceLevel external parameter;
  • it — IndLevel external parameter.

The ‘num’ parameter is checked first:

Then, the m_conditions array increases up to the maximum possible size (10 — length of the maximum value of the ‘int’ variable). After that, the object of the condition verification via the CreateConditions() method is created and the parameters are set using the SetParameters() method in the ‘while’ loop depending on the value of each of the digits of ‘num’. After the loop, the array size changes according to the real number of applied conditions.

Let’s examine the CreateConditions() method:

The method is simple: depending on the i parameter, the appropriate object is created and the reference to it is returned.

Defining divergence. Now, we can consider the CheckDivergence() method of the CDiverBase class. First, we consider all the method code, then consider it one by one:

The following parameters are passed to the method:

  • i — index of the current calculated bar;
  • ucnt — number of applied m_upper[] array elements;
  • lcnt — number of applied m_lower[] array elements;
  • time[] — array with the bars time;
  • high[] — array with high bars prices;
  • low[] — array with low bars prices;
  • buy[] — indicator buffer for buy arrows;
  • sell[] — indicator buffer for sell arrows;
  • osc[] — indicator buffer with oscillator values.

Buffers with arrows are cleared first:

Graphical objects corresponding to the calculated bar are removed:

Apart from arrows, iDivergence applies graphical objects to display arrows on the price chart and lines connecting extreme values on the price chart with tops/bottoms on the oscillator graph.

Then there are two identical sections of code to check the conditions for selling and buying. Let’s consider the first section for selling. The number of available oscillator tops should be 1 more than the number of checked conditions. Therefore, the check is performed:

After that, we check if the top on the calculated bar exists. This is determined by the correspondence between the index of the calculated bar and the index from the array with data on tops/bottoms:

An auxiliary variable is required for the results of checking the conditions:

In the ‘for’ loop, go through all conditions passing data on tops to them:

If any of the conditions is not fulfilled, exit the loop. ‘false’ is assigned to the ‘check’ variable. If all conditions are met, ‘check’ saves ‘true’, an arrow is set and a graphical object is created:

Display of graphical objects can be enabled/disabled in the indicator properties window. The following variables are declared for that:

  • ArrowsOnChart — enable arrows from graphical objects on the price chart
  • DrawLines — enable drawing the lines connecting the price and indicator Highs and Lows
  • ColBuy and ColSell — colors of graphical objects for buy and sell signals.

In the ‘protected’ section of the CDiverBase class, the appropriate variables are declared:

The values ​​of these variables are set in the SetDrawParmeters() method:

Consider the methods that work with graphical objects. Removal:

Lines connecting tops/bottoms and arrows are removed separately. Names of all graphical objects start with the indicator name followed by the time of the bar, on which the divergence was detected. The names are further formed in the loop corresponding to the number of m_ccnt conditions. “bp” is displayed for buy signals on the price chart, “bi” is displayed for buy signals on the indicator graph. Similarly, “sp” and “ip” are added for sell signals. The j index is added to the end of names. “_ba” (buy signal arrow) or “_sa” (sell signal arrow) are added to the arrow names.

Creation of graphical objects is performed in the DrawSellObjects() and DrawBuyObjects() methods. Let’s consider one of them:

Object names are formed the same way as during removal. After that, the graphical objects are created using the fObjTrend() and fObjArrow() functions. They are located in the UniDiver/UniDiverGObjects.mqh include file. The functions are fairly simple, there is no sense in analyzing them.

Indicator completion. We only have to apply the created classes in the indicator. Create the appropriate object in the OnInit() function depending on the selected type of defining extreme values:

One of the external parameters – PriceLevel – is measured in points, so it is convenient to correct it depending on the number of quotes’ decimal places. To do this, declare another variable to be able to turn off this correction:

Next, declare an auxiliary variable for the corrected parameter and adjust it in the OnInit() function:

Set divergence and display parameters:

Several strings in the OnCalculate() function remain. Call the basic Calculate() method:

In case of applying graphical objects, we should speed up the plotting:

When the indicator completes its work, the graphical objects should be removed. This is done in the CDiverBase class destructor. The divergence conditions verification objects are removed there as well:

At this point, the main stage of the indicator development is over. Fig. 15 displays the chart with the indicator attached to it (in the subwindow) with the enabled display of arrows on the price chart and lines plotted between the tops.

Fig. 15. The divergence indicator on the price chart with the arrows displayed on the price chart and the line connecting the extreme points

Now, we only need to add the alerts function. It is very simple and has already been described in other articles. In the attachments below, you can find a ready-made indicator with the alert function together with all the files necessary for the indicator.

Conclusion

Despite the indicator’s versatility, we can also note its drawbacks. The main drawback is the IndLevel parameter dependence on the types of the applied oscillator, as well as the PriceLevel parameter dependence on a timeframe. To exclude this dependency, the default values ​​for these parameters are 0. But at the same time, it is almost impossible to fulfill the conditions for certain combinations of the price and indicator movement. If the check for a horizontal movement is included into the divergence verification, its implementation is unlikely. In this case, the divergence options 1, 3, 7 and 9 remain. This may be an issue only when applying the tester to optimize an EA using the indicator.

In case of the correct approach to optimization, this will not be an issue since optimization is usually performed on a single symbol and timeframe. First, we need to determine the applied symbol and timeframe, and set the appropriate value for the PriceLevel parameter. Then we need to select the applied oscillator and set the appropriate value for the IndLevel parameter. There is no point in striving for auto optimization of the applied oscillator type and the PriceLevel and IndLevel parameters values, since there are many other optimization parameters besides them. First of all, this is the type of divergence (the Number variable) and the oscillator period.

Attachments

For iDivergence operation, you need a universal oscillator from the article “Universal oscillator with a graphical interface”. The oscillator and all necessary files can be found in the application.

Part 19: Technical Analysis – Consolidation and Divergences

6 Asset Classes – 16 Trading Platforms – Over 1000 Instruments.

  1. XM
  2. News
  3. Technical Analysis – USDJPY looking neutral after recent consolidation

Technical Analysis – USDJPY looking neutral after recent consolidation

USDJPY steadied today following this week’s sharp fluctuations. The price at the time of writing is at 114.64.

Looking at the RSI indicator, it is strictly speaking in bearish territory at 47, but this mark is close to the neutral 50 level, perhaps indicating that consolidation since mid-December will likely continue in the near term.

The price is currently just above the 50-day moving average (MA) and the 23.6% Fibonacci retracement level of the November 3 to December 15 upleg. Should the price close above these two key points, the pair could shift to a positive short-term momentum and this would bring into scope the December 15 10-month high of 118.66 as a major resistance level.

On the downside, should prices move below the 50-day MA and the 23.6% Fibonacci retracement, they could find support at the 38.2% Fibonacci level just below the 112 level. A breach of that handle would shift focus to the 50% Fibonacci at 109.88 as another key support point.

In the bigger picture, the pair recorded a bullish (golden) cross in the beginning of December, with the 50-day MA moving above the 200-day one. This is generally perceived as a longer-term bullish signal though subsequent price movement will help determine the strength of the signal as prices have not been consistently above the 50-day MA since the crossing took place.

Legal disclaimer: The material does not contain a record of our trading prices, or an offer of, or solicitation for, a transaction in any financial instruments. XM accepts no responsibility for any use that may be made of these comments and for any consequences resulting in it. No representation or warranty is given as to the accuracy or completeness of this information. Consequently, any person acting on it does so entirely at their own risk. The research and analysis does not involve any specific investment objectives, financial situation and needs of any specific person who may receive it.

It has not been prepared in accordance with legal requirements designed to promote the independence of research, and as such it is considered to be marketing communication. Although we are not specifically constrained from dealing ahead of the publication of our research, we do not seek to take advantage of it before we provide it to our clients. We aim to establish, maintain and operate effective organisational and administrative arrangements with a view to taking all reasonable steps to prevent conflicts of interest from constituting or giving rise to a material risk of damage to the interests of our clients. We operate a policy of independence, which requires our employees to act in our clients’ best interests and to disregard any conflicts of interest in providing our services.

CFDs are leveraged products. CFD trading may not be suitable for everyone and can result in losing all of your invested capital, so please make sure that you fully understand the risks involved.

Previous Posts

  • Technical Analysis – EURGBP may have more downside ahead
    April 7, 2020 at 7:36 am GMT
  • Technical Analysis – USDCAD tilts negative after Bollinger bands squeeze
    April 7, 2020 at 7:12 am GMT
  • Technical Analysis – GBPUSD still holds above 38.2% Fibo; more gains are expected
    April 7, 2020 at 7:02 am GMT
  • Technical Analysis – US 500 stock index in neutral phase in near term; recoups some losses
    April 6, 2020 at 12:33 pm GMT
  • Technical Analysis – AUDUSD remains under pressure below 0.6100
    April 6, 2020 at 9:21 am GMT

Previous Posts

  • Technical Analysis – EURGBP may have more downside ahead
    April 7, 2020 at 7:36 am GMT
  • Technical Analysis – USDCAD tilts negative after Bollinger bands squeeze
    April 7, 2020 at 7:12 am GMT
  • Technical Analysis – GBPUSD still holds above 38.2% Fibo; more gains are expected
    April 7, 2020 at 7:02 am GMT
  • Technical Analysis – US 500 stock index in neutral phase in near term; recoups some losses
    April 6, 2020 at 12:33 pm GMT
  • Technical Analysis – AUDUSD remains under pressure below 0.6100
    April 6, 2020 at 9:21 am GMT

Categories

Investment Research

Legal: This website is operated by XM Global Limited with registered address at No. 5 Cork Street, Belize City, Belize, CA.

Trading Point Holdings Ltd is the holding company of Trading Point of Financial Instruments Limited, XM Global Limited, Trading Point of Financial Instruments UK Limited, Trading Point of Financial Instruments Pty Ltd, and Trading Point MENA Limited.

Trading Point of Financial Instruments Limited is authorised and regulated by the Cyprus Securities and Exchange Commission (CySEC) (licence number 120/10).
XM Global Limited is authorised and regulated by the International Financial Services Commission (IFSC) (license number IFSC/60/354/TS/19).
Trading Point of Financial Instruments UK Limited is authorised and regulated by the Financial Conduct Authority (FRN: 705428).
Trading Point of Financial Instruments Pty Ltd is authorised and regulated by the Australian Securities and Investment Commission (AFSL 443670).
Trading Point MENA Limited is authorised and regulated by the Dubai Financial Services Authority (DFSA) (reference no. F003484).

Risk Warning: Forex and CFD trading involves a significant risk to your invested capital. Please read and ensure you fully understand our Risk Disclosure.

Restricted Regions: XM Global Limited does not provide services for the residents of certain countries, such as the United States of America, Canada, Israel and the Islamic Republic of Iran.

This website uses cookies

By clicking “Continue”, you agree to the default cookie settings on our website.

XM uses cookies to ensure that we provide you with the best experience while visiting our website. Some of the cookies are needed to provide essential features, such as login sessions, and cannot be disabled. Other cookies help us improve our website’s performance and your experience through personalising content, providing social media features and analysing our traffic. Such cookies may also include third-party cookies, which might track your use of our website. You may change your cookie settings at any time.

For more information please read our Cookie Policy.

This website uses cookies

By clicking “Continue”, you agree to the default cookie settings on our website.

XM uses cookies to ensure that we provide you with the best experience while visiting our website. Some of the cookies are needed to provide essential features, such as login sessions, and cannot be disabled. Other cookies help us improve our website’s performance and your experience through personalising content, providing social media features and analysing our traffic. Such cookies may also include third-party cookies, which might track your use of our website. You may change your cookie settings at any time.

Read more, or change your cookie settings.

What are Cookies?

Cookies are small data files. When you visit a website, the website sends the cookie to your computer. Your computer stores it in a file located inside your web browser.

Cookies do not transfer viruses or malware to your computer. Because the data in a cookie does not change when it travels back and forth, it has no way to affect how your computer runs, but they act more like logs (i.e. they record user activity and remember stateful information) and they get updated every time you visit a website.

We may obtain information about you by accessing cookies, sent by our website. Different types of cookies keep track of different activities. For example, session cookies are used only when a person is actively navigating a website. Once you leave the website, the session cookie disappears.

Why are cookies useful?

We use functional cookies to analyse how visitors use our website, as well as track and improve our website’s performance and function. This allows us to provide a high-quality customer experience by quickly identifying and fixing any issues that may arise. For example, we might use cookies to keep track of which website pages are most popular and which method of linking between website pages is most effective. The latter also helps us to track if you were referred to us by another website and improve our future advertising campaigns.

Another use of cookies is to store your log in sessions, meaning that when you log in to the Members Area to deposit funds, a “session cookie” is set so that the website remembers that you have already logged in. If the website did not set this cookie, you will be asked for your login and password on each new page as you progress through the funding process.

In addition, functional cookies, for example, are used to allow us to remember your preferences and identify you as a user, ensure your information is secure and operate more reliably and efficiently. For example, cookies save you the trouble of typing in your username every time you access our trading platform, and recall your preferences, such as which language you wish to see when you log in.

Here is an overview of some of the functions our cookies provide us with:

  • Verifying your identity and detecting the country you are currently visiting from
  • Checking browser type and device
  • Tracking which site the user was referred from
  • Allowing third parties to customize content accordingly

This website uses Google Analytics, a web analytics service provided by Google, Inc. (“Google”). Google Analytics uses analytical cookies placed on your computer, to help the website analyze a user’s use of the website. The information generated by the cookie about your use of the website (including your IP address) may be transmitted to and stored by Google on their servers. Google may use this information to evaluate your use of the website, to compile reports on website activity and to provide other services related to website activity and internet usage. Google may also transfer this information to third parties, where required to do so by law, or where such third parties process the information on behalf of Google. Google will not associate your IP address with any other data held. By using this website, you give your consent to Google to process data about you in the manner and for the purposes set out above.

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    The Best Binary Options Broker 2020!
    Perfect For Beginners!
    Free Demo Account!
    Free Trading Education!

  • Binomo
    Binomo

    Good choice for experienced traders!

Like this post? Please share to your friends:
How To Make Money on Binary Options Trading
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: