How do i put max lot size how in a ea?

 

Helloo

I need codes for max lot size so the lot size wont be bigger than example 0.6

Im not a programmer so can someone explain what kind of code i need and

how must i put it in the ea?

I have add this in the ea extern double MaxLots = 0.08; but what must i put more in the ea and where?

and is this correct? (extern double MaxLots)

Tnx for the help!!!

 
mart87:
Helloo

I need codes for max lot size so the lot size wont be bigger than example 0.6

Im not a programmer so can someone explain what kind of code i need and

how must i put it in the ea?

I have add this in the ea extern double MaxLots = 0.08; but what must i put more in the ea and where?

and is this correct? (extern double MaxLots)

Tnx for the help!!!

mart87

You must put it in each and every call to OrderSend() function which actually open orders (prior to attempt to open an order).

 

I must put this behind/below call to ordersend

extern double MaxLots = 0.08;?

 
mart87:
I must put this behind/below call to ordersend extern double MaxLots = 0.08;?

mart87, this is the format of OrderSend() function (that is used to open a new order, among other things):

int OrderSend(
string symbol,
int cmd,

double volume,

double price,

int slippage,

double stoploss,

double takeprofit,

string comment=NULL,

int magic=0,

datetime expiration=0,

color arrow_color=CLR_NONE)

Volume (lots) is what you have to pay attention to and any trading volume you wish to use must be corrected and adjusted prior to calling OrderSend() function. It is not a variable that has some particular name (it all depends on the coder - each and every EA can have different name for that variable) but is what you define when you call the OrderSend() in order to open a new order

 

this i have if (AccountisNormal==1) {

if (mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000); }

else { lotsi=Lots; }

} else { // then is mini

if (mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000)/10; }

else { lotsi=Lots; }

}

if (lotsi>100){ lotsi=100; }

if i set if (lotsi>100){ lotsi=100; } to if (lotsi>100){ lotsi=0.08; } when i change the 100 to 0.08 will it be the max lot size 0.08?

 
mart87:
this i have if (AccountisNormal==1) {

if (mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000); }

else { lotsi=Lots; }

} else { // then is mini

if (mm!=0) { lotsi=MathCeil(AccountBalance()*risk/10000)/10; }

else { lotsi=Lots; }

}

if (lotsi>100){ lotsi=100; }

if i set if (lotsi>100){ lotsi=100; } to if (lotsi>100){ lotsi=0.08; } when i change the 100 to 0.08 will it be the max lot size 0.08?

No change that line to this

if (lotsi>0.08){ lotsi=0.08; }

And you are going to limit maximal lot size to 0.08