# ProRealTime documentation

Set a stop loss of x â‚¬,\$ (in the currency of the instrument).

Syntax:

``SET STOP \$LOSS x``

Example :

``````myMACD = MACD[12,26,9](close)
long = myMACD crosses over 0

IF NOT LongOnMarket AND long THEN
BUY 1 CONTRACTS AT MARKET
ENDIF

//set stop loss at 200\$ loss
SET STOP \$LOSS 200``````

Set a target profit of x â‚¬,\$ (in the currency of the instrument).

Syntax:

``SET TARGET \$PROFIT x``

Example :

``````myMACD = MACD[12,26,9](close)
long = myMACD crosses over 0

IF NOT LongOnMarket AND long THEN
BUY 1 CONTRACTS AT MARKET
ENDIF

//set profit target at 100\$
SET TARGET \$PROFIT 100``````

Set a trailing stop of x â‚¬,\$ (in the currency of the instrument).

Syntax:

``SET STOP \$TRAILING x``

Example:

We are setting here a trailing stop at 100\$ from the current average price

``````//indis
i1 = average(close)[100]
i2 = average(close)[5]

tradeinitiate = Close>i1 AND Close<i2 AND Low[3]>Low[2] AND Low[2]>Low[1] AND Low[1]>Low

IF NOT LongOnMarket AND tradeinitiate THEN
BUY 1 CONTRACTS AT MARKET
ENDIF

//set stop loss trailing at 100\$ from the current average price
SET STOP \$TRAILING 100``````

Set a stop loss x% from the average position price.

Note: the % loss is calculated and placed individually for each order with IG or PRT-CFD.

Syntax:

``SET STOP %LOSS x``

Example :

``````myMACD = MACD[12,26,9](close)
long = myMACD crosses over 0

IF NOT LongOnMarket AND long THEN
BUY 1 CONTRACTS AT MARKET
ENDIF

//set stop loss at 2% from the average position price
SET STOP %LOSS 2``````

Set a target profit x% from the average position price.

Note: the % profit is calculated and placed individually for each order with IG or PRT-CFD.

Syntax:

``SET TARGET %PROFIT x``

Example :

``````myMACD = MACD[12,26,9](close)
long = myMACD crosses over 0

IF NOT LongOnMarket AND long THEN
BUY 1 CONTRACTS AT MARKET
ENDIF

//set a target profit at 2% from the average position price
SET TARGET %PROFIT 2``````

Set a trailing stop x percent from average position price.

Syntax:

``SET STOP %TRAILING x``

ABS is the mathematical function “Absolute Value” of a number.

Example:

``````var1 = -12
var2 = 5

myresult = var1 / var2

myABSresult = ABS(var1 / var2)

RETURN myresult AS "not absolute value", myABSresult AS "absolute value"``````

Return values are :

``````myresult = -2.4

myABSresult = 2.4``````

AccumDistr is the classical Accumulation/Distribution indicator.

Use :

``AccumDistr(price)``

The accumulation/distribution of price is calculate that way :

``myAD = sum[volume*((Close-Low) - (High-Close)) / (High-Low)] ``

The indicator balances volumes using the closing price reported at the extreme points of the trading day.

It must confirm the stock trend in progress by moving in the same direction as the stock trend. A divergence between prices and Accumulation/Distribution is often a signal that the current trend may reverse. Continue reading “AccumDistr” »

Technical indicator Average Directionnal Index, usually known as ADX.

Calculation:

We first calculate +DM and -DM (the directional movement) , the number of points obtained in a direction. We apply a wilder moving average on +DM and -DM to calculate +DI and -DI. Then we calculate DX.

Dx = 100 x ((+DI) – (-DI)) / ((+DI) + (-DI)).

Finally to obtain ADX we apply again a wilder moving average on DX.

Syntax :

``````//N as Number of periods for calculation

ADX[N]
``````

Indicator Average Directional Index Rate, also known as “ADXR”. Compute with N periods :

``ADXR[N]``

ADXR formula : ADXR = (ADX + ADX[n]) / 2

Calculation of ADX :

We first calculate +DM and -DM (the directional movement) , the number of points obtained in a direction. We apply a wilder moving average on +DM and -DM to calculate +DI and -DI. Then we calculate DX.

Dx = 100 x ((+DI) â€“ (-DI)) / ((+DI) + (-DI)).

Finally to obtain ADX we apply again a wilder moving average on DX.

Top