Block EA only for a specific account - page 2

 

Hello..

Can some one help me about learning return(0) vs return(-1) and return(1) in Expert advisor

What is diffrerence from each return(0), return(-1) and return(1) ?

 

i key in stuff below b4 'think' wat maybe u really on about so probably not wat u want is it?

maybe u wonder why EA returns -1,0,1 and maybe WHY does/should it do such

this wat you on about?

and if so, then please tell me when u find out - lol

ie, i use ERR_NO_ERROR or ERR_COMMON_ERROR which is 0 or 2.

is wat i do cuz if code get error then why not return ERR_COMMON_ERROR ?

not really bother - code has internal global which it tests when called and if == ERR_COMMON_ERROR then it return straight away without doing work.

.

(expression) is a value which function caller will get when return is executed...

return(expression)

expression - see help on "functions"

return - see help on "return" operator

.

hth

 

Hi guys,

I was searching for guidelines and I came reading on this post. I need some explanation on this:

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
 {   
 
//Account Verification Code
{
if(( AccountNumber() == liveAccountNumber) || ( AccountNumber() == liveAccountNumber2))
{
   Print("Account Number Authorized. Thank You for your purchase.");
   Alert("Account Number Authorized.");
   return(1);
}
else
{
   Print("Account Number not Authorized.");
   Alert("Account Number not Authorized,Thank You.");
   return(-1);
}
}
//Account Verification Code

I place my int liveAccountNumber at the beginning of the codes:

int MaxLongPendingOrders = 1000;
int MaxShortPendingOrders = 1000;
int liveAccountNumber = 535621;
int liveAccountNumber2 = 737213;

i was compiling it and it was shown no errors... When i placed it onto my charts, alert message pops up because account number is different... but the EA still loads as per normal...under EXPERTS tab, it still states loaded successfully...

The code just made it pops up an alert message that's all but doesnt prevent people from using it...

Advise needed please. Thank You.

Reason: