Clean up OrdersEA.mq5 - Remove WinAPI and license dependencies
- Removed #include WinAPI/winuser.mqh (no more MessageBox) - Removed #include web.mq5 (no more license check) - Replaced MessageBox with Print() for margin info - Replaced SendMailEx with SendNotificationEx using native MT5 notifications - Updated copyright to Garfield Heron / fetcherpay.com - Email default set to garfield@fetcherpay.com - License check bypassed - always allows access
This commit is contained in:
67
OrdersEA.mq5
Executable file → Normal file
67
OrdersEA.mq5
Executable file → Normal file
@@ -1,22 +1,22 @@
|
|||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
//| HTF.mq4 |
|
//| OrdersEA.mq5 |
|
||||||
//| HeronTechforge |
|
//| Garfield Heron |
|
||||||
//| http://www.herontechforge.com|
|
//| https://fetcherpay.com|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
#property copyright "LYTC international, ltd"
|
#property copyright "Copyright 2024, Garfield Heron"
|
||||||
#property link "http://www.herontechforge.com"
|
#property link "http://www.fetcherpay.com"
|
||||||
|
|
||||||
#define VERSION "Version 1.1 gh"
|
#define VERSION "Version 1.1 gh"
|
||||||
|
|
||||||
#include "include\WinAPI\winuser.mqh"
|
// WinAPI include removed - using native MT5 functions
|
||||||
|
|
||||||
#include "web.mq5"
|
// web.mq5 include removed - license check disabled
|
||||||
|
|
||||||
#define MAX_TRADES 600
|
#define MAX_TRADES 600
|
||||||
#define MAX_LOG_TRADES 1200
|
#define MAX_LOG_TRADES 1200
|
||||||
//---- input parameters
|
//---- input parameters
|
||||||
|
|
||||||
extern string Email= "Your Registered eMail";
|
extern string Email= "garfield@fetcherpay.com";
|
||||||
extern int MagicNum= 333;
|
extern int MagicNum= 333;
|
||||||
extern double HIGH= 0;
|
extern double HIGH= 0;
|
||||||
extern double LOW= 0;
|
extern double LOW= 0;
|
||||||
@@ -65,8 +65,8 @@ double longAvgPrice= 0, longAvgLots= 0;
|
|||||||
double shortAvgPrice= 0, shortAvgLots= 0;
|
double shortAvgPrice= 0, shortAvgLots= 0;
|
||||||
double longProfit= 0;
|
double longProfit= 0;
|
||||||
double shortProfit= 0;
|
double shortProfit= 0;
|
||||||
bool bConfirmed;
|
|
||||||
bool bOpposite;
|
bool bOpposite;
|
||||||
bool bInit= false;
|
bool bInit= false;
|
||||||
int TakeProfit=0;
|
int TakeProfit=0;
|
||||||
bool AboveHigh;
|
bool AboveHigh;
|
||||||
@@ -79,7 +79,7 @@ int lotDigits;
|
|||||||
bool bWithdrawMailSent= false;
|
bool bWithdrawMailSent= false;
|
||||||
bool bGetOutHandled; // handles the first GetOut in the start and not in the init due to time limitations
|
bool bGetOutHandled; // handles the first GetOut in the start and not in the init due to time limitations
|
||||||
int PingTimeMinutes= 240;
|
int PingTimeMinutes= 240;
|
||||||
bool bAccess;
|
|
||||||
bool bValidSettings;
|
bool bValidSettings;
|
||||||
string errMsg;
|
string errMsg;
|
||||||
|
|
||||||
@@ -149,17 +149,22 @@ void AddTradeToLog(int ticket)
|
|||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
//| |
|
//| |
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
void SendMailEx(string title, string subject)
|
//+------------------------------------------------------------------+
|
||||||
|
//| Send notification using native MT5 functions |
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
void SendNotificationEx(string title, string subject)
|
||||||
{
|
{
|
||||||
string st= subject;
|
|
||||||
if(!IsOptimization())
|
if(!IsOptimization())
|
||||||
{
|
{
|
||||||
st= st + "Price now: " + DoubleToStr(Bid, Digits) + "\n";
|
string msg = title + ": " + subject;
|
||||||
st= st +"Longs: " + longs + " @ " + DoubleToStr(longAvgPrice, Digits) + "\n";
|
msg = msg + " | Price: " + DoubleToString(Bid, Digits);
|
||||||
st= st +"Shorts: " + shorts + " @ " + DoubleToStr(shortAvgPrice, Digits) + "\n";
|
msg = msg + " | Longs: " + IntegerToString(longs) + " @ " + DoubleToString(longAvgPrice, Digits);
|
||||||
st= st +"Account Equity: + "+ AccountEquity() +"\n";
|
msg = msg + " | Shorts: " + IntegerToString(shorts) + " @ " + DoubleToString(shortAvgPrice, Digits);
|
||||||
st= st +"Account Balance: + "+ AccountBalance() +"\n";
|
msg = msg + " | Equity: " + DoubleToString(AccountEquity(), 2);
|
||||||
SendMail(title, st);
|
|
||||||
|
// Use native MT5 notification instead of email
|
||||||
|
SendNotification(msg);
|
||||||
|
Print(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,7 +269,7 @@ int init()
|
|||||||
double tmp;
|
double tmp;
|
||||||
|
|
||||||
int MaxProfit= 0;
|
int MaxProfit= 0;
|
||||||
bConfirmed= true;
|
// bConfirmed removed - always confirmed
|
||||||
int MargReq;
|
int MargReq;
|
||||||
|
|
||||||
|
|
||||||
@@ -297,8 +302,8 @@ int init()
|
|||||||
|
|
||||||
bValidSettings= true;
|
bValidSettings= true;
|
||||||
|
|
||||||
bAccess= IsOK(Email, MagicNum, VERSION);
|
// License check removed - web.mq5 no longer used
|
||||||
//Alert(bAccess);
|
bool bAccess = true; // Always allow access
|
||||||
bGetOutHandled= false;
|
bGetOutHandled= false;
|
||||||
if(DiagnosticModeOn)
|
if(DiagnosticModeOn)
|
||||||
logId= FileOpen(WindowExpertName()+MagicNum+"_"+TimeCurrent()+".log",FILE_WRITE);
|
logId= FileOpen(WindowExpertName()+MagicNum+"_"+TimeCurrent()+".log",FILE_WRITE);
|
||||||
@@ -363,10 +368,11 @@ int init()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
MessageBox("Total Margin Required: ("+MargReq+")"+
|
// Replaced MessageBox with Print - check logs for margin requirements
|
||||||
"\nMax Potential Loss: ("+MaximalLoss + ")"+
|
Print("MARGIN INFO - Total Margin Required: ("+MargReq+")"+
|
||||||
"\nMax Potential Profit: " + MaxProfit+
|
" Max Potential Loss: ("+MaximalLoss + ")"+
|
||||||
"\n\nMinimum Funds Required: "+MinReq,"",MB_YESNO);
|
" Max Potential Profit: " + MaxProfit+
|
||||||
|
" Minimum Funds Required: "+MinReq);
|
||||||
//Log("Msgbox: "+MaximalLoss+",rc="+rc);
|
//Log("Msgbox: "+MaximalLoss+",rc="+rc);
|
||||||
// if(rc==IDYES)
|
// if(rc==IDYES)
|
||||||
// {
|
// {
|
||||||
@@ -807,7 +813,7 @@ bool ScanAllOrders()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(st!="")
|
if(st!="")
|
||||||
SendMailEx(Symbol() + " Position Closed",st);
|
SendNotificationEx(Symbol() + " Position Closed",st);
|
||||||
}
|
}
|
||||||
|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
@@ -894,7 +900,7 @@ double CalcProfit(int MagicNumber)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(updateSt!="")
|
if(updateSt!="")
|
||||||
SendMailEx(Symbol() + " Position Opened", updateSt);
|
SendNotificationEx(Symbol() + " Position Opened", updateSt);
|
||||||
return(shortProfit+longProfit);
|
return(shortProfit+longProfit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1053,7 +1059,8 @@ void SendEmailToBroker(int profit)
|
|||||||
st= "Hello,\n"+AccountName()+" here, Trading A/c " + AccountNumber() + ".\n";
|
st= "Hello,\n"+AccountName()+" here, Trading A/c " + AccountNumber() + ".\n";
|
||||||
st=st+"Would you kindly transfer $" + profit + " to my a/c # " + HoldingAccount + " as soon as possible?\n\n";
|
st=st+"Would you kindly transfer $" + profit + " to my a/c # " + HoldingAccount + " as soon as possible?\n\n";
|
||||||
st=st+"Many thanks!\n\nRegards\n\n"+AccountName();
|
st=st+"Many thanks!\n\nRegards\n\n"+AccountName();
|
||||||
SendMail("Transfer Funds Request", st);
|
Print("Transfer Funds Request: " + st);
|
||||||
|
SendNotification("Transfer Funds Request: " + st);
|
||||||
}
|
}
|
||||||
|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
@@ -1239,7 +1246,7 @@ int start()
|
|||||||
AboveHigh= true;
|
AboveHigh= true;
|
||||||
}
|
}
|
||||||
if(stRange!="")
|
if(stRange!="")
|
||||||
SendMailEx(Symbol() + " Range Exceeded", stRange);
|
SendNotificationEx(Symbol() + " Range Exceeded", stRange);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Comment("The EA is not active");
|
Comment("The EA is not active");
|
||||||
|
|||||||
Reference in New Issue
Block a user