63 lines
1.9 KiB
MQL5
63 lines
1.9 KiB
MQL5
// Function test
|
|
|
|
//Set external variable
|
|
//Start balance 50
|
|
double Target=100;
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
void OnStart()
|
|
{
|
|
Mlr();
|
|
MlrPrint();
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
void Mlr() // Mlr == Mailer
|
|
{
|
|
// SendMail function
|
|
|
|
double AccountBalance=AccountInfoDouble(ACCOUNT_BALANCE);
|
|
double AccountEquity=AccountInfoDouble(ACCOUNT_EQUITY);
|
|
double AccountProfit=AccountInfoDouble(ACCOUNT_PROFIT);
|
|
|
|
double Remaining=Target-AccountBalance;
|
|
|
|
double Hourly=0.20; //Project profit per hour
|
|
double Time=Remaining/Hourly; //Calculate hours till target reachd
|
|
|
|
string sp="|";
|
|
string at="@"+Hourly+"c";
|
|
|
|
string header=(AccountBalance+sp+AccountEquity+sp+AccountProfit+sp+Remaining+sp+int(Time)+sp+at);
|
|
|
|
SendMail(header,"");
|
|
Print("SendMail OK!");
|
|
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
void MlrPrint()
|
|
{
|
|
/*
|
|
Print information in thee exprt tab
|
|
|
|
*/
|
|
double AccountBalance=AccountInfoDouble(ACCOUNT_BALANCE);
|
|
double AccountEquity=AccountInfoDouble(ACCOUNT_EQUITY);
|
|
double AccountProfit=AccountInfoDouble(ACCOUNT_PROFIT);
|
|
|
|
double Remaining=Target-AccountBalance;
|
|
|
|
double Hourly=0.20; //Project profit per hour
|
|
double Time=Remaining/Hourly; //Calculate hours till target reachd
|
|
|
|
/* Print */
|
|
|
|
Print(AccountBalance);
|
|
Print(AccountEquity);
|
|
Print(AccountProfit);
|
|
Print(Remaining);
|
|
Print(Time);
|
|
}
|
|
//+------------------------------------------------------------------+
|