Many lot size calculators hardcode pip value assumptions that break on gold, indices…

MQL5 Algo Trading, @mql5dev

Open in Telegram
#4242Photo

Many lot size calculators hardcode pip value assumptions that break on gold, indices, JPY crosses, and non-USD account currencies. A sizing routine should use the tick and volume properties the trade server publishes per symbol, then compute risk from those inputs. CalcLots() takes risk in account currency plus entry and stop prices, then returns the trade volume and the actual risk after broker constraints. Volume is always rounded down to the volume step. If requested risk is below the minimum lot, the minimum is returned, clamped_min is set, and the higher real risk is reported. The function is direction-agnostic and also provides stop distance in points and point value per 1.00 lot. The sizing math is isolated in Calc.mqh with no terminal state. It consumes a SymbolSpec struct and can be tested offline. SpecFromSymbol() is the only live-data bridge and... 👉 Read | NeuroBook | @mql5dev

Open in Telegram
Views13,306+32%vs avg
Forwards7
Reactions5
Comments—

Views growth

Hours after publication

Show as table
Hours after publicationViews
0 h0
1 h1,121
15 h8,107
33 h13,306
  1. After 1 hour1,121
  2. Total to date13,306

More from MQL5 Algo Trading

  1. 01
    Views16.6K
    Forwards9
    Reactions—
    Comments—
  2. 02
    Views12.5K
    Forwards5
    Reactions34
    Comments—
  3. 03
    Views12K
    Forwards6
    Reactions40
    Comments—
  4. 04
    Views11.9K
    Forwards4
    Reactions16
    Comments—
  5. 05
    Views11.5K
    Forwards4
    Reactions27
    Comments—

All posts of MQL5 Algo Trading