Return On Investment
Return on Investment (ROI) is a fundamental financial metric that calculates the percentage return on an investment by comparing the current value to the initial investment amount. It shows how much profit or loss has been generated as well as a percentage of the original investment, making it easy to compare performance across different assets or investment strategies.
ROI is one of the most widely used performance metrics in finance and trading. It provides a clear, normalized view of gains or losses regardless of the absolute dollar amounts involved, making it ideal for comparing investments of different sizes or tracking portfolio performance over time.
What It Measures
ROI measures the return and percentage return on an investment by calculating. For each price point in the series, it shows what the return would be if you had invested the initial amount at the first price and evaluated at that point. A positive ROI indicates profit, while a negative ROI indicates loss.
When to Use
- Portfolio Tracking: Monitor the overall performance of an investment over time
- Performance Comparison: Compare returns across different assets using the same initial investment
- Profitability Analysis: Evaluate whether an investment strategy is generating positive returns
- Investment Education: Understand how investments grow or decline from a specific starting point
- Backtesting Results: Calculate returns from simulated trading strategies
- Relative Performance: Assess which investments are delivering better returns
Initial Investment Guidelines
The initial_investment parameter represents the dollar amount (or any currency) invested at the start:
| Investment Amount | Use Case |
|---|---|
| $100 - $1,000 | Small-scale testing, educational examples |
| $1,000 - $10,000 | Individual investor portfolios, demo accounts |
| $10,000 - $100,000 | Active trading accounts, larger portfolios |
| $100,000+ | Professional trading, institutional accounts |
The specific value doesn't affect the percentage calculations, but using a realistic amount helps with understanding absolute dollar gains/losses alongside percentage returns.
Interpretation
- Positive ROI (> 0%): The investment has generated a profit; the higher the percentage, the better the return
- Negative ROI (< 0%): The investment has incurred a loss; the more negative, the worse the performance
- Zero ROI (0%): The investment is at break-even, neither profit nor loss
- Time Evolution: Watching ROI change over time shows the investment's performance trajectory
- Comparison: ROI percentages are normalized, allowing fair comparison between investments of different sizes
- Volatility: Large swings in ROI indicate volatile price movements relative to the starting point
Default Usage
use rust_ti::other_indicators::bulk::return_on_investment;
pub fn main() {
// fetch the data in your preferred way
// let prices = vec![...]; // price data
let initial_investment = 1000.0;
let roi = return_on_investment(&prices, initial_investment);
println!("ROI: {:?}", roi);
}
import pytechnicalindicators as pti
# Return on Investment with $1000 initial investment
initial_investment = 1000.0
roi = pti.other_indicators.bulk.return_on_investment(prices, initial_investment)
print("ROI:", roi)
import init, {
other_bulk_returnOnInvestment
} from 'https://cdn.jsdelivr.net/npm/ti-engine@latest/dist/web/ti_engine.js';
await init();
// fetch the data in your preferred way
// const prices = [...]; // price data
const initialInvestment = 1000.0;
const roi = other_bulk_returnOnInvestment(prices, initialInvestment);
console.log("ROI:", roi);
Interactive Chart
Use the interactive playground below to explore how different parameters affect the indicator's behavior.