AlertIf
|
Trading system toolbox |
SYNTAX | AlertIf( BOOLEAN_EXPRESSION, command, text, type = 0, flags = 1+2+4+8, lookback = 1 ); |
RETURNS | nothing |
FUNCTION |
Triggers alert action if BOOLEAN_EXPRESSION is true.
1. BOOLEAN_EXPRESSION is the expression that if evaluates to True (non zero value) triggers the alert. If it evaluates to False (zero value) no alert is triggered. Please note that only lookback most recent bars are considered. 2. The command string defines the action taken when alert is triggered.
If it is empty the alert text is simply displayed in the Alert
output window (View->Alert Output). Other supported values of command
string are:
SOUND command plays the WAV file once. 3. Text defines the text that will be printed in the output window or sent via e-mail or added as argument to the application specified by EXEC command 4. Type defines type of the alert. Pre-defined types are 0 - default, 1 - buy, 2 - sell, 3 - short, 4- cover. YOu may specify higher values and they will get name "other" 5. Flags control behaviour of AlertIF function. This field
is a combination (sum) of the following values: 6. lookback parameter controls how many recent bars are checked IMPORTANT: AlertIf is not mindless function, it contains internal logic (aka. finite state machine). For full understanding how AlertIf function works and how to use it, you need to read Tutorial: Using formula-based alerts. |
EXAMPLE |
Buy = Cross( MACD(), Signal() );
Note EXEC command uses ShellExecute function and allows not only EXE files but URLs too. |
SEE ALSO |
The AlertIf function is used in the following formulas in AFL on-line library:
See updated/extended version on-line.