Limit volume - page 2

To add comments, please log in or register
Angel Antonio Martinez Velasquez
206
Angel Antonio Martinez Velasquez  
Fernando Carreiro:

You committing the same mistake as the OP. You should never adjust the volume based on Digits, but instead use the Lot Step for that.

The following post is a very old and the code is also very old (MQL4, not MQL5), but it can give you an idea of what you should be doing:

PS! I altered and simplified the code here a bit in this post as apposed to the original post in the reference thread, so as to make it easier for you to understand it.

Many thanks Fernando!


I will study this code, it seems to be very complete.

Angel Antonio Martinez Velasquez
206
Angel Antonio Martinez Velasquez  
nicholi shen:

... enchufe rápido para la biblioteca CDouble . Puedes usar la función RoundToLots.


Esto asegura que el número se redondee hacia abajo al paso del lote y se ajuste al volumen mínimo / máximo.

Ok, thank you very much, I'm going to do tests.

Angel Antonio Martinez Velasquez
206
Angel Antonio Martinez Velasquez  
Fernando Carreiro:

Eso ya se ha respondido en las varias publicaciones posteriores, incluido un ejemplo completo de código para la administración del dinero, así como explicaciones sobre por qué el volumen debe redondearse a la Etapa del lote y una alternativa utilizando la biblioteca CDouble de @nicholi shen .

¿No leíste esas publicaciones?

If I did, thank you very much!

12
To add comments, please log in or register