CSV User Data

This guide explains how to bring external indicators into the OptionForge options backtester with CSV files and use them directly inside Lua strategy logic.

You can provide a public CSV file with custom indicators. OptionForge loads it once per account and exposes the columns as Lua globals under user.

Public URL required: no authentication is supported. Host the CSV on a public URL.

CSV Format

The first column must be named datetime or Date (case-insensitive) and use YYYY-MM-DD, YYYY-MM-DD HH:MM, or YYYY-MM-DD HH:MM:SS with no timezone. Date-only values are treated as 23:59:59 to avoid accidental lookahead (“seeing the future”).

datetime,signal,vol
2025-10-12 10:30:00,0.42,18.1
2025-10-12 10:31:00,0.38,18.3

Column headers become fields on user, e.g. user.signal.

Value column headers are case-sensitive (e.g., ATR maps to user.ATR, not user.atr).

How Values Are Picked

For each tick, OptionForge looks for the row with the same timestamp. If it does not exist, it uses the closest row that precedes the current tick. If no prior row exists, the value is nil.

A warning is printed if the row used is older than the previous tick of the current interval. This avoids false alarms on weekend gaps for daily data.

Lua Usage

sim_params.csv = "https://example.com/indicators.csv"

if user.signal and user.signal > 0.5 then
    -- trade logic
end

Limits

Caching & Refresh

Reproducible Scripts

Set sim_params.csv at the top of your script so the URL travels with the code. This makes runs fully reproducible without any UI settings.