MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Source code library - Expert Advisors, Indicators and Scripts

Dozens financial books in MetaTrader Market
To post a new code, please log in or register

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2013.08.02 19:27

DeMarker_HTF - indicator for MetaTrader 5

| English Russian Chinese Spanish Portuguese

votes: 18

Real author:



DeMark's Oscillator with an option of setting a fixed timeframe for the calculation of the indicator in the input parameters.

//| Indicator input parameters          |
input ENUM_TIMEFRAMES TimeFrame=PERIOD_H4; // Chart period
input uint DeMarker_Period=14;             // Averaging period
input int Shift=0;                         // Horizontal shift of the indicator in bars
This indicator was first implemented in MQL4 and published in Code Base at on 04.04.2008.


Figure 1. The DeMarker_HTF indicator

Figure 1. The DeMarker_HTF indicator

Translated from Russian by MetaQuotes Software Corp.
Original code:

Last comments | Go to discussion (1)
Sergey Golubev
newdigital | 25 Oct 2013 at 17:12


Indicators: DeMarker (DeM)

newdigital, 2013.09.20 13:17

DeMarker Indicator

The DeMarker indicator named after Thomas DeMark is a momentum oscillator very similar in nature to the Relative Strength Index (RSI) developed by Welles Wilder. By comparing inter-period price maxima and minima the DeMarker indicator attempts to gather information about price movements to help determine the underlying trend strength and identify over-bought/sold trade conditions. One of the main benefits of the DeMarker indicator like the RSI is that they are less prone to distortions seen in indicators such as the Rate of Change (ROC), which are introduced by erratic price movements at the start of the analysis window which can cause sudden shifts in the momentum line even when the current price is little changed.

The Default time span for the calculation of the DeMarker indicator is 14 periods. The overbought and oversold lines are typically drawn at 0.7 and 0.3, respectively. Longer time spans in the calculation will result in shallower swings in the oscillator and vice versa, accordingly traders may wish to construct narrower overbought and oversold lines for longer time periods. DeMarkers based on short time spans experience greater volatility and are more suitable for indicating overbought and oversold conditions, whereas longer time spans with more stable trajectories are better suited for constructing trend-lines and analyzing price patterns.

Trade Signals-Ranging Markets

Traders should look to go long when the DeMarker falls below 0.3 and rises back above it or where there is a bullish divergence with price where the first trough is below 0.3. Traders should look to go short when the DeMarker rises above 0.7 and falls back below it or where there is a bearish divergence with price where the first peak is above 0.70. Failure swings (see RSI for example of a failure swing) strengthen other signals. 

Trade Signals- Trending Markets

Traders should look to go long during an up-trend, when the DeMarker falls below 0.4 and rises back above it and go short in a down trend when the DeMarker rises above 0.6 and falls back below it. Traders may wish to take profit on divergences or exit using a trend indicator.  Traders should avoid selling/buying at overbought/oversold levels in strongly trending markets as subsequent periods of sideways trading can return the oscillator to more normal levels without any material favourable movement in the direction of the trade.