Download MetaTrader 5

Maximum available lots per trade

To add comments, please log in or register
C0mput3r
162
C0mput3r  

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
10617
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.
C0mput3r
162
C0mput3r  
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