Home > Mobile >  How to select a certain digit of a double number in MQL4/MQL5
How to select a certain digit of a double number in MQL4/MQL5

Time:10-15

i'm trying to write a function for round the last digits of an asset to the TICKSIZE.

Example: Input: 1256,57 TickSize: 0.05

I want to force the input price to 1256,55 or 1256.60 Anyone can help me please?

CodePudding user response:

Divide the price by the tick size. Round your answer to a whole number, multiply this by your tick size. Easy!

Comment("Modified price is ",double(int(Bid/0.05))*0.05);
  • Related