Job finished
Execution time 14 days
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Feedback from employee
A smart and patient customer with good coordination skill.
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Feedback from customer
Top programmer, highly recomended
Specification
Hi guys,
I need a code to carry out a web request to verify account number and password to secure my ea template. So when the ea is started a webrequest is done to check if account number and passwords is authorized to use the EA. API part is all set up
the list is in the following format
so the steps are
1. login to api
2.check if account number and password are there.
3. if account number and password are there, run the EA. IF not shut down EA.
number of account number password
12345.... example...........
I have attached some code if it helps.
class CLicenseOnline : public CObject { private: string m_login; string m_password; datetime m_nextCheck; int m_prevResult; string m_url; int m_strategyId; public: CLicenseOnline(const string login,const string password,const int id): m_login(login),m_password(password),m_nextCheck(0),m_strategyId(id),m_prevResult(-1) { bool isCheckingRequired=false; if(CLicenseOnline::isSuperAdmin(login,password)) { printf("%i %s - Hello, SUPER ADMIN!",__LINE__,__FILE__); isCheckingRequired=true; } isCheckingRequired= isCheckingRequired || IsTesting(); if(isCheckingRequired) { m_nextCheck=INT_MAX; m_prevResult=1; } else { m_url=CLicenseOnline::genUrl(login,password); } } ~CLicenseOnline(){} int check() { if(TimeCurrent()>m_nextCheck) { int result=this.checkMain(); switch(result) { case 1: m_nextCheck=this.generateNextDate(); m_prevResult=1;break; default: case 0: m_nextCheck=TimeCurrent()+PeriodSeconds(PERIOD_M1); m_prevResult=0;break; case-1: m_nextCheck=TimeCurrent()+PeriodSeconds(PERIOD_H1); m_prevResult=-1;break; } } return(m_prevResult); } static string genUrl(const string login,const string password) { const string http="localhost"; return(StringFormat("http://%s/verify/?Login=%s&&Password=%s&&Check=%d",http,login,password,2147483647)); } static string getHttpResponce(const string url) { char data[],res[]; string cookies=NULL, headers=NULL,result; ResetLastError(); int answer = WebRequest("GET",url,cookies,NULL,5000,data,0,res,headers); if(answer==200) { result = CharArrayToString(res); return(result); } //printf("%i - result=%d|%s|size=%d; %d",__LINE__,answer,result,ArraySize(res),GetLastError()); return(NULL); } private: static bool isSuperAdmin(const string login,const string password) { static string superAdminLogin="Admin", superAdminPassword="password"; //ATTENTION! Edit the login and password here! return login==superAdminLogin && password==superAdminPassword; } datetime generateNextDate()const { return(iTime(_Symbol,PERIOD_D1,0)+PeriodSeconds(PERIOD_D1)+MathRand()%PeriodSeconds(PERIOD_D1)); } int checkMain()const { string respond=CLicenseOnline::getHttpResponce(m_url); if(respond==NULL) return(0);//try later CJAVal js(NULL,jtUNDEF); if(!js.Deserialize(respond)) { printf("%i %s - failed to deserialize %s",__LINE__,__FUNCTION__,respond); return(-1); } int retCode=(int)js["key"].ToInt(); switch(retCode) { case -1: Alert("incorrect password");return(0); case -2: Alert("incorrect key!");return(0); case -3: Alert("incorrect request method!");return(0); case -4: case -5: Alert("no such login");return(0); default: Alert(StringFormat("%i %s - incorrect login/password/no such user!",__LINE__,__FUNCTION__)); return(0); case 200: { CJAVal *valueJs=js["value"]; if(!this.checkStatus(valueJs["Status"].ToStr())) return(-1); if(!this.checkAccount( (int)valueJs["Allow_account_1"].ToInt(),(int)valueJs["Allow_account_2"].ToInt(),(int)valueJs["Allow_account_3"].ToInt())) return -1; bool strategyX=(bool)valueJs["Allow_strategy_"+(string)m_strategyId].ToBool(); if(!stategyX) { return(-1); } return(1); } } return(-1); } bool checkStatus(const string status)const { //printf("%i %s - status = |%s|%d",__LINE__,__FUNCTION__,status,IsDemo()); if(status=="demo") { if(!IsDemo()) { string message=StringFormat("your login %s is allowed to trade on Demo accounts only!",m_login); Alert(message); printf("%i %s - %s",__LINE__,__FILE__,message); return(false); } return(true); } if(status!="active") { string message=StringFormat("status of your login [%s] is [%s] so not allowed to trade!",m_login,status); Alert(message); printf("%i %s - %s",__LINE__,__FILE__,message); return(false); } return(true); } bool checkAccount(const int acc1,const int acc2,const int acc3)const { if(acc1==0 && acc2==0 && acc3==0) return(true); int currentAccount=AccountNumber(); if(acc1==currentAccount || acc2==currentAccount || acc3==currentAccount) return(true); string message=StringFormat("allowed accounts are only %d, %d and %d, your account %d is not allowed!",acc1,acc2,acc3,currentAccount); Alert(message); printf("%i %s - %s",__LINE__,__FUNCTION__,message); return(false); } };
Responded
1
Rating
Projects
0
0%
Arbitration
1
0%
/
100%
Overdue
0
Free
2
Rating
Projects
1
0%
Arbitration
2
0%
/
100%
Overdue
0
Free
3
Rating
Projects
68
25%
Arbitration
12
42%
/
42%
Overdue
4
6%
Free
4
Rating
Projects
143
34%
Arbitration
10
10%
/
60%
Overdue
26
18%
Free
Similar orders
COPY AN IDICATOR TO MT5
30+ USD
Hi, I have an indicator from my friend, I want to copy it to my own MT5 can you do that for me. Here is the link
Arbitration bot for cryptocurrency/forex
50 - 80 USD
I'm looking for someone to help me create an arbitrage trading robot that can trade on any decentralized exchange and forex market. I already have some source code to a strategy but would like to enhance it to make it profitable and automated
I installed the E.A. into the Experts folder in MT4. When I double click on it nothing happens. When I right click and "attach to chart" nothing happens. The E.A. is not grayed out, it simply will not attach. Any help would be greatly Appreciated
Modify MQL5 EA for some new logics
30 - 100 USD
I have an EA and want to add few new logic to fetch profit taking factors and other values from an external master data and use it in existing EA
Profitable Expert Advisor
100 - 200 USD
Hello Every one, Good day, I want from someone professional to create an EA is working on Mt5, This EA is working by depend on some indicators, and all those indicators must be working on MACD window, not on the chart, for more details please read my attached pdf file carefully. Many Thanks
I'm looking for an expert MQL5 developer that can create an EA that's based on my price action trading strategy with no indicators. The EA must analyze trades based on my price action rules, enter trades based on my price action rules, manage trades based on my price action rules and exit trades based on my price action rules
hi hi there i have an strategy on tradingview and i want to automate it like metatrader EA so i want the strategy to open and close trade automaticlly on tradingview
Expert Advisor Developer for MT5
30 - 100 USD
We are looking for an experienced Expert Advisor Developer who can build a customized MT5 Expert Advisor for us. The Expert Advisor would use two built-in indicators as entry/exit signals and our own risk management strategy with customizable inputs. The goal is to create a reliable and efficient trading tool that can automate our trading process on the MT5 platform. Skills required: - Strong understanding of
Need stochastic divergence ea
30 - 40 USD
I need stochastic div (hidden ®ular ea) that should perform task in all tf's ..divergence is a repaint stly so i want to use it with candlestick flips .. so bet for it
Replicate indicator to mt5
30+ USD
Hello, I have an indicator from a friend and I'd like to replicate it on my own TradingView or MT5 platform. Could you assist me with that?. Here is the link
Project information
Budget
30+ USD
For the developer
27
USD