Slawa, returning from start() function

 
Hi Slawa,

I am curious to know what will happen if I would not return from start() function and was waiting until next tick or a timeout.

The purpose is that there are gaps between ticks and I would like to Open my order as close as possible before new tick.

So if new tick would start at, lets say, 00:45, I would like to open my order at tick 00:44.

However, the tick 00:44 may be missing so may the tick 00:45.

Therefore, I would like to set a (watch dog) timer around tick 00:40 and wait until timeout of 00:44 and then open my order in what ever conditions woul be at that time.

Whould this shceme work as far as MT4 call to start() is concerned.
In otherwords, must I return from start() before MT4 initiates next tick call to start().

Or is there a mechanism where MT4 would provide clock like ticks and would keep bringing last data over and over during the gap period.
 
use script with endless loop and time checking
 
use script with endless loop and time checking

Is a sample of such script available at MQ ?
 
for instance Period_converter part 2
 
for instance Period_converter part 2

Since I have not done anything with scripts yet I have gray area in interfacing scrip to indicator and script to expert and so on.
So are you suggesting that I can somehow trigger my indicator from the script or are you suggesting that it should be done in the script?
OK so now it is in the script how am I gone open order from script to expert?
How am I gone display it in the indicator window?
Can I put indicators in the script?
 
just try it
 
just try it

How do I call an indicator from script?
Do I use iCustom?
 
of course. scripts are like experts. however expert runs with every incoming tick.
 
of course. scripts are like experts. however expert runs with every incoming tick.

Slawa,
I am running Windows 98SE, noting in background only MT4, It is fairly fast PC.
The script I am running has following code:
int start()
{
Print("Script START");
while(true)
     {
     if(Sec!=TimeSeconds(CurTime()))
         {
         Sec=TimeSeconds(CurTime());
         Print("Sec=",Sec);
         }
     }
//----
return(0);
}


There are no ticks coming, everything is quiet.
I am concern that the following timing results are as unpredictable as the gaps between the ticks.
Is it my PC or is it the MT4 or am I doing something wrong?
I would expect clean 1 sec. clock.

2005.12.21 18:07:56	merlim4t EURUSD,M5: Sec=0
2005.12.21 18:07:54	merlim4t EURUSD,M5: Sec=59
2005.12.21 18:07:53	merlim4t EURUSD,M5: Sec=57
2005.12.21 18:07:50	merlim4t EURUSD,M5: Sec=55
2005.12.21 18:07:49	merlim4t EURUSD,M5: Sec=54
2005.12.21 18:07:45	merlim4t EURUSD,M5: Sec=49
2005.12.21 18:07:43	merlim4t EURUSD,M5: Sec=48
2005.12.21 18:07:43	merlim4t EURUSD,M5: Sec=47
2005.12.21 18:07:34	merlim4t EURUSD,M5: Sec=39
2005.12.21 18:07:34	merlim4t EURUSD,M5: Sec=38
2005.12.21 18:07:32	merlim4t EURUSD,M5: Sec=36
2005.12.21 18:07:23	merlim4t EURUSD,M5: Sec=28
2005.12.21 18:07:20	merlim4t EURUSD,M5: Sec=25
2005.12.21 18:07:10	merlim4t EURUSD,M5: Sec=15
2005.12.21 18:07:09	merlim4t EURUSD,M5: Sec=13
2005.12.21 18:07:02	merlim4t EURUSD,M5: Sec=6
2005.12.21 18:06:57	merlim4t EURUSD,M5: Sec=2
2005.12.21 18:06:55	merlim4t EURUSD,M5: Sec=0
 
OK Slawa, I can now see why.
The CurTime() is from server so LocalTime() offset by CurTime() is what I am looking for.
Reason: