Forex Anatomy: Pips, Lots, Leverage & Sessions
Master currency calculations, session overlaps, lot sizing algorithms, and margin mechanics essential for automated Forex trading bots.
1. Currency Quotation Mathematics
When you trade EUR/USD at 1.08500:
- EUR: Base Currency (Quantity = 1)
- USD: Quote / Term Currency (Value = $1.08500 USD)
The Pip & The Pipette
A Pip is 0.0001 for standard 4-digit currency pairs (or 0.01 for JPY pairs). Most brokers quote to 5 decimal places; the 5th digit is a Pipette (1/10th of a pip).
Lot Sizes & Monetary Value
- Standard Lot (1.00): 100,000 units → 1 pip = $10.00 USD
- Mini Lot (0.10): 10,000 units → 1 pip = $1.00 USD
- Micro Lot (0.01): 1,000 units → 1 pip = $0.10 USD
2. Algorithmic Dynamic Lot Sizing Formula
Never hardcode static lot sizes into your bot. Always calculate position size dynamically based on a fixed risk percentage of account balance:
JavaScript (Position Size Algorithm)
function calculateLotSize(accountBalance, riskPercentage, stopLossPips) {
const riskAmountUsd = accountBalance * (riskPercentage / 100);
const pipValueStandardLot = 10.0; // For EUR/USD
// Position Size = Risk $ / (StopLoss in Pips * Pip Value)
const rawLotSize = riskAmountUsd / (stopLossPips * pipValueStandardLot);
// Round to 2 decimal places (Micro lot precision)
return Math.max(0.01, Math.floor(rawLotSize * 100) / 100);
}
// Example: $10,000 account, risking 1% ($100), with a 20 pip Stop Loss:
// lotSize = 100 / (20 * 10) = 0.50 Lots
console.log(calculateLotSize(10000, 1.0, 20)); // Output: 0.5
3. Global Market Sessions & Volatility
Trading bots must be programmed with time filters to avoid flat market conditions or unpredictable session openings:
- Asian Session (Tokyo): 00:00 - 09:00 GMT (Low volatility, tight consolidation ranges).
- London Session: 08:00 - 17:00 GMT (Heavy trend breakouts and high volume).
- New York Session: 13:00 - 22:00 GMT (High impact US economic news releases).
- London / NY Overlap (13:00 - 17:00 GMT): Highest liquidity and best execution speed.
4. Knowledge Check Exam
📝 Chapter 03 Certification Quiz
100 XP
If you have an account balance of $5,000 and risk 1% ($50) on a trade with a 25-pip stop loss on EUR/USD, what is the correct lot size?