call (int Mode, void* Function, int P1, var P2)
Put a 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:
Mode |
Run the function: 1 when the system is idle,
2 at the next incoming tick, 4 after
closing a trade, +16 for repeating. |
Function |
Pointer to a script-defined function. |
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. |
Remarks:
- Function can be a function either with no parameters
f(), with one f(int), or with two
parameters f(int,var). Automatic int/var
conversion will not take place here, so make sure that the first parameter
(if any) of the function is really a int or global pointer, and
the second parameter (if any) is really a var.
- 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 being run, Function normally removes itself from the scheduler.
If
16 was added to Mode, 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
are then 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