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 |
|
||||
//| HeronTechforge |
|
||||
//| http://www.herontechforge.com|
|
||||
//| OrdersEA.mq5 |
|
||||
//| Garfield Heron |
|
||||
//| https://fetcherpay.com|
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "LYTC international, ltd"
|
||||
#property link "http://www.herontechforge.com"
|
||||
#property copyright "Copyright 2024, Garfield Heron"
|
||||
#property link "http://www.fetcherpay.com"
|
||||
|
||||
#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_LOG_TRADES 1200
|
||||
//---- input parameters
|
||||
|
||||
extern string Email= "Your Registered eMail";
|
||||
extern string Email= "garfield@fetcherpay.com";
|
||||
extern int MagicNum= 333;
|
||||
extern double HIGH= 0;
|
||||
extern double LOW= 0;
|
||||
@@ -65,8 +65,8 @@ double longAvgPrice= 0, longAvgLots= 0;
|
||||
double shortAvgPrice= 0, shortAvgLots= 0;
|
||||
double longProfit= 0;
|
||||
double shortProfit= 0;
|
||||
bool bConfirmed;
|
||||
bool bOpposite;
|
||||
|
||||
bool bOpposite;
|
||||
bool bInit= false;
|
||||
int TakeProfit=0;
|
||||
bool AboveHigh;
|
||||
@@ -79,7 +79,7 @@ int lotDigits;
|
||||
bool bWithdrawMailSent= false;
|
||||
bool bGetOutHandled; // handles the first GetOut in the start and not in the init due to time limitations
|
||||
int PingTimeMinutes= 240;
|
||||
bool bAccess;
|
||||
|
||||
bool bValidSettings;
|
||||
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())
|
||||
{
|
||||
st= st + "Price now: " + DoubleToStr(Bid, Digits) + "\n";
|
||||
st= st +"Longs: " + longs + " @ " + DoubleToStr(longAvgPrice, Digits) + "\n";
|
||||
st= st +"Shorts: " + shorts + " @ " + DoubleToStr(shortAvgPrice, Digits) + "\n";
|
||||
st= st +"Account Equity: + "+ AccountEquity() +"\n";
|
||||
st= st +"Account Balance: + "+ AccountBalance() +"\n";
|
||||
SendMail(title, st);
|
||||
string msg = title + ": " + subject;
|
||||
msg = msg + " | Price: " + DoubleToString(Bid, Digits);
|
||||
msg = msg + " | Longs: " + IntegerToString(longs) + " @ " + DoubleToString(longAvgPrice, Digits);
|
||||
msg = msg + " | Shorts: " + IntegerToString(shorts) + " @ " + DoubleToString(shortAvgPrice, Digits);
|
||||
msg = msg + " | Equity: " + DoubleToString(AccountEquity(), 2);
|
||||
|
||||
// Use native MT5 notification instead of email
|
||||
SendNotification(msg);
|
||||
Print(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +269,7 @@ int init()
|
||||
double tmp;
|
||||
|
||||
int MaxProfit= 0;
|
||||
bConfirmed= true;
|
||||
// bConfirmed removed - always confirmed
|
||||
int MargReq;
|
||||
|
||||
|
||||
@@ -297,8 +302,8 @@ int init()
|
||||
|
||||
bValidSettings= true;
|
||||
|
||||
bAccess= IsOK(Email, MagicNum, VERSION);
|
||||
//Alert(bAccess);
|
||||
// License check removed - web.mq5 no longer used
|
||||
bool bAccess = true; // Always allow access
|
||||
bGetOutHandled= false;
|
||||
if(DiagnosticModeOn)
|
||||
logId= FileOpen(WindowExpertName()+MagicNum+"_"+TimeCurrent()+".log",FILE_WRITE);
|
||||
@@ -363,10 +368,11 @@ int init()
|
||||
|
||||
|
||||
|
||||
MessageBox("Total Margin Required: ("+MargReq+")"+
|
||||
"\nMax Potential Loss: ("+MaximalLoss + ")"+
|
||||
"\nMax Potential Profit: " + MaxProfit+
|
||||
"\n\nMinimum Funds Required: "+MinReq,"",MB_YESNO);
|
||||
// Replaced MessageBox with Print - check logs for margin requirements
|
||||
Print("MARGIN INFO - Total Margin Required: ("+MargReq+")"+
|
||||
" Max Potential Loss: ("+MaximalLoss + ")"+
|
||||
" Max Potential Profit: " + MaxProfit+
|
||||
" Minimum Funds Required: "+MinReq);
|
||||
//Log("Msgbox: "+MaximalLoss+",rc="+rc);
|
||||
// if(rc==IDYES)
|
||||
// {
|
||||
@@ -807,7 +813,7 @@ bool ScanAllOrders()
|
||||
}
|
||||
}
|
||||
if(st!="")
|
||||
SendMailEx(Symbol() + " Position Closed",st);
|
||||
SendNotificationEx(Symbol() + " Position Closed",st);
|
||||
}
|
||||
|
||||
//+------------------------------------------------------------------+
|
||||
@@ -894,7 +900,7 @@ double CalcProfit(int MagicNumber)
|
||||
}
|
||||
}
|
||||
if(updateSt!="")
|
||||
SendMailEx(Symbol() + " Position Opened", updateSt);
|
||||
SendNotificationEx(Symbol() + " Position Opened", updateSt);
|
||||
return(shortProfit+longProfit);
|
||||
}
|
||||
|
||||
@@ -1053,7 +1059,8 @@ void SendEmailToBroker(int profit)
|
||||
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+"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;
|
||||
}
|
||||
if(stRange!="")
|
||||
SendMailEx(Symbol() + " Range Exceeded", stRange);
|
||||
SendNotificationEx(Symbol() + " Range Exceeded", stRange);
|
||||
}
|
||||
else
|
||||
Comment("The EA is not active");
|
||||
|
||||
Reference in New Issue
Block a user