Examples
This section provides practical examples demonstrating how to use Rhoa for various technical analysis and machine learning tasks.
Example Categories
Overview
The examples are organized by complexity and use case:
- Basic Indicators
Simple examples using individual technical indicators like SMA, RSI, and moving averages. Perfect for beginners.
- Advanced Indicators
Examples using complex indicators that require OHLC data: MACD, Bollinger Bands, ADX, Stochastic Oscillator, and more.
- Target Generation
Learn how to generate optimized binary targets for machine learning models using both auto and manual modes.
- Complete Pipeline
End-to-end examples showing how to build complete ML pipelines from data loading to model training and evaluation.
Quick Reference
Common Tasks
Task |
Example Link |
|---|---|
Calculate Simple Moving Average |
|
Find Overbought Conditions (RSI) |
|
Detect MACD Crossovers |
|
Calculate Bollinger Bands |
|
Generate ML Targets (Auto Mode) |
|
Generate ML Targets (Manual Mode) |
|
Build Complete ML Pipeline |
Example Data
Most examples assume you have OHLC (Open, High, Low, Close) price data in a CSV file:
import pandas as pd
import rhoa
# Load your data
df = pd.read_csv('your_prices.csv')
# Expected columns: Date, Open, High, Low, Close, Volume
# Date should be parseable as datetime
Sample Data Format
Your CSV file should look like this:
Date,Open,High,Low,Close,Volume
2024-01-01,100.0,105.0,99.0,103.0,1000000
2024-01-02,103.0,107.0,102.0,106.0,1200000
2024-01-03,106.0,108.0,104.0,105.0,950000
...
Getting Test Data
For testing, you can use the sample data included in the tests directory:
import pandas as pd
# Using Rhoa's test data
df = pd.read_csv('https://raw.githubusercontent.com/nainajnahO/Rhoa/main/tests/data.csv')
Or download financial data using yfinance:
import yfinance as yf
# Download stock data
ticker = yf.Ticker("AAPL")
df = ticker.history(period="1y")
df = df.reset_index()
Next Steps
Start with Basic Indicators if you’re new to Rhoa, then progress to more advanced examples as you become comfortable with the basics.