[Archive!] Writing an advisor for free - page 72

 
sanyooooook:
set here, and justify that it will not work )

sanyooooook,

Please advise where to put the account number to make this EA work on this account only.

Here is an example:

int start()

{

// if(AccountNumber()!=123) return(0);

 
extern int pass = 123;
int start()

 {

  if(AccountNumber()!=pass) return(0);
 
Roger:

yep
 
Thank you, it works.
 
Good day to all! Some advice for a beginner. There is a 2MA EA, how and where to redirect it to trade on custom indicator BWAosig. I am very interested in the clear example. The EA and the indicator are enclosed. Many thanks in advance.
Files:
 
turkey
Files:
bwaosig_1.mq4  4 kb
 
Hi! Would you be able to write an EA based on the indicator attached below. The indicator is based on a price channel, often overdraws true, but the gist could be interesting. The Expert Advisor should make a trade when a buy or sell arrow appears, and exit this trade when it appears in the opposite direction. I would be very grateful if anyone would respond!

Files:
1.mq4  2 kb
 

Somebody tell me what to do to change the volume of the lot in the advisor because it always buys at 0.1

//xxxxxxxxxxxxxxxxxxxxxxxxx
double lot(int R) { double minlot = MarketInfo(Symbol(), MODE_MINLOT);
int o = MathAbs(MathLog(minlot) *0.4343) + 0.5;
double lot = minlot;
//ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
lot = NormalizeDouble(AccountFreeMargin() * 0.00001*R, o);//---
if (AccountFreeMargin() < lot * MarketInfo(Symbol(), MODE_MARGINREQUIRED)) {
lot = NormalizeDouble(AccountFreeMargin() / MarketInfo(Symbol(), MODE_MARGINREQUIRED), o);
}
//ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
if(lot < minlot) lot = minlot;
double maxlot =MarketInfo(Symbol(), MODE_MAXLOT);
if(lot > maxlot) lot = maxlot;
return(lot); }
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 
RaF:

Somebody tell me what to do to change the volume of the lot in the advisor because it always buys at 0.1

//xxxxxxxxxxx
double lot(int R) { double minlot = MarketInfo(Symbol(), MODE_MINLOT);
int o = MathAbs(MathLog(minlot) *0.4343) + 0.5;
double lot = minlot;
//ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
lot = NormalizeDouble(AccountFreeMargin() * 0.00001*R, o);//---
if (AccountFreeMargin() < lot * MarketInfo(Symbol(), MODE_MARGINREQUIRED)) {
lot = NormalizeDouble(AccountFreeMargin() / MarketInfo(Symbol(), MODE_MARGINREQUIRED), o);
}
//ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
if(lot < minlot) lot = minlot;
double maxlot =MarketInfo(Symbol(), MODE_MAXLOT);
if(lot > maxlot) lot = maxlot;
return(lot); }
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Actually remove ....... and put the line extern double lot = 0.5; or whatever you need !
 

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

extern double lot = 0.5

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

right? there's nothing else

Reason: