Do not double post.
I have deleted your other topic.
void OnStart() { // Get # of seconds since epoch int seconds = (int) TimeCurrent(); // Loop for 4 seconds while ( TimeCurrent() < seconds + 4 ) { // Do stuff within 4 seconds PrintFormat("Count [%d]", TimeCurrent() - seconds); } // Done with 4 second loop Print("All done"); }
Do not double post.
I have deleted your other topic.
Sorry for the inconvenience. I have tried to delete the other one. I couldn't find a option to delete it.
Thanks Anthony. Can I know one thin if I wrote a trailing SL between 4 sec it will be trailed only for 4 seconds. is it ?
Thanks Anthony. Can I know one thin if I wrote a trailing SL between 4 sec it will be trailed only for 4 seconds. is it ?
You could build a 4 second limiter this way, but I would probably would not use a loop.
I would probably use a static variable in OnTick() to see when 4 seconds had elapsed.
It's hard to say without seeing your Trailing SL code.
You could build a 4 second limiter this way, but I would probably would not use a loop.
I would probably use a static variable in OnTick() to see when 4 seconds had elapsed.
It's hard to say without seeing your Trailing SL code.
Thanks Anthony. It's running perfectly.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please someone can help me following code......?
int TimeNow=TimeSeconds(TimeCurrent());
for (int B=0; B<5; B=B+TimeNow)
{
///Code...........
}
Since time has been converted to int it won't be seconds anymore I guess. How can run the loop for 4 seconds or expire after 4 seconds....?