ProBacktest/probacktest · proorder

PIPSIZE

PIPSIZE returns the pip size of the current instrument in ProBacktest and ProOrder. Use it to convert pip distances into price units for stops and targets.

Syntax

probuilder
PipSize

How it works

Every instrument quotes in discrete steps. A major currency pair with five decimals moves in increments of 0.0001, an index future may move in steps of 0.5 or 1. PipSize exposes that increment as a read-only value, determined by the instrument the strategy runs on. In ProRealTime™ it behaves identically to PointSize, the two names are interchangeable.

Its main job is unit conversion. Risk parameters are naturally expressed in pips or points, "a 10-pip stop", but several instructions, SET STOP LOSS among them, take distances in raw price units. Multiplying the pip count by PipSize bridges the two: 10 * PipSize is 0.0010 on a pair whose pip is 0.0001, and 10 on an index whose smallest step is 1.

Because the value adapts to the instrument automatically, code written with PipSize transfers between markets without edits. A stop expressed as 20 * PipSize is always 20 increments wide, whether the strategy runs on a currency pair, an index, or a commodity. Hardcoded price distances, by contrast, must be rewritten for every quotation format.

For converting a price move into account currency rather than price units, the companion values PipValue and PointValue give the monetary worth of one increment per contract.

Examples

Example 1, Converting a pip-based stop into price units (ProOrder)

probuilder
// desired stop distance expressed in pips
MyStopLoss = 10
SET STOP LOSS MyStopLoss * PipSize

With a pip size of 0.0001, the stop distance becomes 10 * 0.0001 = 0.0010 price units. The conversion keeps the intended 10-pip distance regardless of how the instrument is quoted.

Example 2, Pip-based stop and target on entry (ProBacktest)

probuilder
stopPips   = 25
targetPips = 50

IF NOT OnMarket AND close crosses over Average[50](close) THEN
  BUY 1 LOT AT MARKET
  // both distances converted from pips to price units
  SET STOP LOSS stopPips * PipSize
  SET TARGET PROFIT targetPips * PipSize
ENDIF

The bracket is defined once in pips and converted at order time. Changing markets requires no code edits because PipSize adjusts automatically.

Example 3, Breakout entry a fixed number of pips above the range (ProOrder)

probuilder
// pending entry 5 pips above the highest high of the last 20 bars
rangeTop   = highest[20](high)
entryLevel = rangeTop + 5 * PipSize

IF NOT OnMarket THEN
  BUY 1 CONTRACT AT entryLevel STOP
  SET STOP PLOSS 30
ENDIF

The buffer above the breakout level is specified in pips and converted to a price offset. The pending stop order then sits exactly 5 increments above the range top on any instrument.

Common errors and gotchas

  • Forgetting the conversion. SET STOP LOSS 10 places a stop 10 price units away, not 10 pips. On a five-decimal pair that distance is 100,000 pips. Either multiply by PipSize or use the points-based SET STOP PLOSS variant.
  • Hardcoding 0.0001. Pip size differs across instruments, JPY pairs commonly use 0.01 and indices use whole points. Code with a literal 0.0001 breaks silently when moved to another market, PipSize does not.
  • Pip size is not pip value. PipSize is a price increment, PipValue is the monetary worth of that increment per contract. Position-sizing formulas that need currency amounts must use PipValue, not PipSize.
  • Broker pip conventions. Some data feeds quote fractional pips, so the platform increment can be a tenth of the traditional pip. Verify the instrument's actual PipSize before assuming the textbook definition.
  • POINTSIZE, synonym returning the instrument's smallest price increment.
  • PIPVALUE, monetary value of one pip per contract.
  • POINTVALUE, monetary value of one point per contract.
  • TICKSIZE, smallest tick of the instrument.
  • LOSS, stop loss expressed in price units.
  • PLOSS, stop loss expressed in points.
  • TRADEPRICE, the entry price of the current position.
  • BUY, opens or adds to a long position.