Functions - indicators Universal

6 September 2018, 11:32
Yurij Kozhevnikov
0
143

RU

The series of indicators Universal works according to user formulas.


Main windowSeparate window
Free
MT4 Universal Main Window Free
MT5 Universal Main Window Free MT5
MT4 Universal Separate Window Free
MT5 Universal Separate Window Free MT5
Full
MT4 Universal Main Window
MT5 Universal Main Window MT5
MT4 Universal Separate Window
MT5 Universal Separate Window MT5

Functions

Contents

If in the calculation process one of the functions returned the absence of a value, the result of the entire formula will also be the absence of a value.

Constants

FunctionValueDescriptionExamples

Pi()

3.14159265 The number "pi" - the ratio of a circle's circumference to its diameter.
2 + 3 * PI()
(3 - pi()) ^ 3
E()2.71828183 The number «e» is the basis for the natural logarithm.
2 ^ E()
(3 + e()) * 5

Contents

Mathematical

FunctionArgumentsDescriptionExamples
Abs(a) a - any number or expression. Returns the value of the argument modulo.
2.21 + ABS(E() - PI())
abs(2 - 5) ^ (1 / 2)
Max(a1, a2, a3, ...) Any number of arguments must be more than one of the numbers or expressions. Returns the value of the largest of the arguments passed.
2.21 - MAX(E() * 3, PI() * 2)
max(pi(), 3.14, 3.141) - 3.14
Min(a1, a2, a3, ...) Any number of arguments must be more than one of the numbers or expressions. Returns the value of the smallest of the arguments passed.
2.21 - MIN(E() * 3, PI() * 2)
min(pi(), 3.14, 3.141) - 3.14
Mod(a1, a2) a1 - dividend;
a2 - divider.
Returns the remainder of the division of two numbers.
4.71 - MOD(E() * 3, 2)
mod(pi(), 3) - 3
Log(a1, a2) a1 - a positive number or expression;
a2 - a positive number or expression that is not equal to 1.
Returns the value of the logarithm of the first argument a1 to the base of the second argument a2.
PI() * LOG(PI(), E()) + 1
log(pi(), 10) - 3
Round(a, n)

Round(a)
a - any number or expression;
n - any integer or expression.
Returns the rounded value of the first argument a to n decimal places. In the case where n is zero or absent, rounding to integer. In the case of negative n rounding is made to the left of the decimal point.
For example, Round(3579.256, -2) = 3600
ROUND(PI(), 1) - Round(PI())
round(10 ^ pi()) - 1385
Average(a1, a2, a3, ...) Any number of arguments must be more than one of the numbers or expressions. Returns the average of all the transmitted values.
AVERAGE(PI(), E()) - 2.93
3 - average(1, 2, 3, 4, 5)

Sin(a)

a - any number or expression. The sine of angle a, given in radians.
SIN(90 * PI() / 180) - 1
0.5 - sin(30 * pi() / 180)
Cos(a) a - any number or expression. The cosine of the angle a, given in radians.
SIN(PI()) + COS(90 * PI() / 180)
sin(pi() / 2) - cos(0)
Tan(a)

Tg(a)
a - any number or expression not equal to N * pi / 2, wherein N - any odd integer. The tangent of the angle agiven in radians. In cases where the cosine of a given angle is zero, the function returns no value.
SIN(PI()) / COS(PI()) - TAN(PI())
tan(2) - 1 / tg(2)
ArcSin(a)

ASin(a)
a - any number or expression from -1 to 1. The arcsine of a in radians. If a is less than -1 or greater than 1, the function returns no value.
ARCSIN(0.9) * 180 / PI()
asin(-0.99) + 1.42
ArcCos(a)

ACos(a)
a - any number or expression from -1 to 1. The arccosine of a in radians. If a is less than -1 or greater than 1, the function returns no value.
ARCSIN(1) - ARCCOS(1)
acos(0) * 180 / pi()
ArcTan(a)

ArcTg(a)

ATan(a)

ATg(a)
a - any number or expression. The arctangent of a in radians.
ARCTAN(1) - 1 / ARCTG(1)
atan(1) * 180 / pi() - 45 + atg(10)

Contents

Logical (only in full version)

FunctionArgumentsDescriptionExamples
If(a, b, c) a - a logical expression;
b - a number or an expression that returns a function, if the expression a is a true;
c - a number or an expression that returns a function, if the expression a is a false.
Returns the value of the expression b if the expression a is true or the value of the expression c, if the expression a is false.
If the expression a is true, then the value of the expression c is not evaluated. If expression a is false, then the value of expression b is not evaluated.
IF( Close(0) > Close(1) ,Close(0) ,Close(1) )
if (high(0)>high(1),1,if (low(0)<low(1),-1,0))
And(a1, a2, a3, ...) Any number of logical expressions must be more than one. Returns True if all passed arguments are True.
If the value of the next argument is False, then all subsequent expressions are not evaluated.
IF( And(Close(0) > Close(1),Close(0) > Close(2)) ,Close(0) ,Close(1) )
if (and(high(0)>high(1),high(0)>high(2)),1,if (and(low(0)<low(1),low(0)<low(2)),-1,0))
Or(a1, a2, a3, ...) Any number of logical expressions must be more than one. Returns True if at least one passed argument is True.
If the value of the next argument is True, then all subsequent expressions are not evaluated.
IF( OR(Close(0) > Close(1),Close(0) > Close(2)) ,Close(0) ,Close(1) )
if (or(high(0)>high(1),high(0)>high(2)),1,if (or(low(0)<low(1),low(0)<low(2)),-1,0))
Not(a) a - a logical expression. Returns the value True if the value of the expression a is a False.
Returns the value False if the value of the expression a is a True.
IF( Not(And(Close(0) > Close(1),Close(0) > Close(2))) ,Close(1) ,Close(0) )
if (not(or(high(0)>high(1),high(0)>high(2))),-1,if (not(or(low(0)<low(1),low(0)<low(2))),1,0))

Contents

Information about the prices

The only argument of the functions for obtaining information about the price is bar number. The current bar always has the number 0, the previous bar has a number 1 and so on.
FunctionDescriptionExamples
Open(bar) Returns the opening price of the specified bar.
AVERAGE(OPEN(1), OPEN(2), OPEN(3))
(open(1) + open(2) + open(3)) / 3
Close(bar) Returns the closing price of the specified bar.
AVERAGE(CLOSE(1), CLOSE(2), CLOSE(2))
(close(1) + 2 * close(2)) / 3
High(bar) Returns the maximum price of the specified bar.
MAX(HIGH(0), HIGH(1), HIGH(2))
open(0) + high(0) - close(0)
Low(bar) Returns the minimum price of the specified bar.
AVERAGE(MIN(HIGH(0), HIGH(1), HIGH(2)),MAX(LOW(0), LOW(1), LOW(2)))
high(0) - (open(0) - low(0))

Contents

Information from standard indicators

The last argument of the functions for obtaining information from standard indicators is the bar number. In case the indicator draws several lines, the penultimate argument is always the line number.
Valid values for some arguments are
applied 0 - Close
1 - Open
2 - High
3 - Low
4 - Median (High+Low)/2
5 - Typical (High+Low+Close)/3
6 - Weighted (Hgh+Low+2*Close)/4
method 0 - Simple
1 - Exponential
2 - Smoothed
3 - Linear Weighted
volume 0 - Tick Volume
1 - Real Volume
Some indicators in different platforms have different arguments. For the sake of compatibility of formulas for both platforms in functions that return the values of such indicators, extra arguments are ignored, and the missing ones are substituted with the default value.
IndicatorFunctionArgumentsExamples
Accelerator/Decelerator Oscillator MT4 AccelDecel(bar)

AC(bar)
bar - the bar number.
CLOSE(0) + AC(1)
(AC(3) + 2 * AC(2) + 3 * AC(1) + AC(0)) / 7
MT5
Accumulation/Distribution MT4 AccumDistr(bar)

AD(bar)
bar - the bar number.
When used in MT5, the value of Tick Volume is substituted for the required argument volume.
HIGH(0) +( AD(0) - AD(1)) / 1 000 0000
average( ad(1) - ad(0), ad(2) - ad(1) )
MT5 AccumDistr(volume, bar)

AD(volume, bar)
volume - the volume type;
bar - the bar number.
When used in MT4, the argument volume is ignored.
HIGH(0,0) +( AD(0,0) - AD(0,1)) / 1 000 0000
average( ad(0,1) - ad(0,0), ad(0,2) - ad(0,1) )
Average Directional Movement Index MT4 AverDirectMovemInd(period, applied, num, bar)

ADM(period, applied, num, bar)
period - averaging period;
applied - used price;
num - line number:
0 - the main line
1 - + DI
2 - -DI;
bar - the bar number.
When used in MT5, the argument applied is ignored.
high(0) + (50 - adm(14, 0, 0, 0)) / 1000
Average(adm(14, 0, 0, 0), adm(14, 0, 1, 0), adm(14, 0, 2, 0))
MT5 AverDirectMovemInd(period, num, bar)

ADM(period, num, bar)
period - averaging period;
num - line number:
0 - the main line
1 - + DI
2 - -DI;
bar - the bar number.
When used in MT4, the value of Close is substituted for the required argument applied.
high(0) + (50 - adm(14, 0, 0)) / 1000
Average(adm(14, 0, 0), adm(14, 1, 0), adm(14, 2, 0))
Average True Range MT4 AverTrueRange(period, bar)

ATR(period, bar)
period - averaging period;
bar - the bar number.
Open(1) + atr(14, 1)
atr(14, 0) + (Max(atr(14, 1), atr(14, 2), atr(14, 3))- Min(atr(14, 1), atr(14, 2), atr(14, 3)))
MT5
Awesome Oscillator MT4 AwesOsc(bar)

AO(bar)
bar - the bar number.
Low(0) + AO(2)
max(ao(0), ao(1), ao(2)) + min(ao(0), ao(1), ao(2)) - average(ao(3), ao(4), ao(5))
MT5
Contents
Bears Power MT4 BearsPower(period, applied, bar)

BearP(period, applied, bar)
period - averaging period;
applied - used price;
bar - the bar number.
When used in MT5, the argument applied is ignored.
Close(1) + BearP(14, 0, 1) - BearP(14, 1, 1)
cos(BearP(14, 1, 0))
MT5 BearsPower(period, bar)

BearP(period, bar)
period - averaging period;
bar - the bar number.
When used in MT4, the value of Close is substituted for the required argument applied.
Close(1) + BearP(14, 1) - BearP(14, 2)
cos(BearP(14, 0))
Bulls Power MT4 BullsPower(period, applied, bar)

BullP(period, applied, bar)
period - averaging period;
applied - used price;
bar - the bar number.
When used in MT5, the argument applied is ignored.
Close(1) + BearP(14, 0, 1) - BullP(14, 0, 1)
BearP(14, 0, 0) + BullP(14, 0, 0)
MT5 BullsPower(period, bar)

BullP(period, bar)
period - averaging period;
bar - the bar number.
When used in MT4, the value of Close is substituted for the required argument applied.
Close(1) + BearP(14, 1) - BullP(14, 1)
BearP(14, 0) + BullP(14, 0)
Bollinger Bands® MT4 BollingerBands(period, deviation, applied, num, bar)

BB(period, deviation, applied, num, bar)
period - averaging period;
deviation - deviations;
applied - used price;
num - line number:
0 - the main line
1 - Upper
2 - Lower;
bar - the bar number.
average(BB(50, 2.1, 0, 0, 0), BB(55, 2.1, 0, 0, 0))
BB(50, 2.1, 0, 1, 0) - BB(50, 2.1, 0, 2, 0)
MT5
Commodity Channel Index MT4 CommChIndex(period, applied, bar)

CCI(period, applied, bar)
period - averaging period;
applied - used price;
bar - the bar number.
Close(0) + CCI(14, 5, 0) / 1000
Average(cci(14, 0, 0), cci(14, 1, 0), cci(14, 2, 0), cci(14, 3, 0), cci(14, 4, 0), cci(14, 5, 0), cci(14, 6, 0))
MT5
DeMarker MT4 DeMarker(period, bar)

DM(period, bar)
period - averaging period;
bar - the bar number.
Average(High(0) + DM(30, 0), Low(0) - DM(50, 0))
Max(dm(14, 0), dm(14, 1), dm(14, 2)) - Min(dm(14, 0), dm(14, 1), dm(14, 2))
MT5
Contents
Envelopes MT4 Envelopes(period, method, applied, deviation, num, bar)

Env(period, method, applied, deviation, num, bar)
period - averaging period;
method - MA method;
applied - used price;
deviation - percentage deviation;
num - line number:
0 - the main line
1 - Upper
2 - Lower;
bar - the bar number.
Env(50, 0, 0, 0.2, 1, 0) + high(0) - low(0)
Env(50, 0, 0, 0.2, 1, 0) - Close(0)
MT5
Force Index MT4 ForceIndex(period, method, applied, bar)

FI(period, method, applied, bar)
period - averaging period;
method - MA method;
applied - used price;
bar - the bar number.
When used in MT5, the argument applied is ignored, and the value of Tick Volume is substituted for the required argument volume.
CLOSE(0) + MIN(FI(13,0,0,0), FI(13,0,0,1)) / MAX(FI(13,0,0,0), FI(13,0,0,1)) / 500
average(fi(13,0,0,0), fi(13,0,0,1), fi(13,0,0,2))
MT5 ForceIndex5(period, method, volume, bar)

FI5(period, method, volume, bar)
period - averaging period;
method - MA method;
volume - the volume type;
bar - the bar number.
When used in MT5, the argument volume is ignored, and the value of Close is substituted for the required argument applied.
CLOSE(0) + MIN(FI5(13,0,0,0), FI5(13,0,0,1)) / MAX(FI5(13,0,0,0), FI5(13,0,0,1)) / 500
average(fi5(13,0,0,0), fi5(13,0,0,1), fi5(13,0,0,2))
Market Facilitation Index MT4 MarkFacInd(bar)

MaFI(bar)
bar - the bar number.
When used in MT5, the value of Tick Volume is substituted for the required argument volume.
Close(0) + MaFI(0) - MaFI(1)
mafi(0) + mafi(1) - (mafi(2) + mafi(3))
MT5 MarkFacInd(volume, bar)

MaFI(volume, bar)
volume - the volume type;
bar - the bar number.
When used in MT4, the argument volume is ignored.
Close(0) + MaFI(0, 0) - MaFI(0, 1)
mafi(0, 0) + mafi(0, 1) - (mafi(0, 2) + mafi(0, 3))
Money Flow Index MT4 MoneyFlowIndex(period, bar)

MoFI(period, bar)
period - averaging period;
bar - the bar number.
When used in MT4, the value of Tick Volume is substituted for the required argument volume.
Close(0) * (1 + (MoFI(14, 0) - 50) / 1000)
100 - mofi(14, 0)
MT5 MoneyFlowIndex(period, volume, bar)

MoFI(period, volume, bar)
period - averaging period;
volume - the volume type;
bar - the bar number.
When used in MT4, the argument volume is ignored.
Close(0) * (1 + (MoFI(14, 0, 0) - 50) / 1000)
100 - mofi(14, 0, 0)
Moving Average MT4 MovingAverage(period, method, applied, bar)

MA(period, method, applied, bar)
period - averaging period;
method - MA method;
applied - used price;
bar - the bar number.
Close(0) + MA(50, 0, 0, 0) - MA(20, 0, 0, 0)
log(MA(50, 0, 0, 0) - MA(20, 0, 0, 0), 10)
MT5
Contents
Moving Average Convergence/Divergence MT4 MovingAverageConvDiv(FastPeriod, SlowPeriod, SignalPeriod, applied, num, bar)

MACD(FastPeriod, SlowPeriod, SignalPeriod, applied, num, bar)
FastPeriod - fast EMA;
SlowPeriod - slow EMA;
SignalPeriod - MACD SMA;
applied - used price;
num - line number:
0 - the main line
1 - Signal;
bar - the bar number.
High(0) + MACD(12, 26, 9, 0, 1, 0)
MACD(12, 26, 9, 0, 1, 0) - MACD(12, 26, 9, 0, 0, 0)
MT5
Moving Average of Oscillator MT4 MovingAverageOsc(FastPeriod, SlowPeriod, SignalPeriod, applied, bar)

MAO(FastPeriod, SlowPeriod, SignalPeriod, applied, bar)
FastPeriod - fast EMA;
SlowPeriod - slow EMA;
SignalPeriod - MACD SMA;
applied - used price;
bar - the bar number.
Close(0) + 2 * Sin(MAO(12, 26, 9, 0, 0))
log(abs(mao(12, 26, 9, 0, 0)), e())
MT5
Relative Strength Index MT4 RelStrInd(period, applied, bar)

RSI(period, applied, bar)
period - averaging period;
applied - used price;
bar - the bar number.
High(2) * (1 + (RSI(14, 0, 1)  - 50) / 1000)
100 * rsi(14, 0, 0) / max(rsi(14, 0, 0), rsi(14, 0, 1), rsi(14, 0, 2))
MT5
Relative Vigor Index MT4 RelVigInd(period, num, bar)

RVI(period, num, bar)
period - averaging period;
num - line number:
0 - the main line
1 - Signal;
bar - the bar number.
Close(0) + RVI(10, 1, 0) * (High(0) - Low(0))
rvi(10, 1, 0) - rvi(10, 0, 0)
MT5
Standard Deviation MT4 StandDev(period, method, applied, bar)

SD(period, method, applied, bar)
period - averaging period;
method - MA method;
applied - used price;
bar - the bar number.
Low(0)  + Tan(SD(10, 0, 0, 0))
sd(10, 0, 0, 0) - max(sd(10, 0, 0, 1), sd(10, 0, 0, 2), sd(10, 0, 0, 3))
MT5
Contents
Stochastic Oscillator MT4 StochOsc(Kperiod, Dperiod, slowing, method, price, num, bar)

SO(Kperiod, Dperiod, slowing, method, price, num, bar)
Kperiod - K period;
Dperiod - D period;
slowing - slowing;
method - MA method;
price - price field:
0 - Low/High
1 - Close/Close;
num - line number:
0 - the main line
1 - Signal;
bar - the bar number.
Close(1) * (1 + (SO(5, 3, 3, 0, 0, 1, 1)  - 50) / 3000)
mod(so(5, 3, 3, 0, 0, 1, 1), so(5, 3, 3, 0, 0, 1, 0))
MT5
Williams' Percent Range MT4 WillPercRange(period, bar)

WPR(period, bar)
period - averaging period;
bar - the bar number.
Close(1) * (1 - (WPR(14, 1) + 50) / 1000)
wpr(50, 0) - wpr(14, 0)
MT5

Contents

Ranges

There are situations when you need to get the minimum, maximum or average value of a large number of arguments. The formula indicating the ranges of arguments will help to shorten the formula. You can apply ranges of arguments in functions that return price values ​​and standard indicators.
The range is indicated by integers, between which is the colon character.
Specifying ranges using expressions is not allowed.
A function in which one of the arguments is specified by a range of values ​​should not have a function as other arguments.
Example:
max(close(0:3))
is equivalent
max(close(0), close(1), close(2), close(3))

Contents

Arrow codes

Arrow codes

Contents


Share it with friends: