I think you should first concentrate on learning the basics of the language, its structure, its syntax, code layout and readability, etc.
Then learn about the various functions that are available, how they work and how to use them properly.
The code you provided, will not even compile, because you are basically mixing apples, oranges, tomatoes, carrots, and anything else that fits in the basket.
For example, the OrderSelect() function is for selecting a particular Order either by Index or by Ticket Number. It does not by itself return the number of Orders of a certain type.
So, before you even think about "professional account management", first you need to learn the language, by reading the documentation and researching the example code in the CodeBase.
If you want or prefer, you can even get yourself a good book and follow it from start to end:

- docs.mql4.com
I think you should first concentrate on learning the basics of the language, its structure, its syntax, code layout and readability, etc.
Then learn about the various functions that are available, how they work and how to use them properly.
The code you provided, will not even compile, because you are basically mixing apples, oranges, tomatoes, carrots, and anything else that fits in the basket.
For example, the OrderSelect() function is for selecting a particular Order either by Index or by Ticket Number. It does not by itself return the number of Orders of a certain type.
So, before you even think about "professional account management", first you need the learn the language, by reading the documentation and researching the example code in the code base.
If you want or prefer, you can even get yourself a good book and follow it from start to end:
Hello Fernando,
I'm not sure about this, I believe you are trying to compile my MQL4 code in MQL5. I am using MQL4 currently.
I know very well, that your code is MQL4! Is the link for OrderSelect() not to MQL4 documentation?
The question however, is how well do you know MQL4 yourself?
As an example exercise, lets compare your use of OrderSelect() with that of the documentation ...
// Your usage ... int TotalAskOrders = // You are using "int", but OrderSelect() returns a "bool" OrderSelect( OP_BUY || No, // This is supposed to be a "int" type for an Index or a Ticket, but you are using a resulting "bool" (of OrderType logically or'ed with an unknown variable "No") No, // This is supposed to be a "int" for a select flag (SELECT_BY_POS or SELECT_BY_TICKET), yet you are using the same unknown variable "No" as above No // This is supposed to be a "int" for a pool type (MODE_TRADES or MODE_HISTORY), yet again you are using the same unknown variable "No" as above ); // Reference documentation ... "The function selects an order for further processing." bool OrderSelect( int index, // index or order ticket int select, // flag int pool=MODE_TRADES // mode );

- docs.mql4.com
I know very well, that your code is MQL4! Is the link for OrderSelect() not to MQL4 documentation?
The question however, is how well do you know MQL4 yourself?
As an example exercise, lets compare your use of OrderSelect() with that of the documentation ...
Thank you, Fernando
bool No=false,Yes=true;
May I ask you about writing an account management code?
I am not asking for anyone to code it for me, I just would like to know some of the basic requirements to achieve very important code.
I found some code written by whroeder which is providing some clues. However I need a mentor to guide me.
I found some code written by whroeder which is providing some clues. However I need a mentor to guide me.
For hiring a coder or a tutor, you may use the Freelance section.
But, as I stated:
So, before you even think about "professional account management", first you need to learn the language, by reading the documentation and researching the example code in the CodeBase.
If you want or prefer, you can even get yourself a good book and follow it from start to end:

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone,
I'd like to ask you all for some hints and tips on creating a professional style code to help maintain my trading account. I don't know there to start, but so fair this is all I have.