Bucket of Positions Not Giving Open Lots - MT5
-
Hello, I need help please. I am building an MT5 EA where I have to keep track of 6 individual trades and use their lot sizes when opening other trades. I used Bucket of Positions to achieve this. The problem is the buckets doesn't give any value for the lot size although there is open trade on that bucket. When I open a trade using a bucket lot size, the opened trade is always 0.01 lot as the bucket lot size is null. I confirmed it by commenting the total lots of grey bucket which has an open trade, and no value was shown on the comment during testing. Am I doing something wrong?



I have read on some posts here on the forum that Bucket of Positions can be buggy on MT5. In that case, how will I achieve the same using a different approach? For example, is there a way of using Magic Numbers instead? Can I assign specific magic numbers to each trade so I can track when those trades are opened or closed, and also check the open lots for specific magic numbers? I will also need partial closing of positions, so will a position retain its magic number after partial close?
Sorry for the lengthy question. Thanks in advance!
-
Yes, that block doesn't work correctly on MT5. Can't you try it on MT4 instead?
-
You can create like below for as many trade types as needed:
https://fxdreema.com/shared/jyG984D4b -
@l-andorrà Thanks for the reply. That might be my last option as I prefer the ease of testing in MT5.
-
@jstap Thank you for this! Appreciated. I'll try this approach and see.