Now the other problem, you can have with this code
Might be it is not always happening,
but if closing happens and one trade fails to close you keep that trade
Now addicted to C ! Reading Spirit of C by Moolish Cooper. Then C++ =D .. This is cool new hobby I found ..Learning something new is wonderful especially when markets are cold.. B-)
Learning C or C++ is good but when you get to Java, then you'll see the mother of MQL.
Haha ! your reply has kind of initiated a heated debate between two techy friends of mine !
Friend 1: Learning C is the fundamental building block .. learn C as 3rd gen language and you will be able to learn any other language 3rd or 4th very easily later on.
Friend 2: No No No, the other way round .. learn Java or VB first.. drop VB as java is more prefered .. But, if you learn java first, you are AS good a coder and you dont HAVE to learn C or C++ ..Plus the very claim that you have to learn C to be a good coder is wrong..
Me: I will ask thrdel ! xD
So whats your opinion? =)
My opinion is as valid as anyone else's . I believe that you don't need to learn to fly a jet fighter to ride a bike. If you can learn Java or MQL or C or C++, that means you have the ability to learn.
We use the documentation in MQL and so do the Java programmers and the C++ or whatever. They don't just memorize everything there is to know about that particular system.
Java is everywhere this days, from your mobile phone, car, computer, you name it.
And as I said before, I you need to write MQL, learn MQL. It is based on Java. But it's MQL.
No C or C++ programmer can do what one can do in assembly programming. Is that better ? Yes, if you're interested in reverse engineering. No, if you want to write EA's.
So the question isn't that simple but it is simple at the same time.
Hope it makes sense.
Sorry to be precise but MQL4 is based on C and MQL5 is based on C++. Java is based on C, C++, and some other high level languages and I think they all have copied bits from each other over the years. I really doubt it matters with MetaTrader and MQL but in terms of pure execution speed Java is often actually slower than C but some things like memory allocation and management is easier in Java as the code to do it was refined for Java but C is often more powerful and versatile. The speed reason is why commercial OSs have only been produced with C/C++ and only experimented with in Java.
In many high level languages you can embed assembly language into sections that need to work much faster than with traditional high level code. I'm not sure how relevant it is or even if it as a good idea to use these days but I have considered learning assembly language if I ever need to write an EA that needs to run as fast as possible.
I don't think MQL directly supports assembly language but it may be possible to write it as part of an DLL and include functions within the EA to make use of it. It would be great if someone could clarify if assembly language is possible in MQL somehow should it ever be needed. If I ever get the time I might even try something basic and post it to the codebase for everyone.
Anyways, sorry I got a bit off topic. As for the OP question it would be better to learn C/C++ first as it is more like MQL4/5 then learn the few differences to code in Java but as thrdel stated above, most of the languages are very similar so learning one or the other first isn't too much of a big deal but learning C/C++ first will be more adaptable to writing MQL faster as it is the almost the same language.
You don't have to learn any specific language to be a good coder, you can be a good coder (or a bad one) in any language. What you need to be a good coder is, as thrdel wrote, firstly the capacity to learn, and secondly logical thinking. With that you can learn any language and be good at it.
Debate around C, C++, Java or D, X, Y, Z languages are endless and waste of time.