Skip to content
All library documents

Comparing Floating-Point Prices at a Chosen Precision

Article MQL5 code base

Summary

This document describes a small cross-platform library for comparing floating-point values used in trading code. Its comparison helper applies a chosen precision so that prices or quantities can be checked against thresholds without repeatedly calling a standard rounding function. The examples include checking whether an opening price meets a limit-order condition and comparing a lot size with minimum and maximum limits. It also describes an alternative normalization routine intended to run faster than the standard function.

The source claims that the helper is clearer and faster, and that the replacement normalization implementation can be several times faster in a cited software build. It points to an attached script as the basis for comparing the methods, but the document itself provides no benchmark results, methodology, or correctness analysis. Precision must be chosen appropriately for the instrument and quantity being compared; the examples do not establish universal settings. This is a programming utility rather than a trading strategy or evidence of market behavior.

Key ideas

  • A precision-aware comparison helper can make price and quantity threshold checks more concise.
  • The library applies the same comparison approach to equality and ordering operators.
  • The document also proposes a faster replacement for standard floating-point normalization.
  • The claimed speed benefits are not accompanied here by benchmark methodology or broad performance evidence.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.