"As money plus swap and commission" block not working fine.
-
Project for tests : https://fxdreema.com/shared/OyxArLenb
I found something that I believe is a Bug (problem).
There is a condition called:
(in loop) Trader / Order in Loop that when selected the "profit" field enables a choice of options and the one chosen in my case was "As money plus swap and commission"When I use this condition logically, I place a block above it called "For Each Position".
My target value as a test I used 2 $, and I connected a closed block then ordering to close all open trades when my profit is 2 $.
What I thought is that if I configured it this way in the project, then when the value of "gain + swap + commission" when reaching the value of 2 $ would close the negotiations exactly at this value or higher giving me the profit on the operation . But what is happening is that he is not doing this, he is closing some with a profit of 2 $ or more and others even negative so I assume this is a calculation problem in the block.
Please check this ? -
-
@fabiobioware please help @FXDREEMA
-
@fabiobioware it work right

-
@miki I didn't understand what you meant ...
You are showing a metatrader screen and not a calculation being done by the block.
What I am trying to say is that the calculation that this block should do is not correct. -
@miki Put it to monitor on a variable and you'll know what I'm talking about.
-
@fabiobioware the calculation is correct the swap and the commissions are negative numbers that it adds to get the 2 of profit. For what you want you have to calculate them individually and add them as positive numbers.
-
@miki said in "As money plus swap and commission" block not working fine.:
the calculation is correct the swap and the commissions are negative numbers that it adds to get the 2 of profit. For what you want you have to calculate them individually and add them as positive numbers

I put a comparison on this project using the "Bucket of positions"
In the first image when there is only 1 single trade, the values are the same for both "For each Position" and "Bucket of Position"
When I have more than one open trade the calculation is totally different.
See the last image I sent:The Bucket of Positions block is showing the sum value of only Profit including the sum of the Swap of all transactions in his account by recording the total win amount of ($ 107.38). This calculation is correct.
The "As money plus swap and commission" is showing a wrong amount. ($ 59.38), but it should show the value that Bucket Of Positions is showing. Or am I wrong?
-
@miki Take another look at this example: now a negative swap value and a negative order are appearing.
Follow the project. https://fxdreema.com/shared/LOdfqtsCc
-
@fabiobioware as money shows you only the last position loaded because you don't add the old variable with the new one :
As_Money + As_Money and in the end of the loop(yellow exit) As_Money must be reset to 0https://fxdreema.com/shared/uulRnwj5
Without swap

with swap

The calculation is correct
-
@miki Thanks for the help my friend.
But we can then conclude that the correct function of the block should be to perform the complete calculation of all open orders and this is precisely what he is not doing and for this reason, did you insert a formula for this calculation to be included?
In your opinion, is the existing problem confirmed? -
@miki Or can we conclude that to avoid using this block, we can then use "Bucket of positions" that it is working correctly and even performing calculations including swaps and commissions?
-
@fabiobioware I would say that for convenience in this case it is better to use "Bucket of position". It does the same steps as "For each Position" but they are implicitly contained within
