my EA is simple , and the functions in my EA do not have relationship, can i coded a mql5 EA which is no Class, inheritance and no Polymorphism , without any error?
Yes, MQL5 can be written with just global functions, ie without any OO constructs. But the advantage of OO encapsulation is that you can very easily use proven classes written by someone else - take a look at the CTrade class in include\trade\trade.mqh to use in your EA.
I have look the "trade.mqh"
but i don't know how to use "trade.mqh" to help me making my EA easier
may you give an example for open a new order , and modify the SL,TP which just open before?
CTrade is what is often termed a "wrapper", in order words it is a simple packaging of like functions into the one class, with a few checks. The documentation at the top of each method is sufficient to work out how the class is used.
To do the actions that you suggest using CTrade, I would write it like this.
// open new position
double sl,tp; // set these to appropriate distance from CurrentTick.ask
Print("Problem with CTrade::PositionOpen");
// change sl and tp to new values
Print("Problem with CTrade::PositionModify");
thanks for your reply
actually , mql5 is doing for those ea coder which ea have lots of function and those functions are similar~ ~
i have a mql4 ea which have 23 functions inside, but i don't think they are good by coding in mql5, because the functions are different
In my opinion , mql5 make EA author easier to make error, because it forced to make one by using some different property functions
in result, author need to think and type more~ ~
i advice EA coders don't be lazy (want to save typing and line) , don't try to make things in a object
if you disagree with me , never mind, just use some example to explain to everyone
Please enable the necessary setting in your browser, otherwise you will not be able to log in.