Appearance
Reports
How do you get fifty coins' scores out of a script, bar by bar, when a plot holds one value and a table is only drawn? Write them to the run's report with report.column. It records one value per member per bar in a table the Screener reads, ranks and exports. report.matrix does the same for a whole pair matrix.
ameno
indicator("Momentum ranks")
array<string> m = request.universe(50, exclude_tags = "stablecoin")
array<float> mom = request.each(m, ta.roc(close, 20))
// One row per bar and member, one column per title
report.column("mom 20", m, cs.rank(mom))
report.column("mom 20, raw", m, mom)On a chart this draws nothing. Run it from the Screener: choose the script in the Screener's script picker and press Run, and the table fills with one row per member.
report.column
report.column(title, members, values) writes values under the column title, one row per member, on this bar.
membersis an array of symbols, andvaluesan array lined up with it, of floats, ints or bools. A bool writes 1 for true and 0 for false.- A na value is an empty cell.
- A member gets a row on each bar that names it. A column that starts writing later reads na before it.
- A second write to the same cell replaces the first.
- Arrays of two sizes get one warning, and the cells that line up are kept.
report.matrix
report.matrix(name, members, x) hands on a matrix with a row and a column per member, in the same order, such as a request.pairs result. A matrix of any other shape gets one warning and is not written.
ameno
indicator("Pair momentum")
array<string> m = request.universe(20, exclude_tags = "stablecoin")
matrix<float> pairs = request.pairs(m, ta.roc(close, 20))
report.matrix("ratio mom 20", m, pairs) // row i, column j: i against j
// Per coin: its ratio's 20-bar change against every other coin, summed
report.column("mom vs the rest", m, cs.row_sum(pairs))The report keeps the matrix's history. Each bar that changes it keeps a frame, its members and its cells, so writing the same matrix every bar costs nothing. A frame is what the matrix held at the bar's end. Past about a million cells of history, every other change goes, keeping the first and the last.
When it writes
A report is written only on a run that asks for one: a Screener scan of the script, and the Strategy Tester's analysis. On any other run, a chart's, an Optimizer sweep's, or a child run inside a request, both calls do nothing and their arguments don't run.
Arguments only run when a report is written
Because the arguments don't run on a chart, a var changed inside them changes only on a report run. Keep anything a plot or an order reads out of the arguments.
A script that writes a report and plots nothing says so on the chart: run it in the Screener to see its table.
A script can't read its report back. Both calls return na, and no builtin returns the table or anything computed from it, so a report can't feed a decision.
In the Screener
A script that writes a report runs once per scan, not once per symbol. If it reads request.universe, it runs on CMC:TOTAL, the whole crypto market's cap, whatever symbols the scan lists, and on daily bars when the scan's timeframe is shorter than a day. Otherwise it runs on the first symbol the scan lists.
- Its rows are the members on the last bar, with the sort, filter, score and heat any scan has.
- Export all bars, in the More menu, saves the whole table as CSV.
- IC, beside Score, reads how well each column ranked the returns that followed, at 1, 2, 5, 10, 20 and 60 bars. It is one test, in sample, and tells you which idea deserves a real test.
- Matrix, beside Score, paints a written matrix as a heat map; pressing a cell opens its row's member.
A scan can't mix a script that writes a report with one that runs per symbol.