Custom symbols. Errors, bugs, questions, suggestions. - page 25

 
jaffer wilson:

This does not work on my side.

These are my MT5 version details.


Try changing the system time error.

//+------------------------------------------------------------------+
//|                                           SpeedupSystemTimer.mq5 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property description "Уменьшает погрешность системного таймера до 1 ms"

#import "winmm.dll"
   int timeBeginPeriod(uint per);
#import

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
void OnInit()
{
   timeBeginPeriod(1);
}

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnTick()
{
   ExpertRemove();
}
//+------------------------------------------------------------------+
 
Roman :


Try changing the system time error.

I have tried. Please check the file. And the video. You will find out. Even I ask the moderator to see the attached file.

The same thing happens with the custom character.

Files:
 
jaffer wilson:

I tried. Please check the file. And the video. You will find out. Even I ask the moderator to see the attached file.

The same thing happens with the custom character.

Read in documentation about TimeCurrent()

 
Roman :

Read in the documentation about TimeCurrent()

I assume you haven't run the file. Please, you can run it once on your side. My program uses TimeCurrent () to get the current time when the seconds become zero or less. This will call the SetTime () function.

Then if the remaining time is 50 seconds, then it won't check TimeCurrent (), it will decrease the seconds. I think this should be visible when OnTimer () is called. But it is not visible. Please check it once.

 
jaffer wilson:

I assume you have not run the file. Please, you can run it once on your side. My program uses TimeCurrent () to get the current time when the seconds become zero or less. This will call the SetTime () function.

Then if the remaining time is 50 seconds, then it won't check TimeCurrent (), it will decrease the seconds. I think this should be visible when OnTimer () is called. But it is not visible. Please check it once.

I have run your file, but the handlers in your code have been prioritised.
The two indicators work almost identically, given the specifics of TimeCurrent()


Added.
I'd better draw developers attention to OnTimer() delay from this post.

Files:
 
Roman:

I would rather draw the developers' attention to the OnTimer() delay from this post.

Timer accuracy to milliseconds is not guaranteed. And will not be guaranteed due to hardware limitations.
 
Roman:

I would rather draw the developers' attention to the OnTimer() delay from this post.

16 milliseconds is the accuracy of anything with milliseconds in it. This has already been discussed somewhere.
With microseconds the accuracy is ok, but the speed is slower.
 
Nikolai Semko:
16 milliseconds is the accuracy of anything with milliseconds in it. This has already been discussed somewhere.
With microseconds the accuracy is fine, but the speed is slower.

It is clear that the system accuracy is ~16 milliseconds.
In the example it was set higher than 16, EventSetMillisecondTimer(20);
That is the OnTimer() handler, runs in increments of 20 milliseconds.
But the counter which is displayed in the comment seems to hang for several milliseconds.
I do not know why - either handler OnTimer() slows down or the queue of chart events processing.

 
Roman:

It is clear that the system accuracy is ~16 milliseconds.
In the example it was set higher than 16, EventSetMillisecondTimer(20);
That is the OnTimer() handler, runs in increments of 20 milliseconds.
But the counter which is displayed in the comment seems to hang for several milliseconds.
I do not know why - either handler OnTimer() slows down or the queue of chart events processing.

Found

Forum on trading, automated trading systems and trading strategy testing

How to create a function to process every millisecond?

Nikolai Semko, 2018.09.13 04:45

Yes, that's the way it is. (only not frequency, but period. Maximum frequency = 64 Hz)

Just to add a clarification:

The period step for the timer = 15.625 milliseconds.

I.e. with EventSetMillisecondTimer(1) command and with EventSetMillisecondTimer(10) command the real period will be 15.625 ms.

with the EventSetMillisecondTimer(21) command and with the EventSetMillisecondTimer(30) command the actual period will be 31.25 ms.

With the EventSetMillisecondTimer(95) command and the EventSetMillisecondTimer(105) command, the actual period will be 109.375 ms.

etc.

GetTickCount() changes every 1/(2^6)=1/64 seconds (15625 microseconds).
 
Nikolai Semko:

found

GetTickCount() value changes every 1/(2^6)=1/64 seconds (15625 microseconds).

Thanks, now I see what the reason is.
System timer step change, still a multiple of 15.625

Added.
But I changed the period of system timer win api function timeBeginPeriod(1)
i.e. in idea the system timer is now incremented to 1 millisecond.
And the system timer step should be 1 millisecond, right?
Why does the counter in the comment still freeze?