//+------------------------------------------------------------------+ //| Unit_Test.mq5 | //| Copyright 2023 - Dev.Solve LTDA | //+------------------------------------------------------------------+ //+------------------------------------------------------------------+ //| Macro definitions. | //+------------------------------------------------------------------+ #include "MacroDefinitions.mqh" //+------------------------------------------------------------------+ //| Includes. | //+------------------------------------------------------------------+ #include "EngineInputs.mqh" #include "Chart.mqh" #include "Engine.mqh" #include "Strategies/Strategies.mqh" #include "Stoploss/Stoploss.mqh" #include "Takeprofit/Takeprofit.mqh" #include "Money/Money.mqh" #include "ExpertFilter.mqh" //+------------------------------------------------------------------+ //| Global expert object | //+------------------------------------------------------------------+ //--- engine CEngine DevSolve_SDK; //--- filters CExpertFilter filters; //+------------------------------------------------------------------+ //| Global Variables | //+------------------------------------------------------------------+ int used_money=TipoDeRisco; // flag of using money int used_strategy=EstrategiaSelecionada; // flag of using of strategy int used_stoploss=TipoDeStopLoss; // flag of using of stop loss int used_takeprofit=TipoDeTakeProfit; // flag of using of takeprofit //--- other ticker string other_ticker; //--- only brokers and registered accounts const string allowed_brokers[] = {"Genial Investimentos Corretora de Valores Mobiliários S.A.", "XP Investimentos CCTVM S/A", "Modal DTVM Ltda.", "Raw Trading Ltd", "ActivTrades Corp" }; const long allowed_accounts[] = {514384619, 424634, 1859113, 3376653, 193804, 7381966}; //--- verify this EA is valid until datetime allowed_until = D'2024.03.26 00:00'; int password_status=-1; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //+------------------------------------------------------------------+ //| Checking Broker and Account | //+------------------------------------------------------------------+ string broker = AccountInfoString(ACCOUNT_COMPANY); long account = AccountInfoInteger(ACCOUNT_LOGIN); //--- printf("Corretora: %s", broker); printf("Número da conta: %d", account); for(int i=0; iallowed_until) { password_status=-1; Print("EA com licença vencida. A licença do EA expirou em: " + TimeToString(allowed_until, TIME_DATE|TIME_MINUTES)); } //--- failiure checking broker/account if(password_status==-1) return; //--- ok DevSolve_SDK.OnTick(); } //+------------------------------------------------------------------+ //| TradeTransaction function | //+------------------------------------------------------------------+ void OnTradeTransaction(const MqlTradeTransaction& trans, const MqlTradeRequest& request, const MqlTradeResult& result) { //--- DevSolve_SDK.OnTradeTransaction(trans,request,result); } //+------------------------------------------------------------------+ //| Tester function | //+------------------------------------------------------------------+ double OnTester() { //--- double ret=DevSolve_SDK.OnTester(); //--- return(ret); } //+------------------------------------------------------------------+ //| Symbol Function | //+------------------------------------------------------------------+ bool SetOtherTicker(string value) { if(value=="") { bool res=false; string symbol=Symbol(); //--- SYMBOL SINTETIC if(SymbolExist(symbol,res)) { if(res) { other_ticker=symbol; return(true); } } //--- WIN if(StringFind(symbol,"WIN",0)!=-1) { other_ticker="WIN$N"; return(true); } //--- WDO if(StringFind(symbol,"WDO",0)!=-1) { other_ticker="WDO$N"; return(true); } //--- IND if(StringFind(symbol,"IND",0)!=-1) { other_ticker="IND$N"; return(true); } //--- DOL if(StringFind(symbol,"DOL",0)!=-1) { other_ticker="DOL$N"; return(true); } //--- OTHER other_ticker=symbol; return(true); } else { bool res=false; if(!SymbolExist(value,res)) return(false); //--- other_ticker=value; return(true); } //--- failed return(false); } //+------------------------------------------------------------------+