Quantcast

forex-divergence-options

Forex Divergence. Common



extern int AccDigits = 0;

Set 4, 5 or 0
4: set 4 if your broker provides 4-digit quotes for EURUSD pair and 2-digit quotes for USDJPY pair
5: set 5 if your broker provides 5-digit quotes for EURUSD pair and 3-digit quotes for USDJPY pair
0: auto detect

So 0 is the best variation because the indicator will autodetect AccDigits value.
So for 5-digit accounts all pip values will be automatically multiplied by 10.

extern bool UseOpenBar = false;

Set true or false

true: include open bar to calculation.

Advantages: signal is quick and leading
Disadvantages: signal is not fixed till open bar closed and can disappear

false: calculate only by closed bars
Advantages: signal is fixed and not repaint
Disadvantages: signal is more slow compared to open bar
 

MACD Forex Divergence Indicator

 

extern int MACD.FastEMA = 12;
extern int MACD.SlowEMA = 26; 
extern int MACD.Signal = 9;


This is MACD indicator parameters.
For Stochastic divergence Stochastic parameters will be passed.
For OBV divergence OBV parameters will be passed.
etc.

Forex Divergence Peaks

 

extern int Chart.LeftTop.BarsL = 3;
extern int Chart.LeftTop.BarsR = 2;


This is options of left-hand peak on chart window.
Left-hand peak is highest high for bearish pattern (or lowest low for bullish) 
between 3 bars on left side and 2 bars on right side.

extern int Chart.RightTop.BarsL = 2;
extern int Chart.RightTop.BarsR = 1;


This is options of right-hand peak on chart window.
Right-hand peak is highest high for bearish pattern (or lowest low for bullish) 
between 2 bars on left side and 1 bar on right side.
 

See div_chart_peaks1.jpg and div_chart_peaks2.jpg images for details.

forex divergence chart peak 1

forex divergence chart peak 1


extern int Ind.LeftTop.BarsL = 2;
extern int Ind.LeftTop.BarsR = 2;


This is options of left-hand peak on indicator below the chart.
Left-hand peak is highest high for bearish pattern (or lowest low for bullish) 
between 2 bars on left side and 2 bars on right side.

extern int Ind.RightTop.BarsL = 1;
extern int Ind.RightTop.BarsR = 1;


This is options of right-hand peak on indicator below the chart.
Right-hand peak is highest high for bearish pattern (or lowest low for bullish) 
between 1 bar on left side and 1 bar on right side.

See div_ind_peaks1.jpg and div_ind_peaks2.jpg images for details



forex divergence chart peak 1

forex divergence chart peak 1

 

extern int LeftTops.MaxBarsDiff = 10;

Peaks on price chart and peaks on an indicator rarely match on 100%. There can be some difference between those tops by time axis. 
LeftTops.MaxBarsDiff option is maximum allowed distance in bars by horizontal axis between left-hand divergence top on the chart and left-hand divergence top on the indicator.

extern int RightTops.MaxBarsDiff = 5;

Peaks on price chart and peaks on an indicator rarely match on 100%. There can be some difference between those tops by time axis. 
RightTops.MaxBarsDiff option is maximum allowed distance in bars by horizontal axis between right-hand divergence top on the chart and right -hand divergence top on the indicator.

Forex Divergence Indicators Levels

extern double BullishDiv.ResetAbove = 0.0;
extern double BearishDiv.ResetBelow = 0.0;


These options make it possible to decline divergence pattern if the indicator 
crossed zero levels.

Bullish divergence cancelled if the indicator crossed above BullishDiv.ResetAbove level
between left-hand and right-hand indicator peaks.

Bearish divergence cancelled if the indicator crossed below BearishDiv.ResetBelow level
between left-hand and right-hand indicator peaks.

See image div_reset1.jpg and div_reset2.jpg for details.

 

forex divergence chart peak 1

forex divergence chart peak 1

Forex Divergence Indicators Filters

extern int MaxBars = 2000;

MaxBars option defines how many bars we use to draw divergence patterns.
This option is useful if we call divergence indicator from an expert on backtesting.

extern int DivWidth.MinBars = 3;
extern int DivWidth.MaxBars = 150;


DivWidth.MinBars and DivWidth.MaxBars options define
minimum and maximum allowed horizontal distance between 2 divergence peaks.

See image div_hdist.jpg with explanation of horizontal distance.

extern int DivHeight.MinPips = 1;
extern int DivHeight.MaxPips = 1000;


DivHeight.MinPips and DivHeight.MaxPips options define
minimum and maximum allowed vertical distance between 2 divergence peaks.

See image div_vdist.jpg with explanation of vertical distance.

forex divergence chart peak 1

forex divergence chart peak 1

Graphic

extern color clBullishDiv = DeepSkyBlue;

The color of Bullish divergence pattern including arrows and lines


extern color clBearishDiv = OrangeRed;

The color of Bearish divergence pattern including arrows and lines

extern int Chart.BullishDiv.ArrowCode1 = 233;
extern int Chart.BullishDiv.ArrowCode2 = 32;


Draw arrow below right-hand bullish divergence peak (symbol code 233)
Draw space below left-hand bullish divergence peak (symbol code 32)


extern int Chart.BearishDiv.ArrowCode1 = 234;
extern int Chart.BearishDiv.ArrowCode2 = 32;


Draw arrow above right-hand bearish divergence peak (symbol code 234)
Draw space above left-hand bearish divergence peak (symbol code 32)


//M1;M5;M15;M30;H1;H4;D1;W1;MN1
extern string Chart.Arrow.shift_all_TF = "5;5;10;10;15;20;70;200;300";
extern string Chart.Line.shift_all_TF = "0;0;0;0;0;0;0;0;0";


Vertical offset of arrows and lines per timeframe, pips

extern int Chart.Line.style = STYLE_DOT;
extern int Chart.Line.width = 1;


Style and width of lines between 2 divergence peaks on chart window

extern int Ind.Line.style = STYLE_SOLID;
extern int Ind.Line.width = 1;


Style and width of lines between 2 divergence peaks on the indicator additional window


Allowed styles:

Constant; Value; Description
STYLE_SOLID; 0; The pen is solid.
STYLE_DASH; 1; The pen is dashed.
STYLE_DOT; 2; The pen is dotted.
STYLE_DASHDOT; 3; The pen has alternating dashes and dots.
STYLE_DASHDOTDOT; 4; The pen has alternating dashes and double dots.

Return to Forex Divergence Indicators Page