Download MetaTrader 5

Maximum available lots per trade

To add comments, please log in or register
Interested in earning money via MQL5 Cloud Network? Enter your profile!
C0mput3r
168
C0mput3r 2016.11.25 11:35 

Hi Guys,

I'm trying to write a code so that each trade is executed with the maximum available lots according to my account balance, but I am receiving a '*' constant expected error the whole time. Could anyone giving me some advise on how to fix this?

I have LotSize in my OrderSend code  

         double AccountBalance = AccountInfoDouble(ACCOUNT_BALANCE);
         double Leverage = AccountInfoInteger(ACCOUNT_LEVERAGE);
         extern double LotSize = ((((AccountBalance/Ask)*Leverage) - 1)*0.0001);

Thanks in advance!

Anton

Keith Watford
Moderator
9627
Keith Watford 2016.11.25 11:44  

         extern double LotSize = ((((AccountBalance/Ask)*Leverage) - 1)*0.0001);
extern is an input so it cannot be the result of a calculation. Remove extern and just make it a double.
C0mput3r
168
C0mput3r 2016.11.25 11:46  
Keith Watford:

         extern double LotSize = ((((AccountBalance/Ask)*Leverage) - 1)*0.0001);
extern is an input so it cannot be the result of a calculation. Remove extern and just make it a double.
Thanks Keith, I really appreciate it!
To add comments, please log in or register