How can the Start( ) function be triggered by a certain period of time rather than a new coming tick?
If you want a purely time-based activation, you would be better off putting your code into a Script and loop with the Sleep function.
No new tick means nothing has changed, so what are you trying to achieve?
void runEveryTenSeconds() {Assuming start() is run every tick, runEveryTenSeconds() will run once every 10 second time period (assuming ticks are coming in). This method should suffice for most usages.
static int timer = 0;
if (timer + 10 < Seconds()) return;
timer = Seconds();
.. Do stuff
}
void start() {
runEveryTenSeconds();
}
int start(){ while ( !IsStopped()){ ...run your code... Sleep(10000); } return(0); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
How can the Start( ) function be triggered by a certain period of time rather than a new coming tick?
For instance, a time of 10 seconds.
Can any one with kindness help me?
Or More precisely, how can I perform a function(instead of Start( )) recurrsively triggered by a certain period of time?