divergence awesome ocilator
Info
The divergence awesome ocilator is a Indicator for MetaTrader 5 that this mql5 code is a custom indicator designed to detect and visualise divergencesbetween price action and the awesome oscillator (ao). divergences occur when the price movement and the oscillator movement are not aligned, often signalling potential reversals or continuations in the market.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Indicator works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Indicators folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use divergence awesome ocilator
1. Installation: Place your file in the MQL/Indicators folder via "Open Data Folder" and restart your terminal.
2. Loading: Find the indicator in the Navigator, drag it onto your chart, and configure the input parameters in the popup window.
3. Customization: Press Ctrl+I to open the indicator list, select your tool, and click "Properties" to change colors, levels, or visual styles.
4. Updating: Replace the old file in the Indicators folder with the new version and restart the platform to apply changes.
Frequently Asked Questions
Q: Why is my indicator not showing? A: Verify the file is in the MQL/Indicators folder, or try right-clicking the "Indicators" tree in the Navigator and clicking "Refresh."
Q: Do custom indicators slow down the platform? A: Too many complex indicators can impact performance; remove unused ones via the "Indicator List" (Ctrl+I).
Q: Can I use MT4 indicators on MT5? A: No, MQL4 and MQL5 are distinct languages; ensure the indicator is compiled specifically for your platform version.
What this tool does
this mql5 code is a custom indicator designed to detect and visualise divergencesbetween price action and the awesome oscillator (ao).
Typical Use Case
This Indicator excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Indicator works on MetaTrader 5. Place the file in the MQL5/Indicators folder and restart the terminal.
Description & Settings
Related: rsi divergence and higher timeframe (htf) power of 3 (po3) indicator - another powerful indicator for MetaTrader 5 traders.
Also recommended: asq divergence detector - similar indicator with strong performance on MetaTrader 5.
this mql5 code is a custom indicator designed to detect and visualisedivergences
between price action and the
awesome oscillator (ao)
. divergences occur when the price movement and the oscillator movement are not aligned, often signalling potential reversals or continuations in the market. the indicator plots buy/sell signals, a histogram of the ao, and trendlines to highlight these divergences.
key features of the indicator:
divergence detection
:
detects
bullish divergences
(price makes lower lows while ao makes higher lows).
detects
bearish divergences
(price makes higher highs while ao makes lower highs).
visualisation
:
buy/sell arrows
: plots arrows on the chart to indicate potential buy or sell signals based on divergences.
histogram
: displays the awesome oscillator (ao) values as a histogram.
trendlines
: draws trendlines on the chart to highlight the divergences between price and ao.
custom buffers
:
uses four buffers to store data:
buybuffer and sellbuffer for buy/sell signals.
histogrambuffer for ao values.
pointscounterbuffer to track aligned points for divergence confirmation.
dynamic trendline drawing
:
uses cchartobjecttrend to dynamically draw trendlines on the chart for price and ao.
crossing check
:
includes a function ( checkcrossing ) to verify if the price or ao crosses a trendline, which helps confirm or invalidate a divergence.
interpolation
:
uses linear interpolation ( calculateintermediatevalue ) to calculate intermediate values between two points, which is used to check for crossings.
how it works:
initialisation
:
the oninit() function sets up the indicator buffers, assigns properties (e.g., colours, styles), and initializes the awesome oscillator (ao) handle.
main calculation
:
the oncalculate() function processes price and ao data to detect divergences:
identifies
bottoms
(lower lows) and
tops
(higher highs) in both price and ao.
checks for divergences by comparing price and ao trends.
plots buy/sell signals and draws trendlines when a divergence is confirmed.
divergence confirmation
:
uses conditions like isbullishtrend and isbearishtrend to confirm divergences.
ensures no crossing occurs between the price and ao trendlines to validate the divergence.
dynamic updates
:
the indicator dynamically updates with each new bar, recalculating divergences and redrawing trendlines as needed.
key functions:
isbottom() and istop()
:
detect local minima (bottoms) and maxima (tops) in an array (price or ao).
checkcrossing()
:
checks if the price or ao crosses a trendline, which can invalidate a divergence.
calculateintermediatevalue()
:
calculates intermediate values using linear interpolation for trendline analysis.
adduniquecoordinates()
:
ensures unique coordinates are added to the array for trendline drawing.
totalaligned()
:
counts the number of aligned points to confirm divergence strength.
usage:
this indicator is useful for traders who rely on divergence strategies to identify potential reversals or continuations in the market.
it provides visual cues (arrows, trendlines, and histograms) to help traders make informed decisions.
example scenario:
if the price is making
lower lows
(bearish), but the ao is making
higher lows
(bullish), a
bullish divergence
is detected. the indicator will plot a
buy arrow
and draw trendlines to highlight the divergence.
conversely, if the price is making
higher highs
(bullish), but the ao is making
lower highs
(bearish), a
bearish divergence
is detected. the indicator will plot a
sell arrow
and draw trendlines.
technical details:
platform
: metatrader 5 (mt5).
language
: mql5.
dependencies
: uses the awesome oscillator ( iao ) for calculations.
custom objects
: utilises cchartobjecttrend for drawing trendlines and carrayint for managing arrays of coordinates.
this indicator is a powerful tool for traders who want to automate divergence detection and visualisation, saving time and improving accuracy in their trading strategies.
You may also like: institutional dxy overlay and correlation divergence indicator - excellent alternative for indicator users on MetaTrader 5.
Source Code
яю//+------------------------------------------------------------------+
#property copyright "RobotFX"
#property link "https://robotfx.org"
#property version "1.00"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_plots 5
#property indicator_label1 "Buy"
#property indicator_type1 DRAW_ARROW
#property indicator_color1 clrTeal
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.