Lots multiplication problem
-
Good evening everyone, I'm trying to understand how to open a second (third, fourth, etc.) trade when the first is at a loss but using a low multiplication, for example 1.1.
I'm using "for each trade" and a variable that takes the trade lot and then multiplies it using a formula, but of course it keeps repeating the same size without multiplying it. If you start from 0.01 and multiply by 1.1 the result is 0.011 but is rightly rounded to 0.01. The 0.02 will never be opened since every time the digits from thousandths onwards will be lost.
Does anyone know the way to do this?
-
This will happen until you get to 0.1, check the last trade lot, if < 0.1 add 0.01 (or whatever number you find relevant), if => 0.1 multiply
-
The point is that I would like to multiply, not add. When the multiplication occurs, for example 0.01 *1.1 = 0.011, there is a way to "write" the exact lot (which will then be rounded by the broker) but the expert will take into consideration the correct size for the next multiplication (with decimals)?
-
Yes, but you cannot with such a small number from such a small lot. 1.011 would need to be at least 1.016 to = 1.02, so what I put is doing what you asked.
-
@jstap Of course this is clear, the problem is by using this method from 0.01 you immediately go to 0.02. Instead, I would really like to respect the sequence by using a multiplication of *1.1 (or *1.2):
Starting from 0.01: 0.011 / 0.0121 / 0.01331 / 0.014641, only at the fourth multiplication is 0.02 opened
Starting from 0.02: 0.022 / 0.0242 / 0.02662 at the third multiplication 0.03 is opened and you can continue up to a starting size of 0.05, from then on it would multiply correctly.This is very useful for using low lots but continuing to lower the average entry price even with small capital.
-
I am not sure you understand, the next up from 0.01, is 0.02, if you want 0.015 then you can not achieve this on Meta Trader (maybe some accounts use 0.000) but if so I do not know how to use, or what accounts that would be.
-
@Crisfx the market has minimum tradable lots, you can see it in your broker's specifications. Almost all brokers do not have sizes lower than 0.01

-
Of course, I know this, as I wrote in my second post the value will always be rounded up by the broker. I am interested in the expert making the calculation considering the "correct" number multiplied. By doing this, starting from 0.01 and multiplying *1.1, the expert will calculate the next lot at 0.011, the broker will open at 0.01, no problem. However, the expert will have to "know" that the correct lot according to the multiplication was 0.011 and multiply the next trade starting from this value.
By doing so, after opening 3 trades at 0.01 he will open the fourth trade at 0.02.
-
@Crisfx ah ok, now i understand. You have to create a variable and use it like this (the variable will be reset when there are no trades)

-
@ambrogio This is exactly what I was looking for, thank you very much!
-
-
@ambrogio I tried in the demo to simulate a crash/restart/update of MT4 when it already had trades in progress, the problem is that the correct multiplication does not continue:
Let's imagine we started from 0.01 and multiplied *1.1
1 trade 0.011 broker rounds to 0.01
2 trades 0.0121 broker rounds to 0.01
3 trades 0.01331 broker rounds to 0.01
4 trade 0.014641 broker rounds to 0.01
5 trades 0.0161051, the broker rounds to 0.02If at this moment a crash or restart of MT4 occurs, the variable is lost and it starts again from 0.01.
-
this is beyond my knowledge, I think jstap suggested something somewhere about global variables, I suggest you to do a search or tag him directly
-
You can use this, only check the lot before using, or use global variables: https://fxdreema.com/shared/AvGd9ic5c
-
@jstap Where should these 2 blocks be added? The following error appears: 'Round_from' - undeclared identifier
'Round_from' - undeclared identifier -
Show your project, but exactly how they are in my project
-
-
Did you save Round_from as a constant with a value? This needs to be the lot value you are correcting:

-
@jstap Ok I tried inserting the same constant that I use to open the first trade called "Lots" instead of "Round_from". I tried but the error is always the same, when I have to open another trade as specified as distant from the pips away block, the error appears that the minimum lot is 0.01 from the broker.
-
I get no error from this, it compiles as expected. Correct the crazy block numbers. What blocks are you trying to use it in? If I were you I would start from scratch, and get this working on a small project, then add other logic to it.
