On-Chain RSI: How to Read Live Technical Indicators From a Solidity Smart Contract
Most DeFi protocols make every decision based on one number: the current price. That's a problem. A price oracle tells your contract ETH is $2,400. It doesn't tell you whether that's a crash, a rec...

Source: DEV Community
Most DeFi protocols make every decision based on one number: the current price. That's a problem. A price oracle tells your contract ETH is $2,400. It doesn't tell you whether that's a crash, a recovery, a consolidation, or a pump. For that, you need technical indicators — and until recently, those simply didn't exist on-chain. This tutorial shows you how to read live RSI, EMA, VWAP, and Bollinger Band values from a Solidity contract using the standard Chainlink AggregatorV3Interface. Why You Can't Calculate RSI On-Chain RSI requires 14 periods of historical prices. For daily RSI, that's 14 days of data. For hourly, 14 hours. Storing and computing this in Solidity would cost thousands in gas per calculation. Floating-point math doesn't exist in EVM. It's not viable. The practical solution: deliver the pre-calculated value via oracle — the same pattern Chainlink uses for ETH/USD prices. The Indicators Available On-Chain Pythia's oracle network delivers pre-calculated technical indicator