- Search for it,
- learn to code it
- Beg at Coding help - MQL4 and MetaTrader 4 - MQL4 programming forum or Need help with coding - General - MQL5 programming forum or Free MQL4 To MQL5 Converter - General - MQL5 programming forum or Requests & Ideas (MQL5 only!),
- or pay (Freelance) someone to code it.
No free help
urgent help.
help me i need to limt my Ea to work under certain accounts that i choose. like i want to give it to my clients but they can only use it under one acc can you please help me with the code for that. also i want the EA to work for a period of time then expire .like a month or year i would really appreciate the mql4 code
Use something like the below:
#define ExpiredErr "Please contact the seller, this version has expired. " int YearLimit=2017; int MonthLimit=9; int AccLimit=123; int OnInit() { //--- Enable Trail if(Year() >= YearLimit && Month() > MonthLimit) {Comment(ExpiredErr); Alert(ExpiredErr); return(INIT_FAILED);} if(AccountNumber() != AccLimit) {Comment(ExpiredErr); Alert(ExpiredErr); return(INIT_FAILED);} //--- return(INIT_SUCCEEDED); }
You have only four choices:
- Search for it,
- learn to code it, (you couldn't be bothered to learn MQL4/5, therefor there is no common language for us to communicate,)
- Beg at Coding help - MQL4 and MetaTrader 4 - MQL4 programming forum or Need help with coding - General - MQL5 programming forum or Free MQL4 To MQL5 Converter - General - MQL5 programming forum or Requests & Ideas (MQL5 only!),
- or pay (Freelance) someone to code it.
No free help
urgent help.
Usually, new created accounts hides some one who is a freelancer developer here or there and he/she want to know something without showing his/her name to all.
Here is a sample of my own code that I use, but it is up to you to implement properly. I'm not offering any support on it. It is up to you to do the necessary research and learning.
//+------------------------------------------------------------------------------------+ // Initialisation Event Function //+------------------------------------------------------------------------------------+ int OnInit() { // Check Licensing Restrictions if( boolRestrictOnInit() ) return( INIT_FAILED ); // ... return( INIT_SUCCEEDED ); // Initialisation complete } //+------------------------------------------------------------------------------------+ // Tick Event Function //+------------------------------------------------------------------------------------+ void OnTick() { // Check Licensing Restrictions if( boolRestrictOnTick() ) return; /// ... } //+------------------------------------------------------------------------------------+ // Function to Test Restrictions during Initialisation //+------------------------------------------------------------------------------------+ bool boolRestrictOnInit() { boolRestrictions = boolRestrictExpiration || boolRestrictAccountNumber || boolRestrictAccountName || boolRestrictAccountServer || boolRestrictAccountCompany || boolRestrictDemoAccount || boolRestrictSymbols; if( boolRestrictions ) { boolRestrictionsUnverified = true; if( (bool) TerminalInfoInteger( TERMINAL_CONNECTED ) ) { long longAccountNumber = AccountInfoInteger( ACCOUNT_LOGIN ); if( longAccountNumber > 0 ) { if( boolRestrictAccountNumber ) { if( longAccountNumber != longRestrictAccountNumber ) { return( boolRestrictAlert() ); } } if( boolRestrictAccountName ) { if( AccountInfoString( ACCOUNT_NAME ) != strRestrictAccountName ) { return( boolRestrictAlert() ); } } if( boolRestrictAccountServer ) { if( AccountInfoString( ACCOUNT_SERVER ) != strRestrictAccountServer ) { return( boolRestrictAlert() ); } } if( boolRestrictAccountCompany ) { if( AccountInfoString( ACCOUNT_COMPANY ) != strRestrictAccountCompany ) { return( boolRestrictAlert() ); } } if( boolRestrictDemoAccount ) { if( AccountInfoInteger( ACCOUNT_TRADE_MODE ) != ACCOUNT_TRADE_MODE_DEMO ) { return( boolRestrictAlert() ); } } if( boolRestrictSymbols() ) { return( boolRestrictAlert() ); } boolRestrictionsUnverified = false; } } } return( false ); } //+------------------------------------------------------------------------------------+ // Function to Test Variations of Restricted Symbols //+------------------------------------------------------------------------------------+ bool boolRestrictSymbols() { if( boolRestrictSymbols ) { int intSymbolCount = ArraySize( strRestrictSymbols ); if( intSymbolCount == 0 ) return( false ); for( int i = 0; i < intSymbolCount; i++ ) { if( StringFind( _Symbol, strRestrictSymbols[i] ) != WRONG_VALUE ) return( false ); int intLen = StringLen( strRestrictSymbols[i] ), intHalf = intLen / 2; string strLeft = StringSubstr( strRestrictSymbols[i], 0, intHalf ), strRight = StringSubstr( strRestrictSymbols[i], intHalf, intLen - intHalf ); if( ( StringFind( _Symbol, strLeft ) != WRONG_VALUE ) && ( StringFind( _Symbol, strRight ) != WRONG_VALUE ) ) return( false ); } return( true ); } return( false ); } //+------------------------------------------------------------------------------------+ // Function to Test Expiration during Tick Events //+------------------------------------------------------------------------------------+ bool boolRestrictOnTick() { if( boolRestrictions ) { if( boolRestrictionsUnverified ) return( boolRestrictOnInit() ); if( boolRestrictExpiration && ( TimeCurrent() >= dtRestrictExpiration ) ) return( boolRestrictAlert() ); } return( false ); } // Function to Alert User of Licensing Restrictions and Remove Code from Execution bool boolRestrictAlert() { if( boolRestrictAlert ) MessageBox( strRestrictAlertMessage, strRestrictAlertCaption, MB_ICONERROR ); ExpertRemove(); return( true ); } //+------------------------------------------------------------------------------------+ // Variables for Handling of Licensing Restrictions //+------------------------------------------------------------------------------------+ bool boolRestrictExpiration = false, // Set to true, to use an Experation Date boolRestrictAccountNumber = false, // Set to true for Restricting by Account Number boolRestrictAccountName = false, // Set to true for Restricting by Account Name boolRestrictAccountServer = false, // Set to true for Restricting by Account Server boolRestrictAccountCompany = false, // Set to true for Restricting by Account Company boolRestrictDemoAccount = false, // Set to true, to only allow Demo Accounts boolRestrictSymbols = false, // Set to true, to only allow certain Symbols boolRestrictAlert = true, // Display Alert Message when Restrictions apply boolRestrictionsUnverified = false, // DO NOT CHANGE. For internal use only! boolRestrictions = false; // DO NOT CHANGE. For internal use only! datetime dtRestrictExpiration = D'2017.03.31'; // Restricted by Expration Date long longRestrictAccountNumber = 123456789; // Restricted by Account Number string strRestrictAccountName = "Client Name", // Restricted by Account Name strRestrictAccountServer = "Server Name", // Restricted by Account Server strRestrictAccountCompany = "Company Name", // Restricted by Account Company strRestrictSymbols[] = { "EURUSD", "GBPJPY", "NZDCAD" }, // Restricted Symbols strRestrictAlertCaption = "Restrictions", // Alert Message Box Caption strRestrictAlertMessage = "ATTENTION! Due to Licensing Restrictions, code execution has been blocked!"; // Message to be used when Restrictions have been detected //+------------------------------------------------------------------------------------+
Here is a sample of my own code that I use, but it is up to you to implement properly. I'm not offering any support on it. It is up to you to do the necessary research and learning.
thank you i will try and use this
Now that I have helped you, you can now send me your EA as promised in your other thread:
Forum on trading, automated trading systems and testing trading strategies
ea code to work on a selected account
dollarpap, 2017.09.04 11:26
any one who is good in coding eas .i have an EA but im struggling to code it to work under a certain account. like lets say im giving it to my client i want it to work only on their acc . if the acc is 24689 then it should work only on that. anyone that can help me im gonna share the EA with because it really works. email me [email deleted by moderator]Use something like the below:
i will try this ,so i must just put this code anywhere
Now that I have helped you, you can now send me your EA as promised in your other thread:
Promises, Promises! Well, still waiting ...
Don't tell me you only intend to share a locked down executable and not the source?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
help me i need to limt my Ea to work under certain accounts that i choose. like i want to give it to my clients but they can only use it under one acc can you please help me with the code for that. also i want the EA to work for a period of time then expire .like a month or year i would really appreciate the mql4 code