This code answers your question and is valid for both MQL5 and MQL4+.
Comment( StringFormat( "Equity is %.2f and Balance is %.2f", AccountInfoDouble( ACCOUNT_EQUITY ), AccountInfoDouble( ACCOUNT_BALANCE ) ) );
Please note that "AccountEquity()" is not a valid MQL5 function. That is from the old MQL4 code (please see MQL4 Reference). If your questions are about MQL4, then you should post in the MT4/MQL4 section at the very end of the forum.
This code answers your question and is valid for both MQL5 and MQL4+.
Please note that "AccountEquity()" is not a valid MQL5 function. That is from the old MQL4 code (please see MQL4 Reference). If your questions are about MQL4, then you should post in the MT4/MQL4 section at the very end of the forum.
Hmm.. This is one of my main problems and that's why I got the error... Finish.... What the difference between AccountEquity() and AccountInfoDouble ( ACCOUNT_EQUITY)?
P.S: Don't tell about MQL4 reference please, there is rocket science, not understandable for 17 year old kid who started programming 1 week ago. I'm comfortable to ask you here.
I made this decision based on the fact that for a week now I have been looking for a sensible explanation about event handling functions, for example OnDeinit, and found it. And what again is my indifference to what I learned, how simply everything is explained NOT ON MQL4 DOCUMENTATION WEBSITE, what a 5 year old child will understand. I need this and nothing else. And this is the key to victory. Simplicity! Programming is easy. You must understand this, because you do it automatically, it is easy for you, and even more so a posteriori programming is easy.
Are you using MetaTrader v4 or you using MetaTrader v5?
If you are using MetaTrader / MQL v5, then you can only use "AccountInfoDouble ( ACCOUNT_EQUITY )" .
If you are using MetaTrader / MQL v4, then you can use both, but "AccountEquity()" is from the old MQL4 before MQL5 came out, and "AccountInfoDouble ( ACCOUNT_EQUITY )" is the more modern compatible to MQL5.
And remember, you are not a 5 year old. You are almost an adult, and as an young adult you have a responsibility to improve your knowledge by doing the research needed. That means plenty of reading, cross-referencing and much more (be it books, videos or online references). It will take many months and even years. You will not be able to learn what is necessary in just a few days or weeks. Prepare for a very long journey of learning MQL.
The same applies to any other programming language. It takes time and effort!
EDIT: And by the way, programming is easy for me, because of doing it for decades, not because of talent or "gift". Everyone that has a "gift", worked really hard and long to be able to be good at it. It did not just happen like "magic".
Hmm.. This is one of my main problems and that's why I got the error... Finish.... What the difference between AccountEquity() and AccountInfoDouble ( ACCOUNT_EQUITY)?
P.S: Don't tell about MQL4 reference please, there is rocket science, not understandable for 17 year old kid who started programming 1 week ago. I'm comfortable to ask you here.
I made this decision based on the fact that for a week now I have been looking for a sensible explanation about event handling functions, for example OnDeinit, and found it. And what again is my indifference to what I learned, how simply everything is explained NOT ON MQL4 DOCUMENTATION WEBSITE, what a 5 year old child will understand. I need this and nothing else. And this is the key to victory. Simplicity! Programming is easy. You must understand this, because you do it automatically, it is easy for you, and even more so a posteriori programming is easy.
Are you using MetaTrader v4 or you using MetaTrader v5?
If you are using MetaTrader / MQL v5, then you can only use "AccountInfoDouble ( ACCOUNT_EQUITY )" .
If you are using MetaTrader / MQL v4, then you can use both, but "AccountEquity()" is from the old MQL4 before MQL5 came out, and "AccountInfoDouble ( ACCOUNT_EQUITY )" is the more modern compatible to MQL5.
And remember, you are not a 5 year old. You are almost an adult, and as an young adult you have a responsibility to improve your knowledge by doing the research needed. That means plenty of reading, cross-referencing and much more (be it books, videos or online references). It will take many months and even years. You will not be able to learn what is necessary in just a few days or weeks. Prepare for a very long journey of learning MQL.
The same applies to any other programming language. It takes time and effort!
Alright.
I used AccountEquity() in MQL4.
Is there a page in the documentation where I will no longer get errors because I used a function from a previous version that doesn't work in the current one?
Or I didn't understand you? I typed this function in MQL4, why didn't it work? Are you talking about the number after the word MQL or build?
If you are are starting out with MQL, then start with MetaTrader 5 and MQL5. MetaTrader 4 is no longer developed.
Goto to menu in MetaTrader (not MetaEditor) and select File -> About and see if you are using MetaTrader 4 or 5.
By the way, if you use "AccountInfoDouble( ACCOUNT_EQUITY )" then it will work on both and you will not have to worry if it is MQL4 or MQL5.
So, which do you think will be the more reasonable approach — using the old function or using the new one?
By the way, if you use "AccountInfoDouble( ACCOUNT_EQUITY )" then it will work on both and you will not have to worry if it is MQL4 or MQL5.
So, which do you think will be the more reasonable approach — using the old function or using the new one?
MQL4 is enough for me. If I have a SIMPLE manual strategy that is profitable, then I don't need a new version to automate it, right?
That does not seem like a very reasonable thing to say, but if that is you decision, then you should no longer be learning from MQL5 documentation. You will have to rely on the older "MQL4 Documentation", even if you say that it looks like "rocket science". If you continue to reference the MQL5 documentation, while coding in MQL4, then you will only get more frustrated and confused.
Also, in future you should post in the MQL4 section, or else you will receive MQL5 answers which will most probably not work for you.
That does not seem like a very reasonable thing to say, but if that is you decision, then you should no longer be learning from MQL5 documentation. You will have to rely on the older "MQL4 Documentation", even if you say that it looks like "rocket science". If you continue to reference the MQL5 documentation, while coding in MQL4, then you will only get more frustrated and confused.
Also, in future you should post in the MQL4 section, or else you will receive MQL5 answers which will most probably not work for you.
Ok
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I found the multiple line section in documentation, but didn't understand how to separate functions.