# Signal

## Description

The Signal function allows the simulation of opening/closing buy or sell orders to test the effectiveness of an indicator by measuring the gain or loss in pips and displays it on a chart in MT4.

## Syntax

${\displaystyle fx=BT\_SIGNAL(indicator,timestamp,value)}$

## Inputs

indicator
Identifies the BT_Signal ID in MT4 which the function will connect to. Unless changed in MT4 the ID will be "myindicator" by default.

timestamp
The timestamp of the candle where the trade is simulated.

value
These commands will mimick a buy or sell order based on your signal triggers.
Supported values: 0 (no change), 1 (open buy), 2 (close buy), 3 (close buy, open sell), -1 (open sell), -2 (close sell), -3 (close sell, open buy).

## Outputs

Posted
Function successfully connected to MT4.

## Example Usage

To use the Signal function correctly it is necessary to have a signal trigger in place which will condition the values used in the function.
To start we will first call in a candle list of a desired timeframed (in our case H1):

Next we make an indicator using the candles (in our case we will use the BT included indicator BT_I_MACD(12,26,9)):

Then we create a signal trigger which will display our values based on the indicator movements (in our case we will mimick an "open buy, close sell" everytime there is a negative positive convergence; and "open sell, close buy" everytime there is a positive negative convergence):

After that write the Signal function and make a cell reference to the timestamp and signal trigger:

Finally we drag down our signal trigger and Signal function down to as many candles we want:

To display the information on MT4, click start in your strategy tester and then drag the BT_Signal indicator from the indicator list to your chart:

## Example Calculations

indicator timestamp value RESULT
"myindicator" "8/21/2015 15:00" "1" It will simulate opening a buy order at the 8/21/2015 15:00 timestamp.
"myindicator" "1/15/2015 12:00" "-1" It will simulate opening a sell order at the 1/15/2015 12:00 timestamp.