**Abhishek Yadav:**What can i use instead of SYMBOL_TRADE_TICK_VALUE ? I am calculating lot size based on risk percentage. Its giving me right lots on EURUSD,GBPUSD but it gives wrong valuein US30, USDJPY. Can anyone help me. I am calculating lot size based on risk percentage. Its giving me right lots on EURUSD,GBPUSD but it gives wrong valuein US30, USDJPY. Can anyone help me.

- What are the values in the log for US30 and USDJPY for this code?

Print("tick size::",ticksize,"...tick value::",tickvalue,"...lot step ::",lotstep,"...sl Points::",slPoints);

- If your stop-loss is in points then first convert it into tick size units or use the point value instead. Don't mix "point size" and "tick size" (see below).
- In MQL5 use the OrderCalcProfit function instead so that it can adapt to the different symbol profit calculation types (see below).

Forum on trading, automated trading systems and testing trading strategies

Fernando Carreiro, 2022.05.18 21:05

double dbTickSize = SymbolInfoDouble( _symbol, SYMBOL_TRADE_TICK_SIZE ), // Tick size dbTickValue = SymbolInfoDouble( _symbol, SYMBOL_TRADE_TICK_VALUE ), // Tick value dbPointSize = SymbolInfoDouble( _symbol, SYMBOL_POINT ), // Point size dbPointValue = dbTickValue * dbPointSize / dbTickSize; // Point valueRemember, it's best to usetick sizeandtick valuein your calculations, instead ofpoint sizeand its value.Forum on trading, automated trading systems and testing trading strategies

Tick size vs Point(), can be a little tricky in Multicurrency EA

Fernando Carreiro, 2022.03.09 12:11

Tick Size and Point Size can be very different especially on stocks and other symbols besides forex.

Always use Tick Size to adjust and align your prices, not the point size. In essence, make sure that your price quotes, are properly aligned to the Tick size (see following examples).

... double tickSize = SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE ); ... double normalised_price = round( price / tick_size ) * tick_size; ... // Or use a function double Round2Ticksize( double price ) { double tick_size = SymbolInfoDouble( _Symbol, SYMBOL_TRADE_TICK_SIZE ); return( round( price / tick_size ) * tick_size ); };Forum on trading, automated trading systems and testing trading strategies

SymbolInfoDouble(_Symbol, SYMBOL_TRADE_TICK_VALUE) sometimes zero

Fernando Carreiro, 2022.08.23 17:41

You can! These are the steps I take. I supply the function with a lot size equal to the “Max Lot Size” allowed for the symbol in question, then calculate the ratio needed to achieve the fractional risk that I wish to apply, to get the correct volume for the order. I then align that with the “Lot Step” and finally check it against both the maximum and minimum allowed lots for the symbol.

The reason I use the “maximum” lots instead of just “1.0” lots as a reference value is because there is no guarantee that the value of 1.0 is within the minimum and maximum values allowed. Given that using 1.0, or the maximum, gives equivalent results anyway (by using the ratio method), I choose to use the “max lots” as the reference point which also offers the most precision for the calculation.

Something like this ...

// This code will not compile. It is only a example reference if( OrderCalcProfit( eOrderType, _Symbol, dbLotsMax, dbPriceOpen, dbPriceStopLoss, dbProfit ) ) { dbOrderLots = fmin( fmax( round( dbRiskMax * dbLotsMax / ( -dbProfit * dbLotsStep ) ) * dbLotsStep, dbLotsMin ), dbLotsMax ); // the rest of the code ... };Forum on trading, automated trading systems and testing trading strategies

Why am I limited to under 1 in the Lots input.

Fernando Carreiro, 2023.01.05 20:50

There could be a bug in your code, but you should also check the contract specifications of the symbol being traded.

// Variables for Symbol Volume Conditions double dblLotsMinimum = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_MIN ), dblLotsMaximum = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_MAX ), dblLotsStep = SymbolInfoDouble( _Symbol, SYMBOL_VOLUME_STEP ); // Adjust Volume for allowable conditions double dblLotsAdjusted = fmin( dblLotsMaximum, // Prevent too greater volume fmax( dblLotsMinimum, // Prevent too smaller volume round( dblLots / dblLotsStep ) * dblLotsStep ) ); // Align to Step value

- www.mql5.com

**Fernando Carreiro #:**

- What are the values in the log for US30 and USDJPY for this code:

- If your stop-loss is in points then first convert it into tick size units or use the point value instead. Don't mix "point size" and "tick size" (see below).
- In MQL5 use the OrderCalcProfit function instead so that it can adapt to the different symbol profit calculation types (see below).

Hey Thnks. Everything works fine in live market but when i try to test it , it gives me wrong lot.

Maybe you have some specific tester settings that are causing the problem – check the symbol properties in tester and see if the values are correct. It should be working fine if the real market is calculating properly.

And it would be helpful if you show us the values you think are wrong and why they’re wrong – we don’t know what you really mean by “wrong values”

**Fernando Carreiro #:**

You did not answer my question?

Consider applying what I have described, because your calculations and code are incorrect!

For USDJPY tick size = 0.001, tick value is 100, lot step = 0.01. I cant see the tick size and tick value in my broker's symbols properties. I found tick size of USDJPY as 0.005 which is wrong in my case . kindly help me. This problem shows in US30 and which does not have USD as currency. Thank You.

**Marzena Maria Szmit #:**

Maybe you have some specific tester settings that are causing the problem – check the symbol properties in tester and see if the values are correct. It should be working fine if the real market is calculating properly.

And it would be helpful if you show us the values you think are wrong and why they’re wrong – we don’t know what you really mean by “wrong values”

**Abhishek Yadav #:**

And for US30 tick size = 0.01, tick value = 0.01, lot step =0.1 . where as broker shows bots tick size and tick value 0. Frustated"" Can anyone help me.

- www.mql5.com

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets

You agree to website policy and terms of use

ots on EURUSD,GBPUSD but it gives wrong valuein US30, USDJPY. Can anyone help me.