Indicator Calculation
Rez's Indicator Engine is built for mathematical precision. This section details the algorithms used to transform raw Binance OHLCV data into actionable technical signals.
Data Pre-processing
Before any calculation, raw data is normalized:
Filtering: Only
timestamp,open,high,low,close, andvolumeare retained.Casting: Prices are cast to
float64for high-precision arithmetic.Time-Normalization: All timestamps are converted to UTC to ensure consistency across assets.
The Warmup Algorithm
Recursive indicators like the Exponential Moving Average (EMA) and Relative Strength Index (RSI) depend on previous values. To prevent "cold start" errors where the initial value is just the first price point, Rez uses a 3x Warmup Rule.
Lfetch=max(100,Nresults×3)
Where:
Lfetch is the number of candles fetched.
Nresults is the number of indicator values the agent requested.
Rationale
By fetching three times the required data, the recursive calculation has sufficient "burn-in" time. For an EMA with a period of 20, the weighting of the first (and most inaccurate) data point is reduced significantly by the time the latest candle is reached.
Specific Implementations
1. Exponential Moving Average (EMA)
Rez uses the standard exponential decay formula:
EMAt=Pt×α+EMAt−1×(1−α) α=period+12
2. Relative Strength Index (RSI)
Calculated using the Wilder's smoothing method via pandas-ta.
Calculate price change: Dt=Pt−Pt−1
Split into gains U and losses D.
Relative Strength RS = AvgLossAvgGain
RSI=100−(1+RS100).
3. Precision Management
To keep the LLM context lean, all calculated values are rounded to 4 decimal places. This maintains enough sensitivity for technical analysis while avoiding token bloat from unnecessary floating-point precision.
Vclean=round(Vraw,4)
Last updated
Was this helpful?
