MlrInfo/MlrInfo.mq5
super.admin 1d90030f7d convert
2025-05-30 15:08:13 +02:00

71 lines
2.5 KiB
MQL5

//+------------------------------------------------------------------+
//| SendStatus.mq5 |
//| Copyright 2018, Ricardo de Jong |
//| https://www.twitter.com/ricardodejong |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, Ricardo de Jong"
#property link "https://www.twitter.com/ricardodejong"
#property version "1.00"
input int SetInterval=300; // Set interval in sec
input double Target=100; // Target in USD
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
EventSetTimer(300);
//SendStatus();
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void OnTimer()
{
SendStatus();
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
EventKillTimer();
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
void SendStatus() //The name of the function for sending account information
{
// 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+Target+sp+Remaining+sp+int(Time)+sp+at);
SendMail(header,"");
}
//+------------------------------------------------------------------+