Last active
April 3, 2018 12:40
-
-
Save currencysecrets/6199801 to your computer and use it in GitHub Desktop.
alertMe is a template function that is used to send emails regarding any errors that occur during automation of trade and position processing. User simply calls the function by entering a string for the header/subject line of the email and then the opening area of the body of the message. The remainder of the function adds additional details abo…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This function sends an email according to the Tools > Options > Send Email settings | |
* @string subject line of the email (default = empty string) | |
* @string opening body of the message (default = empty string) | |
* @string optional currency symbol (default = empty string == symbol of the active chart) | |
*/ | |
void alertMe( string subject = "", string body = "", string sym = "" ) { | |
string systemTag; | |
if ( sym == "" ) { sym = Symbol(); } | |
systemTag = WindowExpertName() + " (v" + version + ")"; | |
SendMail( subject + " " + sym + " " + systemTag , | |
body + | |
"\n\n" + | |
"SYSTEM DETAILS: \n" + | |
"System: " + systemTag + "\n" + | |
err_msg( GetLastError() ) + "\n" + | |
"Server Time: " + T( TimeCurrent() ) + "\n" + | |
"\n" + | |
"CURRENCY/CHART DETAILS: \n" + | |
"Currency: " + sym + "\n" + | |
"Period: " + D( Period(), 0) + "\n" + | |
"Bid: " + D( Bid ) + "\n" + | |
"Ask: " + D( Ask ) + "\n" + | |
"Spread: " + D( getSpread() ) + "\n" + | |
"Digits: " + D( Digits, 0) + "\n" + | |
"Point: " + D( Point ) + "\n" + | |
"TickSize: " + D( MarketInfo( sym, MODE_TICKSIZE ) ) + "\n" + | |
"TickValue: " + D( MarketInfo( sym, MODE_TICKVALUE ) ) + "\n" + | |
"Bars: " + D( Bars, 0) + "\n" + | |
"Bar[0] Time: " + T( Time[0] ) + "\n" + | |
"Volume[0]: " + D( Volume[0], 0) + "\n" + | |
"\n" + | |
"ACCOUNT DETAILS: \n" + | |
"Account #: " + AccountNumber() + "\n" + | |
"Account Balance: $" + D(AccountBalance(), 2) + "\n" + | |
"Margin: $" + D( AccountMargin(), 2) + "\n" + | |
"Free Margin: $" + D( AccountFreeMargin(), 2) + "\n" + | |
"Equity: $" + D( AccountEquity(), 2) + "\n" + | |
"P/L: $" + D( AccountProfit(), 2) + "\n" + | |
"Broker: " + AccountCompany() + "\n" + | |
"Leverage: " + D( AccountLeverage(), 2) + "\n" + | |
"Account Name: " + AccountName() + "\n" + | |
"Account Server: " + AccountServer() + "\n" | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment