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

Initial Investment Guidelines

The initial_investment parameter represents the dollar amount (or any currency) invested at the start:

Investment AmountUse Case
$100 - $1,000Small-scale testing, educational examples
$1,000 - $10,000Individual investor portfolios, demo accounts
$10,000 - $100,000Active 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

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.