Hi!
I would like to write a script which will send to me the details about my trading account. The main goal is to see the balance/margin etc but I would like to see the the list of the oponed orders. The question is how can I put all the information of the opened orders(opened price, open time,profit, swap) in one email. The first idea was to use a for loop inside of the sendmail function, but it didnt't wordked. Does anibody have any idea how could I solve this probelem?
tanks in advance,
Roley
SHOW us your code.
Thank you.
- Jack
https://www.mql5.com/en/docs/common/sendmail
It's pretty simple.

- www.mql5.com
Did you enable email in your terminal options?
MT4
MT5
That's kind of important too. :)
Of course, I only dont know how to write the script exactly. The beginnig is like this:
SendMail("Daily account report:"+account+", "+date, //Subject
"Account information("+account+"):"+"\n"+"\n"+ //Message
"Account Currency: "+ccy+"\n"+
"Equity: "+equity+"\n"+
"Balance: "+balance+"\n"+
"Margin: "+margin+"\n"+
"Free Margin: "+freemargin+"\n"
but I do not have any idea how could I put a for loop to put into the sendmail function, which would write me the details of the orders. Because if I have 1 opened order, then I have to write once the information, if I have 4 then four times.
Of course, I only dont know how to write the script exactly. The beginnig is like this:
SendMail("Daily account report:"+account+", "+date, //Subject
"Account information("+account+"):"+"\n"+"\n"+ //Message
"Account Currency: "+ccy+"\n"+
"Equity: "+equity+"\n"+
"Balance: "+balance+"\n"+
"Margin: "+margin+"\n"+
"Free Margin: "+freemargin+"\n"
but I do not have any idea how could I put a for loop to put into the sendmail function, which would write me the details of the orders. Because if I have 1 opened order, then I have to write once the information, if I have 4 then four times.
Please use the SRC button when inserting code for display in the forums. Please include a complete copy of the code in question for reference, not just a portion of the code as it is incomplete.
but I do not have any idea how could I put a for loop to put into the sendmail function, which would write me the details of the orders. Because if I have 1 opened order, then I have to write once the information, if I have 4 then four times.
See the following reference pages.
https://www.mql5.com/en/docs/basis/types
https://www.mql5.com/en/docs/basis/operators/for
https://www.mql5.com/en/docs/basis/function
MQL4: https://docs.mql4.com/
MQL5: https://www.mql5.com/en/docs
Your questions are easily answered by looking at the available reference materials.
- Jack

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi!
I would like to write a script which will send to me the details about my trading account. The main goal is to see the balance/margin etc but I would like to see the the list of the oponed orders. The question is how can I put all the information of the opened orders(opened price, open time,profit, swap) in one email. The first idea was to use a for loop inside of the sendmail function, but it didnt't wordked. Does anibody have any idea how could I solve this probelem?
tanks in advance,
Roley