Best Volume

 

Hey Every1,

I need to find out what options we have in MQL for working with volumes/sizes. We do get the best market bit and ask prices, but how do we find what amount is the user willing to buy or sell?

Regards,

Master

 
Well when developing your EA you should include some options which will affect how many lots to trade or you can just have as fixed lots and the user can change that at their will. There is no in built function for calculating lot sizes.
extern double Lots = 0.1;
extern int Slippage = 5; // Adjust for 5 point brokers

// If you then use the following for buy's
OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLoss, TakeProfit, comment, magic, 0, CLR_NONE);

// and for sell's 
OrderSend(Symbol(), OP_Sell, Lots, Bid, Slippage, StopLoss, TakeProfit, comment, magic, 0, CLR_NONE);

Or

double Lots;

Lots = CalcLots();

double CalcLots()
{
// Calculations to work out lots according to Money management
 return (Lots);
}