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

Manage alerts

Loading saved threads...

Feduz · External communityPost link
External question — Stack Overflow Stack Exchange Author: Feduz Original post: https://stackoverflow.com/questions/74067096 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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?
Quote
Report
PaulB · External communityPost link
External answer — Stack Overflow Stack Exchange Author: PaulB Original post: https://stackoverflow.com/a/74067581 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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);
Quote
Report

Post Reply

Checking account access…