Download MetaTrader 5

Lot Size calculation By Dollar Value

To add comments, please log in or register
Mark B. Waldon
149
Mark B. Waldon  

Dear,

I need a simple MQL code that calculate lot size for profit selected amount in selected pips. example i want open a trade in EURUSD and set TP 5 pips want to profit  50$ then how i calculation how much lot i need to open.

Like

EURUSD=

1pips      profit 10$     lots size  1.00

5pips      profit 30$     Lot size    ?

Function would be like below

double  LotSize (string symbol, double pips,  double HowMuchDollow){

   // here the code

}
Thanks you
Stanislav Korotky
21586
Stanislav Korotky  

Try something like this:

double volume = Amount / (pips * MarketInfo(symbol, MODE_POINT) * MarketInfo(symbol, MODE_TICKVALUE) / MarketInfo(symbol, MODE_TICKSIZE));
Mark B. Waldon
149
Mark B. Waldon  
Stanislav Korotky:

Try something like this:

Thanks it is working
To add comments, please log in or register