Errors, bugs, questions - page 2654

 

Can anyone enlighten us on the following question:

Have a dll written in C# but compiled:

- for MT5 usual C# project - Net Framework dll - 64 bit

- MT4 - Net Framework dll - 32 bit, but wrapped in managed C calls

Sources dll are 100% identical, except MT4 wrapper of course,

OS Win10-64

Well, the question is why MT4 calls functions exactly 4 times faster, the figures are approximately 100 000 dll calls on MT4 for 7.5 seconds, MT5 for 30 seconds

 
Igor Makanu:

Can anyone enlighten us on the following question:

Have a dll written in C# but compiled:

- for MT5 usual C# project - Net Framework dll - 64 bit

- MT4 - Net Framework dll - 32 bit, but wrapped in managed C calls

Sources dll are 100% identical, except MT4 wrapper of course,

OS Win10-64

Well, the question is why MT4 calls functions exactly 4 times faster, the figures are approximately 100 000 dll calls on MT4 for 7.5 seconds, MT5 for 30 seconds

IMHO. C-runtime in one case and a virtual machine in the other.

 
missed a new feature on the forum, where the first name, last name, date and next to the button translations, numbers - 1 2 3, not everyone has it, yesterday I think I did not have it either, why not everyone, and what is the page definition?
 

A graphical interface is implemented in the Expert Advisor. User events are also implemented (e.g. GUI change events). I perform debugging on real data (F5). As soon as I put a breakpoint on a user event - the debugger stops, but the subsequent pressing F5 (continuing debugging) does not lead to changes in the GUI itself. Question: should this be the case, or is this a debugger bug?

If I remove the breakpoint (debugging continues) - changes in the GUI are normal.

MT5, build 2340.

 
Vladimir Simakov:

IMHO. C-runtime in one case and a virtual machine in the other.

there's a virtual .Net in both dlls

i found the difference in the code, i even threw the 32 bit base class in a separate thread, because it has no other way of working

I made the same manipulations for MT5, the results are more or less the same (three tests each):

MT5: cycle 100000 , time 8.482981 sec , cycle 100000 , time 8.638789 sec , cycle 100000 , time 8.390046 sec

MT4: cycle 100000 , time 7.128857 sec , cycle 100000 , time 7.176361 sec , cycle 100000 , time 7.205439 sec


OK, let's assume it's some kind of hooch from Microsoft
 

Greetings ! Happy Holidays to all the men !!!!
I don't understand what's the strange bug with zigzagging display of equity in the tester. I don't understand the strange bug with zigzagging equities display in the tester. If I change the "Settlement method" setting from "Exchanging Stoks" to "Forex", equity is displayed normally. I had the same experience a few years ago, I wanted to try to connect MT5 to a fund, tested it, got scared and gave up. Now I tried it again and the same thing. Is it strange?

 
Why isn't it possible to implement a function with a "universal" argument that can pass any variable regardless of its "origin": lvalue, rvalue, literal or temporary variable?
The problem is solvable for methods of "typed" container classes, but it's not solvable for normal functions.

The main contradiction is that for transferring structures it's necessary to use transfer by reference, and for literals and temporary variables - transfer by value.
As the result, we get a compilation error for normal lvalue types because both overloaded functions are suitable for the call.
As a partial solution and only for "primitive" types, you can build 12 overloaded functions:
#define  CREATE_LITERAL_PARAMETER_CALL_HANDLERS_VOID_T1_P2_L2(current_func_name, main_func_name, param_1)          \
   template<typename T> void current_func_name(param_1 p1, const string  value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const long    value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const int     value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const short   value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const char    value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const ulong   value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const uint    value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const ushort  value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const uchar   value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const double  value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const float   value){ main_func_name(p1, value);}      \
   template<typename T> void current_func_name(param_1 p1, const bool    value){ main_func_name(p1, value);}    
But if a function is to accept two "universal" arguments, then only 144 overloaded functions are needed to implement it, while in the case of three such arguments, the whole 1728 overloaded functions are needed.


Suggestion:
Finally allow users to pass literals and temporary variables as const ref function arguments.
Let it be a separate # directive - whatever...
 

Defects in template function/class cache operation:
(not fixed by MT5(build 2340)) ** Undefined Behavior, you create a complex wrapped object with internal type "C" several times and it turns out to be a completely different data type, maybe "B", maybe "int", whatever you want...
(not fixed by MT5(build 2340)) * Compile Error, bug on passing a function pointer as a const ref template argument.
(not fixed by MT5(build 2340)) * Compile Error, B<int> object can be created after the B<void*> class object, but if done before, a compile error occurs.


Defects in template function/class work:
(not fixed by MT5(build 2340)) ** Compile Error, bug inside template function, passed pointer withinexplicit type conversion operation behaves like a class otherwise like a pointer.
(not fixed by MT5(build 2340)) ** Compile Error, bug with template class code generation while using internal class.
(not fixed by MT5(build 2340)) ** Compile Error, bug on attempt to access internal class for template parameter of template function.
(not fixed by MT5(build 2340)) ** Compile Error, bug on generation of template method/class, the process of "auto-replacement" of the template parameter goes outside of the scop into the main program code.
(not fixed by MT5(build 2340)) * Compile Error, the bug with template class not generating code automatically when the template class acts as a return value for the template method.
(not fixed by MT5(build 2340)) * Compile Error, bug in internal class definition - there is no possibility to refer to global namespace explicitly when specifying the base class.


Defects in overloaded function calls priority mismatch in MQL compared to C++:
(not fixed by MT5(build 2340)) *** Compile Error when there is class inheritance A <= B <= C <= D and two overloading functions are implemented, for example, one with parameter A* and one with parameter B*, then passing in such function an object C* or D* in MQL causes a compilation error "ambiguous call to overloaded function".
(not fixed by MT5(build 2340)) ** Runtime, Priority mismatch for overloaded template function calls.



Suggestions:
link- on allowing literals and temporary variables to be passed as const ref function arguments.
link- whenmoving projectfiles in the Project tab, for moved files that are open and located in ME tabs, to automatically update their location path.
link- to introduce typedef declaration functionality in MQL.
link- about providing possibility to force generation of default copy constructors and assignment operators.


 

I'm asking for help, I'm completely out of the loop.

In OnChartEvent, by pressing `C` I cancel/restore the price chart.

And everything would be fine, but if the keyboard layout is not selected English - does not work.


How to make the detection of pressing `C` independent of the selected layout?

 
fxsaber:

I'm asking for help, I'm completely out of the loop.

In OnChartEvent, by pressing `C` I cancel/restore the price chart.

And everything would be fine, but if the keyboard layout is not selected English - does not work.


How to make the detection of pressing `C` is independent of the selected layout?

Need to checklparam

//+------------------------------------------------------------------+
//|                                                 TranslateKey.mq5 |
//+------------------------------------------------------------------+
#property version   "1.00"
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots 0
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping

//---
   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[])
  {
//---

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
  {
   if(id==CHARTEVENT_KEYDOWN)
     {
      short sym=TranslateKey((int)lparam);
      //--- if the entered character is successfully converted to Unicode
      if(sym>0)
         Print("lparam: ",lparam,", ",sym,"'",ShortToString(sym),"'");
      else
         Print("Error in TranslateKey for key=",lparam);
     }
  }
//+------------------------------------------------------------------+

For both ru and en keyboard layouts (both lowercase and uppercase) lparam will be 67:

TranslateKey (EURUSD,H1)        lparam: 67, 67'C'
TranslateKey (EURUSD,H1)        lparam: 67, 1057'С'
TranslateKey (EURUSD,H1)        Error in TranslateKey for key=20
TranslateKey (EURUSD,H1)        lparam: 67, 1089'с'
TranslateKey (EURUSD,H1)        lparam: 67, 99'c'