Calculate lot for expert advisor
Hello,
I'm struggling with something stupid here, don't know what I'm doing wrong.
I want to trade one lot for every 10000 I have in my account. So if I have 15000 in my account, the lot traded should be 15000/10000, and that is 1.5 lots.
This worked in MQL4, but in MQL5 it won't work. I even normailzed the double to zero decimal places, but it still won't work. If I don't give it a solid interger value the order won't go through. Any idea why this won't work ?
Thanks
void OnStart() { double ab=AccountInfoDouble(ACCOUNT_BALANCE); double lot_size=ab/10000; Print("lot_size=",lot_size); }See Typecasting
Hello,
I'm struggling with something stupid here, don't know what I'm doing wrong.
I want to trade one lot for every 10000 I have in my account. So if I have 15000 in my account, the lot traded should be 15000/10000, and that is 1.5 lots.
This worked in MQL4, but in MQL5 it won't work. I even normailzed the double to zero decimal places, but it still won't work. If I don't give it a solid interger value the order won't go through. Any idea why this won't work ?
Thanks