Download MetaTrader 5

max lots size to trade with

To add comments, please log in or register
Take active part in the life of the community. Improve your rating!
dudenukem
57
dudenukem 2011.09.26 18:20 

I have the following question:

 how can I calculate the Lots I can use to enter a trade?(say the max lots size)

 for an account of say 100 $( the deposit ) and leverage 10:1 then following the logic I would have: max_lot_size= leverage * balance /1e5 = 0.01?

 I receive an error - not enough moeny ... 4753 :)

 ... 

Jimmy
490
Jimmy 2011.09.27 03:48  
dudenukem:

I have the following question:

 how can I calculate the Lots I can use to enter a trade?(say the max lots size)

 for an account of say 100 $( the deposit ) and leverage 10:1 then following the logic I would have: max_lot_size= leverage * balance /1e5 = 0.01?

 I receive an error - not enough moeny ... 4753 :)

 ... 

Lot size is determined by free margin and cost of 1 lot in base currency (left side currency of the pair) and not the account currency!

So it would be something like: max lot size = AccountFreeMargin/OrderCalcMargin(for 1 lot).

See the detail of the syntax in the documentation.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
dudenukem
57
dudenukem 2011.09.29 01:31  

it doesn't seem to work - in order to get rid of the annoying error I need to increase the deposit in the tester : the Lot (volume ) for the order is calculated by:


OrderCalcMargin(ORDER_TYPE_BUY,tradeReq.symbol,tradeReq.volume,tradeReq.price,tmpMargine);//tradeReq.volume=1

on success the volume to trade is calculated by


tradeReq.volume=AccountInfoDouble(ACCOUNT_FREEMARGIN)/tmpMargine;


to no avail I get the not enough money notification ....

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
dudenukem
57
dudenukem 2011.09.29 13:57  

put it in another way:

how to calculate the amount in lots for

MqlTradeResult volume?

so that you will not get the not enough money error?

Documentation on MQL5: Standard Constants, Enumerations and Structures / Data Structures / Structure of a Trade Request Result
  • www.mql5.com
Standard Constants, Enumerations and Structures / Data Structures / Structure of a Trade Request Result - Documentation on MQL5
To add comments, please log in or register