How to make MT4 auto refresh - page 2

 

Autorefresh for new metatrader

Files:
 

Autorefresh that works based on timer not based on ticks (it will work even when there are not ticks) : autorefresh_timer.mq4

Files:
 
mladen:
Autorefresh that works based on timer not based on ticks (it will work even when there are not ticks) : autorefresh_timer.mq4

mladen,

Can any code have that type of timer?

 
whisperer:
mladen, Can any code have that type of timer?

If you mean can it be driven at a timer basis, yes, it can (even thu auto refresh timer indicator will do that). The question is : what can it be used for. For single symbols code, there is no advantage (it will be done when the tick comes in, in the mean time nothing will change) - but if you are testing multiple symbols for some conditions or states, then it could be beneficial (when the chart you are currently looking at is not receiving ticks for some time and the other symbol(s) do, then the timer will take care of that)

PS: minimal timer resolution is 16 milliseconds but I would not push it so low - it can slow the rest of your terminal significantly if called from some loops or similar stuff. 1/4 of a second is somewhere on the border of being safe

 
mladen:
If you mean can it be driven at a timer basis, yes, it can (even thu auto refresh timer indicator will do that). The question is : what can it be used for. For single symbols code, there is no advantage (it will be done when the tick comes in, in the mean time nothing will change) - but if you are testing multiple symbols for some conditions or states, then it could be beneficial (when the chart you are currently looking at is not receiving ticks for some time and the other symbol(s) do, then the timer will take care of that) PS: minimal timer resolution is 16 milliseconds but I would not push it so low - it can slow the rest of your terminal significantly if called from some loops or similar stuff. 1/4 of a second is somewhere on the border of being safe

Haven't thought about it that way

Thanks

 
whisperer:
Haven't thought about it that way Thanks

Timer is a tricky think when used from some parts of code (or sorts)

Sleep() function (which is a sort of yield() function that allows other threads to be executed) does not work in indicators. Now imagine what happens when your indicator is called too frequently and it has no way to allow other processes to be executed?

Mql is called a coding language but is anything but. Instead of being a trading application coding language (like easy language from tradestation, for example) it is at a no mans land. It is far inferior to C/C++ (and not just performance wise - mql simply can not do what a normal coding language can), it s not a trading language, it is buggy as hell ,... all the best at one place :):)

Timers without yield (or sleep, however they name it) are a call to a suicide in a lot of cases if we are not extremely careful, and with mql4 reliability not even being careful is enough

 
mladen:
Timer is a tricky think when used from some parts of code (or sorts)

Sleep() function (which is a sort of yield() function that allows other threads to be executed) does not work in indicators. Now imagine what happens when your indicator is called too frequently and it has no way to allow other processes to be executed?

Mql is called a coding language but is anything but. Instead of being a trading application coding language (like easy language from tradestation, for example) it is at a no mans land. It is far inferior to C/C++ (and not just performance wise - mql simply can not do what a normal coding language can), it s not a trading language, it is buggy as hell ,... all the best at one place :):)

Timers without yield (or sleep, however they name it) are a call to a suicide in a lot of cases if we are not extremely careful, and with mql4 reliability not even being careful is enough

Buggy as hell - well, it may happen with a new product, but the hell is they do not provide a list of bugs nor unimplemented features. So the coder cannot avoid buggy parts of the language, and has no feedback if it has been fixed.

I found the timer less risky than the other chart events (mouse, keyboard, object change). The events drains much more computer power than I would expect. I believe this event scanner is responsible for the surprisingly high power consumption of the new Terminal. Watch the power drain if only moving the mouse above the empty chart.

 
Ovo:
Buggy as hell - well, it may happen with a new product, but the hell is they do not provide a list of bugs nor unimplemented features. So the coder cannot avoid buggy parts of the language, and has no feedback if it has been fixed. I found the timer less risky than the other chart events (mouse, keyboard, object change). The events drains much more computer power than I would expect. I believe this event scanner is responsible for the surprisingly high power consumption of the new Terminal. Watch the power drain if only moving the mouse above the empty chart.

To hell

Simply moving the mouse faster on the chart here and there can push my terminal CPU usage over 30% easily (nothing else done - no ticks today, no EAs, no indicators, no scripts). What the f... are they doing?

 
techmac:
To hell Simply moving the mouse faster on the chart here and there can push my terminal CPU usage over 30% easily (nothing else done - no ticks today, no EAs, no indicators, no scripts). What the f... are they doing?

It seems to be filled with stuff like that

I wonder what is the stuff the still keeps this abomination in one peace - just a matter of time when it falls apart completely

 

Never payed attention to that, and now when I tried it it really pushes up the CPU usage sky high. Simple moving - no other action. Strange at the least