// Find maximum of two prices
math.max($BTC.open, $BTC.close)
// Maximum of multiple indicators
math.max(ta.rsi($BTC, 14), ta.rsi($ETH, 14), ta.rsi($SOL, 14))
// Dynamic stop loss
math.max($BTC.low, ta.sma($BTC, 20) * 0.95)
// Risk management
math.max($BTC.close * 0.02, 100) // Minimum position size
math.min(value1, value2, ...)
// Find minimum of two prices
math.min($BTC.open, $BTC.close)
// Minimum RSI across assets
math.min(ta.rsi($BTC, 14), ta.rsi($ETH, 14))
// Position sizing with cap
math.min($BTC.close * 0.1, 5000) // Maximum position size
// Dynamic support level
math.min($BTC.low, ta.bb($BTC, 20, 2).lower)
math.round(value)
math.round(value, precision)
// Round price to nearest dollar
math.round($BTC.close)
// Round to 2 decimal places
math.round($BTC.close, 2) // e.g., 45123.456 -> 45123.46
// Round indicator values
math.round(ta.rsi($BTC, 14))
// Position sizing with precision
math.round($BTC.close * 0.01, 4) // Round to 4 decimal places
// Volume normalization
math.round($BTC.volume / 1000000, 1) // Round to 1 decimal place
math.floor(value)
// Floor price value
math.floor($BTC.close)
// Conservative position sizing
math.floor($BTC.close * 0.01)
// RSI level grouping
math.floor(ta.rsi($BTC, 14) / 10) * 10 // Round to nearest 10
// Time-based calculations
math.floor($BTC.volume / 1000) * 1000 // Floor to thousands
math.ceil(value)
// Ceiling price value
math.ceil($BTC.close)
// Conservative stop loss
math.ceil($BTC.close * 1.05)
// Minimum lot sizing
math.ceil($BTC.close * 0.001)
// Volume ceiling
math.ceil($BTC.volume / 1000000) // Round up to millions
// Sum of recent volumes (if you had volume array)
// math.sum(volumeArray, 10) // Sum of last 10 values
// Sum of multiple values
math.sum($BTC.open, $BTC.close, $BTC.high, $BTC.low)
// Sum of indicators
math.sum(ta.rsi($BTC, 14), ta.rsi($ETH, 14), ta.rsi($SOL, 14))
// Portfolio value sum
math.sum($BTC.close * 0.5, $ETH.close * 0.3, $SOL.close * 0.2)
math.random(min, max, seed)
// Random number between 0 and 1
math.random()
// Random price adjustment
$BTC.close + math.random(-100, 100)
// Random position sizing
math.random(0.01, 0.05) * $BTC.close
// Random threshold for dynamic strategies
ta.rsi($BTC, 14) > math.random(30, 70)
// Convert degrees to radians
math.toradians(180) // Returns π
// 45-degree angle in radians
math.toradians(45)
// Use with trigonometric functions
math.sin(math.toradians(30)) // Sine of 30 degrees