New MetaTrader 5 platform build 4755: General improvements - page 4

 
Doerk Hilger #:

In general I need a rest, true, but it is not triggered. I dont say, its everywhere the case, but that build does not create an OnTick() on my system. When I roll back to 4620, the OnTick() works again.

Its not only OnTick(), the charts (without any EA or indicator) are frozen too. 

The firewall stuff is also not happening on every system.

Yes, so if you know it's not a general issue, where are the information about your case ? Your system, how much charts, what is running on the chart where OnTick is not triggering, etc...

You are not a novice right ? So why reporting bug as a beginner with 0 useful information.

 
Doerk Hilger #:

Who sets a while (!IsStopped()) plus a Sleep() within OnTick(). Seriously, why would anyone do that!?!?! Of course nothing is executed since you freeze the EA with your absurd code. 
Sorry, but I find it annoying that you waste the space of this thread with such nonsense. 

  It is useful in mutli-symbol EA to replace OnTimer.  OnTimer has a trouble that EA can not stop working on holidays and weekends.

  Sorry you find it annoying, but that's your problem.

 
fxsaber #:

b4772 - no problem.

Thank you for checking.

I did not save b4772 (it seems a beta build).

 
Alain Verleyen #:

Yes, so if you know it's not a general issue, where are the information about your case ? Your system, how much charts, what is running on the chart where OnTick is not triggering, etc...

You are not a novice right ? So why reporting bug as a beginner with 0 useful information.

That the debugger shows wrong information and can`t figure out the datatype can`t be system-depending, that makes no sense at all. 

Anyway: Windows Server 2019 Standard on Intel i/-4770, fully in remote. Standard-system, no fancy hard- or software. Only MQL, C#, GitHub, Notepad++, Backupmaker. No other software at all. 100% clean system. 

 
Ziheng Zhuang #:

  It is useful in mutli-symbol EA to replace OnTimer.  OnTimer has a trouble that EA can not stop working on holidays and weekends.

  Sorry you find it annoying, but that's your problem.

But that can´t be the way to solve that. Any Sleep() blocks the thread, and any EA is executed in one thread AND task. Its not like in C# where you have multiple entry points and where the same code can be executed multiple times. EAs are synchronous - always. 

If you need to stop the EA during off-times, like weekends etc., you can simply check the clocks-synchronization, compare the local time to the server-time, or even simply check if the server-time is not updating anymore, cuz this will happen every time when the quotes are also not updated anymore, and then set a global flag or whatever. But blocking the thread cant be a good idea at all.

But still, this ain´t stuff for here.

 
Doerk Hilger #:

But that can´t be the way to solve that. Any Sleep() blocks the thread, and any EA is executed in one thread AND task. Its not like in C# where you have multiple entry points and where the same code can be executed multiple times. EAs are synchronous - always. 

If you need to stop the EA during off-times, like weekends etc., you can simply check the clocks-synchronization, compare the local time to the server-time, or even simply check if the server-time is not updating anymore, cuz this will happen every time when the quotes are also not updated anymore, and then set a global flag or whatever. But blocking the thread cant be a good idea at all.

But still, this ain´t stuff for here.

However, Sleep() does not mean that the thread is locked or blocking other threads; it simply tells the operating system: "I am willing not to occupy the CPU during this period of time."

Many brokers now offer cryptocurrencies such as Bitcoin, which can be traded at any time, including holidays and weekends, so the server time is constantly updated in real-time.

Comparing local time and server time is not a feasible method, as local time may be a few seconds slower than real time.

 
Ziheng Zhuang #:

However, Sleep() does not mean that the thread is locked or blocking other threads; it simply tells the operating system: "I am willing not to occupy the CPU during this period of time."

Many brokers now offer cryptocurrencies such as Bitcoin, which can be traded at any time, including holidays and weekends, so the server time is constantly updated in real-time.

Comparing local time and server time is not a feasible method, as local time may be a few seconds slower than real time.

Sleep() does not block other threads, no one said that, but it stops executing the current thread. And this means also: All the ticks and other events. Your code suppresses the execution of the EA for one second after each incoming tick. And since you do, where shall the value of the params come from? You kinda bet on that the dialog window is executed in another thread and that somehow in between the value has magically reached your code variable buffers. Whatever you try to do this way and for whatever reason, its maximal unsafe and not the way to do proper. 

 
HighDPI in editor is not working. Text appears at half-size in popups (almost) all the time. 



Besides this, it is still not really working in charts: Candles have half-size-width, 1 Pixel lines are almost invisible. Thats not HighDPI. 
 

Bug-Report:

Still, the watch-list for variables of the Debugger is broken. - It doesnt know its own internal variables.


Code to reproduce:

//+------------------------------------------------------------------+
//|                                                  Playground3.mq5 |
//|             Copyright 2024, Freie Netze UG (haftungsbeschraenkt) |
//|                                       https://www.freie-netze.de |
//+------------------------------------------------------------------+

#define LIB_MQLPLUS_CUSTOM_EVENTHANDLER_FUNCTION_LATEBIND
//#include <MQLplus/lib_mqlplus.mqh>



//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
{

    //PeriodSeconds(PERIOD_CURRENT_ASK);
    PeriodSeconds(PERIOD_CURRENT);

    //MQLPLUS_ENUM_TIMEFRAMES retval = NULL;
    //retval = Period();


    //Bars(Symbol(), PERIOD_CURRENT_ASK);
    Bars(Symbol(), PERIOD_CURRENT);

    // Return
    return(INIT_SUCCEEDED);
}





//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
    // Get ask price data for given range

        double ask_high[];
        CopyHigh(Symbol(), Period(), time[rates_total - 1], 1, ask_high);
        Print(_LastError);

    // Return
    return(rates_total);
}
//+------------------------------------------------------------------+
 

Forum on trading, automated trading systems and testing trading strategies

New MetaTrader 5 platform build 4755: General improvements

Dominik Egert, 2024.12.26 18:45

Code to reproduce:

        

#define LIB_MQLPLUS_CUSTOM_EVENTHANDLER_FUNCTION_LATEBIND #include <MQLplus/lib_mqlplus.mqh>

???