Test Investment Strategies with English-Like Code
Align Data to Strategy Timeframe
Period-level summary statistics
Analyze Drawdown Characteristics
Analyze Backtest Performance with Daily Monitoring
Benchmark-relative performance statistics
Apply Market Regime Filter
Apply Weighting Method to Values
Convert Conditions to Selection Format
Calculate Comprehensive Backtest Metrics
Bucketed label analysis by score rank
Calculate Commodity Channel Index (CCI)
Calculate Distance from Reference
Calculate Market Breadth Percentage
Calculate Price Momentum
Calculate Moving Average
Calculate Cross-Sectional Ranking of Indicators
Rolling correlation of each symbol to a benchmark
Calculate Rolling Volatility
Calculate Relative Strength Index (RSI)
Calculate Market Breadth by Sector
Calculate Indicators Relative to Sector Average
Calculate Stochastic D Indicator
Stochastic RSI (StochRSI) for multiple price series
Calculate Annualized Return
Optimized cluster variance calculation
Daily equity curve from positions and daily prices
Calculate Drawdown Time Series
Calculate Portfolio Drawdowns
Calculate Enhanced Performance Metrics
Calculate Equal Risk Contribution weights (simplified)
Calculate HRP weights for a given returns matrix
Calculate Maximum Diversification Portfolio weights
Apply post-weight exposure caps
Cap turnover sequentially across dates
Carry-forward weights between rebalances (validation helper)
Combine Multiple Filter Conditions
Combine multiple score panels (mean / weighted / rank-average / trimme...
Combine Multiple Weighting Schemes
Convert Data to N-Week Frequency
Count finite entries per date
Convert Continuous Indicator to Discrete Regimes
Load Price Data from CSV File
Purged/embargoed K-fold CV for sequence models (inside IS window)
Demo sector (group) map for examples/tests
Create Window Splits for Walk-Forward
Download S&P 500 Sector Mappings from Wikipedia
Ensure Data.Table Without Mutation
Evaluate scores vs labels (IC and hit-rate)
Filter Stocks Above Threshold
Filter Stocks Below Threshold
Filter Stocks Between Two Values
Filter by Percentile
Select Top or Bottom N Stocks by Signal
Filter by Threshold Value
Select Top N from Qualified Stocks
Select Top N Stocks by Signal Value
Detect Data Frequency from Dates
Information Coefficient time series
Invert Signal Values for Preference Reversal
Join multiple panels on intersecting dates (unique symbol names)
Limit per-date selections to top-K (legacy API)
List available example scripts
Load Mixed Symbols Including VIX
Make future-return labels aligned to the decision date
Adapter for User-Provided Data
Membership stability across dates
Calculate Sharpe Ratio with Frequency Detection
Add interaction panels to a feature list
Run multi-horizon ML backtests (pooled or sector-neutral)
One-call backtest wrapper (sequence features)
One-call backtest wrapper (tabular features)
Rank-IC series computed on score (rebalance) dates
NA-tolerant ensemble blender (row-wise)
Model factory for tabular cross-sectional learners
Deterministic sequence model factory (GRU/LSTM/CNN1D with linear fallb...
Panel-safe binary operation on aligned wide panels
Reduce multiple panels with a binary operator
Rolling rank-IC plot (rebalance dates; leakage-safe)
Prepare tabular features (weekly + aligned daily volatility)
Lag each symbol column by k steps
Panel simple returns from prices
Portfolio performance metrics
Plot Backtest Results
Plot Parameter Grid Results (1D/2D/3D and Facets)
Plot Performance Analysis Results
Plot Walk-Forward Results
Portfolio returns from weights and prices (CASH-aware)
PortfolioTesteR: Test Investment Strategies with English-Like Code
Print Backtest Results
Print a param_grid_result
Print Performance Analysis Results
Print a wf_optimization_result
Collect diagnostics from two ml_backtest_multi() runs
Rank Indicators Within Each Sector
Rebalance calendar (rows with non-zero allocation)
Optimized recursive bisection for HRP
Rolling fit/predict for sequence models (flattened steps-by-p features...
Rolling fit/predict for tabular features (pooled / per-symbol / per-gr...
Rolling IC mean, standard deviation, and ICIR
Run Portfolio Backtest
Run an Example Script
Run Parameter Grid Optimization (safe + ergonomic)
Walk-Forward Optimization Analysis
Safe ANY Operation with NA Handling
Safe Division with NA and Zero Handling
Mask score tables to out-of-sample decision dates
Select top-k symbols per group by score
Select top-K scores per date
Load Adjusted Price Data from SQL Database
Load Price Data from SQL Database
Standardize Data to Library Format
Summary method for backtest results
Switch Between Weighting Schemes
Per-date score transform (z-score or rank)
Quick grid tuning for tabular pipeline
Turnover by date
Update VIX data in database
Validate Data Format for Library Functions
Validate a symbol-to-group mapping
Quick leakage guard: date alignment & NA expectations
Validate Performance Analysis Inputs
Volatility targeting (row-wise) with optional down-only cap
Hierarchical Risk Parity Weighting
Rank-Based Portfolio Weighting
Regime-Based Adaptive Weighting
Risk Parity Weighting Suite
Signal-Based Portfolio Weighting
Volatility-Based Portfolio Weighting
Equal Weight Portfolio Construction
Map scores to portfolio weights
Generate Walk-Forward Report
Stitch Out-of-Sample Results (overlap-safe)
Walk-forward sweep of tabular configs (window-wise distribution of met...
Download Price Data from Yahoo Finance
Design, backtest, and analyze portfolio strategies using simple, English-like function chains. Includes technical indicators, flexible stock selection, portfolio construction methods (equal weighting, signal weighting, inverse volatility, hierarchical risk parity), and a compact backtesting engine for portfolio returns, drawdowns, and summary metrics.
Useful links