Hi,
I've writen an indicator with (init(), start() etc coding done). I would like to turn this indicator into a callable function by other module. How to do so?
The problem I have is few global variables are used in both init() and start(). If I change it as below:
int gval=8;
int init()
{
SetIndexDrawBegin(0,gval);
SetIndexDrawBegin(1,gval);
}
int start()
{
if (gval >= 40) gval = gval - 3; else gval = gval + 5; .....
}
So if I want that to be a function then I will change the start() as :
int start()
{
myfunc(20);
}
int myfunc(int gval)
{
if (gval >= 40) gval = gval - 3; else gval = gval + 5; .....
}
How to pass the parameter to init() ?
Regards,
Toyogo
I've writen an indicator with (init(), start() etc coding done). I would like to turn this indicator into a callable function by other module. How to do so?
The problem I have is few global variables are used in both init() and start(). If I change it as below:
int gval=8;
int init()
{
SetIndexDrawBegin(0,gval);
SetIndexDrawBegin(1,gval);
}
int start()
{
if (gval >= 40) gval = gval - 3; else gval = gval + 5; .....
}
So if I want that to be a function then I will change the start() as :
int start()
{
myfunc(20);
}
int myfunc(int gval)
{
if (gval >= 40) gval = gval - 3; else gval = gval + 5; .....
}
How to pass the parameter to init() ?
Regards,
Toyogo