call (int Event, void* Function, int P1, var P2)
Put a user-supplied function on a scheduler in order to to be exeuted at a certain event. Two parameters,
int and var, can optionally be passed to the
function.
Parameters:
| Event |
Run the function: 1 when the system is idle,
2 at the next incoming tick, 4 after
closing a trade, +16 repeat at any event. |
| Function |
Pointer to a script-defined function, with no, 1, or 2 parameters. |
| P1 |
int variable to be passed to the function as first
parameter, or 0 when the function has no parameters. |
| P2 |
var variable to be passed to the function as second
parameter, or 0 when the function has no second
parameter. |
event (int Event, void* Function): void*
Assign a user-supplied function to a particular event. Functions with the same
name as the event are automatically assigned at script start. Parameters:
| Event |
1 objective, 2
evaluate, 3
tick, 4 tock,
5 manage, 6
click, 7
neural, 8 bar, 9
callback, 10 parameters,
11 error, 12
cleanup. |
| Function |
Pointer to a script-defined function, or 0 for
disabling a previous event function. |
Returns:
Previously assigned event function.
Remarks:
- call(1, ...) can be used to prevent that the called
function interrupts other functions or I/O operations. This is useful f.i. for
changing the asset, entering
a trade, or
writing to a file in a click or
callback function.
- After the first run, Function normally removes itself from the scheduler.
If
16 was added to Event, the
function stays on the scheduler and keeps being called at the given event.
- Up to 16 functions can be placed on the scheduler at the same time. They
run in the order of their placement.
Example:
void calltest(int a,var b)
{
printf("\nCalled with (%i,%.2f) at bar %i",a,b,Bar);
}
void run()
{
...
call(1,calltest,2,3.45);
...
}
See also:
run, lock,
quit, version,
wait, click
► latest
version online