Watch how to download trading robots for free

Find us on Facebook!

Join our fan page

Access the CodeBase from your MetaTrader 5 terminal

Couldn't find the right code? Order it in the Freelance section

How to Write an Expert Advisor or an Indicator

Instantaneous Trend Line is one of the series of indicators created by John Ehlres.

This version of DeMarker indicator uses the "help" of smoothed Stochastic to emphasize the states of DeMarker and to help in easier trend assessment.

Balance of Power, introduced by Igor Livshin, attempts to measure the strength of buyers vs. sellers by assessing the ability of each to push price to an extreme level. Livshin published this indicator in the August 2001 issue of Stocks and Commodities Magazine. This version of indicator calculates the BOP exactly as it is described in the article where it was published.

T3 is very similar to EMA in calculating way and it makes it suitable for this way of calculation. As an extension of EMA levels it might prove to be useful but by all means do some experimenting in order to get the best results for specific symbol/timeframe combination.

A different way of looking at the fractals: instead of showing fractals the usual way, this indicator shows fractals as an oscillator and can show the "rhythm" of the changes in the market.

Balance of Market Power combined with DSL (Discontinued Signal Line) it can be used both for trending and scalping mode.

Chaos zone indicator that is a combination of two Bill Williams' indicators: Accelerator Oscillator and Awesome Oscillator.

Instead of being in a hurry to follow the price with the stop loss, this indicator is adjusting a proposed stop loss only when it notices a trend change in the opposite direction. That way, it keeps the level intact while trending, and adjusts it when it "sees" that there is a possible trend change) and gives bigger "room" for an order to survive possible whipsaws in trends. Also, since it is estimating a trend, this indicator displays the periods when there is a trend in different color(s) in order to make it easier to decided what to do.

The usual average that is used for stochastic calculation is simple Moving Average (SMA). This (extended) version allows you to use any of the 4 basic types of averages (default is SMA, but you can use EMA, SMMA or LWMA too) - some are "faster" then the default version (like EMA and LWMA versions) and SMMA is a bit "slower", but this way you can fine tune the "speed" to signals ratio.

The DSL (Discontinued Signal Line) version of Stochastic does not use a moving average in a classical way for signals, but is instead calculating the signal lines depending on the value(s) of the stochastic. Thus, we are having two things : a signal line and a sort of levels that can be used for overbought and oversold estimation.

The DSL version of Williams' Percent Range does not use fixed levels for oversold and overbought levels, but is having a sort of dynamic (discontinued signal lines) calculated to identify those levels. That makes it a bit more responsive to market changes and volatile markets.

This is a conversion of Kalman bands originally developed by Igor Durkin. Values are the same as MetaTrader 4 version except that we are using possibilities that MetaTrader 4 does not have to make the indicator easier to use.

Variation of a long known and useful MACD indicator using TEMA (Triple Exponential Moving Average) instead of using EMA (Exponential Moving Average) for MACD calculation, and DSL (Discontinued Signal Lines) and instead of using one signal line uses two.

Variation of a long known and useful MACD indicator using DEMA (Double Exponential Moving Average) instead of using EMA (Exponential Moving Average) for MACD calculation, and DSL (Discontinued Signal Lines) and instead of using one signal line uses two. That way it sort of introduces levels as well as signal lines and, judging from tests, it seems to be better in avoiding false signals and it can be used in (short term) reversals detection.

Stochastic and RVI (Relative Vigor Index) - both indicators measure overbought and oversold area of the market movement. This indicator combines them both in one single indicator - Stochastic of Relative Vigor Index.

Usually most brokers do not provide M1 data over 3 months in MetaTrader 4, but they provide M1 data over 3 years in MT5. So we can use this tool to obtain the M1 data in MetaTrader 5 tester and save the data into .hst file for MetaTrader 4 backtesting.

The Inverse Fisher Transform normalizes the values in the desired range (-1 to +1 in this case) which helps in assessing the overbought and oversold market conditions.

This indicator has an addition of Fisher Transform to the RVI. The Fisher Transform enables traders to create a nearly Gaussian probability density function by normalizing prices. In essence, the transformation makes peak swings relatively rare events and unambiguously identifies price reversals on a chart. The technical indicator is commonly used by traders looking for extremely timely signals rather than lagging indicators.

This version of Stochastic Oscillator allows you to use any of the 4 basic types of averages (default is SMA, but you can use EMA, SMMA or LWMA too) - some are "faster" then the default version (like EMA and LWMA versions) and SMMA is a bit "slower" but this way you can fine tune the "speed" to signals ratio.

This version is doing the calculation in the same way as the original Stochastic Momentum Index, except in one very important part: instead of using EMA (Exponential Moving Average) for calculation, it is using T3. That produces a smoother result without adding any lag.

The Stochastic Momentum Index (SMI) was developed by William Blau and was introduced in the January 1993 issue of Technical Analysis of Stocks & Commodities magazine. It incorporates an interesting twist on the popular Stochastic Oscillator. While the Stochastic Oscillator provides you with a value showing the distance the current close is relative to the recent x-period high/low range, the SMI shows you where the close is relative to the midpoint of the recent x-period high/low range.

The Efficiency Ratio (ER) was first presented by Perry Kaufman in his 1995 book "Smarter Trading". It is calculated by dividing the price change over a period by the absolute sum of the price movements that occurred to achieve that change. The resulting ratio ranges between 0 and 1 with higher values representing a more efficient or trending market.

The TTM (Trade The Markets) Trend is basically an easier way to look at candlesticks. It is the The Heikin-Ashi method. Literally translated Heikin is "average" or "balance,", while Ashi means "foot" or "bar." The TTM trend is a visual technique that eliminates the irregularities from a normal candlestick chart and offers a better picture of trends and consolidations.

MACD TEMA is even a bit more "faster" than MACD DEMA so, depending on the parameters, in scalping mode (short calculating periods) or trending mode (when longer periods are used. Never forget that MACD is primarily a momentum indicator and that it is the main goal of MACD.

The Kijun-Sen is a major indicator line and component of the Ichimoku Kinko Hyo indicator, also known as the Ichimoku cloud. It is generally used as a metric for medium-term momentum.

Commodity Channel Index (CCI) is a versatile indicator that can be used to identify a new trend or warn of extreme conditions. Donald Lambert originally developed CCI to identify cyclical turns in commodities, but the indicator can be successfully applied to indices, ETFs, stocks, and other securities.

The Volume Rate of Change indicator (VROC) measures the rate of change in volume over the past "n" sessions. In other words, the VROC measures the current volume by comparing it to the volume "n" periods or sessions ago.

A variation of Deviation Stops (DevStops) indicator. Some are wrongly calling this version a Kase DevStops (which it is not - Kase DevStops indicator is calculated in a quite different way), but this version has its good points too and can be used in regular support/resistance mode. Additionally each DevStop value is colored according to the slope (trend) of the line - when all are aligned in the same direction, it can be treated as a confirmed trend change.

Kase DevStops. What all of this boils down to is that we need to take variance and skew into consideration when we are establishing a system for setting stops. Three steps that we can take in order to both better define and to minimize the threshold of uncertainty in setting stops are: 1. Consideration of the variance or the standard deviation of range. 2. Consideration of the skew, or more simply, the amount at which range can spike in the opposite direction of the trend. 3. Reformation of our data to be more consistent (this step is examined in detail in Chapter 81, while minimizing the degree of uncertainty as much as possible).

Smoothed Rate of Change (Smoothed-RoC) is a refinement of Rate of Change (RoC) indicator that was developed by Fred G Schutzman. It differs from the RoC in that it based on Exponential Moving Averages (EMAs) rather than on price closes. Like the RoC, Smoothed RoC is a leading Momentum indicator that can be used to determine the strength of a trend by determining if the trend is accelerating or decelerating. The Smoothed RoC does this by comparing the current EMA to value that the EMA was a specified periods ago. The use of EMAs rather than the price close eliminates the erratic tendencies of the RoC.

The Percentage Price Oscillator Extended (PPO) is a technical Momentum indicator showing the relationship between two Moving Averages. To calculate the PPO, subtract the 26-day Exponential Moving Average (EMA) from the nine-day EMA, and then divide this difference by the 26-day EMA. The end result is a percentage that tells the trader where the short-term average is relative to the longer-term average.

The Percentage Price Oscillator (PPO) is a technical Momentum indicator showing the relationship between two Moving Averages. To calculate the PPO, subtract the 26-day Exponential Moving Average (EMA) from the nine-day EMA, and then divide this difference by the 26-day EMA. The end result is a percentage that tells the trader where the short-term average is relative to the longer-term average.

Woodies CCI is a momentum indicator that was developed by Ken Woods. It's based on a 14 period Commodity Channel Index (CCI).

Probability levels based on ATR. "Probability" is calculated based on the projected Average True Range and previous period Close.

HOPS and LOPS indicator. The "HOPS" and "LOPS" stand for High Of the Previous Session and Low Of the Previous Sessions.

This is an MQL5 version of the Expert Advisor described in the article "How to reduce trader's risks" (https://www.mql5.com/en/articles/4233).