MT5 tries to open 250 lots position when it shoudn't
-
Hello,
I have below scheme.
The box on the left tries to open 250 lots the box on the right opens normaly (around 0.2 lots).
Please, what am i doing wrong? It's driving me crazy. Thank you.

-
@akulus Can you please share the link to the project instead? That would be easier to check.
-
shared project. thank you.
https://fxdreema.com/shared/4icrQOqqe
I have a version in MT4 with the same variables and formulas and it opens correctly. It might be something specific to MT5 but I have no idea what.
-
why would you put math in there? its already a percentage so a calculation is happening to give you a lot size. If you are doing math on top of math, it will probably produce errors. Id advise just using a small number like..1....or a decimal like .1. You may also want to play with % of Balance <> Lots, as well as % of Balance. Very different results
-
@tipsywisdom thank you. I have eliminated the calculation and it stil tries to open 250 lots.
-
I tried this on EURUSD with 10,000 initial balance and it gives me lots of 0.01 every time. Actually I tried your current version where the calculation is lot_size*0.0001/2. The default value of lot_size is 6 and with that the % is some really small number. Even if you put 100 in the input field, the lot size should be normal.
The idea of this option is that if you have $1000, the lot size would be 0.01 lots, if you have $10.000 the lot size would be 0.1 lots and of course if you have $100.000 the lot size would be 1.
So I don't see something wrong in the project... well, you are maybe using the wrong option, because the input value for the option is too small. But what is wrong is that if anything, you should see only lots of 0.01 or whatever the minimum is. I programmed it so if the input value for the lot size is lower than the minimum, the minimum is taken (and the same goes for the maximum value).
Put some Comment block before of after the Buy block to print what is really the value of lot_size*0.0001/2. It should be 0.0003. Also try to write a value directly - 5, 10, 100, 200.
If nothing works, what is the symbol you are tesing on? Give us the information about it from the Symbols list.
-
@fxdreema thank you for the response.
(With % of equity it worked but it’s not exactly what i want.) LE: it may have worked in a version for mt4, i don’t remember very well.
The simbol is SPX500 on mt5, icmarkets.
I am testing it on a small real account of 200 EUR.
The other order at 14.00 hours is opened correctly.
This is the message in the journal:

That 0.1 trade is opened manualy
-
Is this 250 attempt really made by this EA? Maybe there is another one working in the background?
The Equity is even lower number than the Balance, but not very different after all. I really don't know what is the problem. But just in case, place some block to print the value, maybe Alert message.
-
@akulus said in MT5 tries to open 250 lots position when it shoudn't:
SPX500
are you trading indices on icmarkets?
If yes i would suggest you to make the lot/trade size calculation by your own ( in seperate step by a formula) on fx pairs you shouldnt see such issues. -
Thank you bk7 for the suggestion.
It seems this workaround works. It just opened 0.2 lots order.
For anyone who has the same issue, this worked for me: