Download MetaTrader 5
To add comments, please log in or register
Do you need a trading robot? Orderit via Freelance service!
Rakhman Aries Nugroho
163
Rakhman Aries Nugroho 2014.02.24 08:14  
SDC:

The compiler errors when I put the path to the icon in the terminal_data_directory, the error says cannot open file in a virtual store folder even though I did not specify a folder in the virtual store. I specify a folder in the terminal_data_directory.

The only way I could get it to work was to put the file in the same folder as the source code and not specify a path at all, just #property icon "MyIcon.ico"


Hi just in case anyone has problem with #property icon "\\Images\\MyIcon.ico", you should consider the size of the icon 96x96 px or higher. I have experienced the error also, but now works.
Ovo Cz
2987
Ovo Cz 2014.03.06 20:35  

I noticed that compiler performs casting that I would not expect to occur.

I have following code:

where the class of the key object is MT4String, while the function getKey() returns more generic class. The same case is with the button object. Explicit casting is omitted.

Original code looked like this:

In JAVA, there would be explicit casting necessary, but the MQL4 compiler works with this syntax properly as well.

Is this implicit casting a feature, that is also valid in C++? Or is it a bug?

ydrol
593
ydrol 2014.03.06 21:57  

I'm not a C++ expert but going from a base class to a child class is called downcasting and according to this page it looks like downcasting must be explicit in C++ too. (like Java) ?

As MQL4 allows implicit downcasting it's either a "feature" or a bug :)

If its a "feature" it probably means that the compiler will fail to warn the coder of a potential error, so its not a great feature. Both C++ and Java require explicit downcasting for a reason?

Furthermore, in MQL4, there is no built in way to check the class of an object (eg instanceOf etc) so it means a run time error can't be avoided unless you implement your own 'type' check...


Animal a;

Dog d;

...

if (a instanceOf Dog) { // no built in check like this - we all have to roll our own??

 d = a;

}
Ovo Cz
2987
Ovo Cz 2014.03.06 23:32  
ydrol:

I'm not a C++ expert but going from a base class to a child class is called downcasting and according to this page it looks like downcasting must be explicit in C++ too. (like Java) ?

As MQL4 allows implicit downcasting it's either a "feature" or a bug :)

If its a "feature" it probably means that the compiler will fail to warn the coder of a potential error, so its not a great feature. Both C++ and Java require explicit downcasting for a reason?

Furthermore, in MQL4, there is no built in way to check the class of an object (eg instanceOf etc) so it means a run time error can't be avoided unless you implement your own 'type' check...




Yes, I would appreciate instanceof or ".class" too, but as far as I noticed it is not available even in the C++. Even the MQL4 debugger does not know the type of the watched object. I do not care much, because the OOP feature in MQL4 is implemented surprisingly very well, and if this was the only bug, then I would say hurray. I just was curious, if it was following some existing pattern, but it seems it was rather a bug.

Bambang Sugianto
10010
Bambang Sugianto 2014.03.07 05:55  

one click trading

in old MT4 i use a dll file for creating EA one click trading

i can type the parameter.. LOT, TP SL directly on those white text box

when i click buy or sell.. my EA read the input text in the box.

in new MT4 i see button function.. but i can't find the function to create an read a text box like that

Ovo Cz
2987
Ovo Cz 2014.03.07 06:03  
WDholic:

in old MT4 i use a dll file for creating EA one click trading

i can type the parameter.. LOT, TP SL directly on those white text box

when i click buy or sell.. my EA read the input text in the box.

in new MT4 i see button function.. but i can't find the function to create an read a text box like that

For the keyboard input there is the object type OBJ_EDIT. It fires CHARTEVENT_OBJECT_ENDEDIT event if you press the Enter key. But it seems that the Enter key is the only way how to finish editing, e.g. clicking a mouse outside the object boundaries does not finish editing. It prevents me from deploying the object as user unfriendly.

Moreover, if empty string is supplied as initial value, then automatic text "Edit" shows up instead (and this word even can be edited), which is really confusing.

/ /123456
To add comments, please log in or register