Sendmail function

 

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

 
roley05:

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

 
Create one string with all information you desire, and send it.
 
Documentation on MQL5: Common Functions / SendMail
Documentation on MQL5: Common Functions / SendMail
  • www.mql5.com
Common Functions / SendMail - Reference on algorithmic/automated trading language for MetaTrader 5
 

Did you enable email in your terminal options?



MT4


MT5

That's kind of important too. :)

 
Jack Thomas:

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.

 
roley05:

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

Documentation on MQL5: Language Basics / Data Types
Documentation on MQL5: Language Basics / Data Types
  • www.mql5.com
Any program operates with data. Data can be of different types depending on their purposes. For example, integer data are used to access to array components. Price data belong to those of double precision with floating point. This is related to the fact that no special data type for price data is provided in MQL5. Data of different types are...
Reason: