Experts: Adding password protection to your Indicator / Expert Advisor - page 3

 
Claude Beaudoin:

Hidayat,

 

I have not been able to duplicate the error since my XP machine is now dead :(

Please run the revised code on both your machines and send me the screen captures.

Thank you.

Hello Mr.Claude,

I have tried this indicator with changes in init(), but going on getting the error,  "ExpertRemove Reason No.5".

Please help Sir.

 

Hello Mr.Claude,

I have tried this indicator with changes in init(), but going on getting the error,  "ExpertRemove Reason No.5".

Please help Sir.

 
sergiodv:

I'm getting the following errors. I am not sure why as I followed Claude's instruction as well as I could.


'Password_Check' - function not defined

and also

'Password_Check' - function can be declared only in the global scope


I'm not a coder so not sure how to remedy the situation.

Thanks in advance

There is a mistake in the last box

correct is:

//+------------------------------------------------------------------+
//| Validate client's password
//+------------------------------------------------------------------+
bool Password_Check(string client)
{
   string   MasterKey;
   uchar dst[], src[], key[];

   // Define your encryption key here.  Must be 7 characters for DES/ECB encryption
   // IT MUST BE THE SAME PASSWORD AS DEFINE IN THE "Password_Check()" function!
   // Make your password difficult to figure out.  You last name is not a good idea!
   // Something like "wLdU&$z" would be good.  For now, we'll use a simple one...
   MasterKey = "notdemo"; 
  
   // Convert MasterKey to character array
   StringToCharArray(MasterKey, key);
  
   // Encrypt the client using DES key
   StringToCharArray(client, src);
   CryptEncode(CRYPT_DES, src, key, dst);

   // Clear key and encode to BASE64
   ArrayInitialize(key, 0x00);
   CryptEncode(CRYPT_BASE64, dst, key, src);

   // Compare password and return result
   return(CharArrayToString(src) == Password);

}

 
Claude Beaudoin:

Hidayat,

 

I have not been able to duplicate the error since my XP machine is now dead :(

Please run the revised code on both your machines and send me the screen captures.

Thank you.

I have tried several times to make this work and I just don't know how to add it to my EA.  I get a lot of errors I don't understand.  Do I put it in the source code body?  Do I make up my own password?  Can you help me understand how to do this?  I am very new to this.  Thank you.

 
Thank you so much for your code.
 
Love it! Thank you very much! I'm learning a lot from these little snippets of code. 
 
Thank you Claude for the code, just the job and secure enough for distributing EA's. 
 
I encoded the Password Checker and already set the Master Key or Password but when I input the Indicator File to the chart, it bypass the password, even I type a wrong password, still the indicator will work normal. How to fix this, I don't receive any errors or warning about password incorrect.
 
Hello Lora, i've been sending you a DM but you don't reply.
 

Hey, thank you so much for the coding and explanation on everything to password protect my EA :)

I just have a couple questions for anyone who can answer...

1. When I 'compile' my source code after going through the 'password_check' process of putting in all the codes you have given, I always get some errors. I get an error that says ''init - function already defined and has body"'.. How do I fix that?
2. Secondly, how exactly does that "password_generate" part work? Where do I place that code (separate from the other coding?)? Also, how exactly do I run it? I guess I'm slightly confused.

Any and all help is greatly appreciated. Thanks,

-Tyler