Appearance
AmenoScript
What does AmenoScript add to Pine Script v6, and how does your script become it? AmenoScript is Pine Script v6 with this terminal's additions: functions you can pass around, the top coins by market cap as they stood on each date, a portfolio book, research reports and more builtins. Your script becomes AmenoScript the moment it uses one of them, and from then on it runs leak-safe.
ameno
indicator("Four averages", overlay = true)
// A lambda is an addition, so this line makes the script AmenoScript
array<float> ribbon = array.map([10, 20, 50, 100], n => ta.ema(close, n))
plot(array.get(ribbon, 0), "EMA 10", color.teal)
plot(array.get(ribbon, 3), "EMA 100", color.orange)How the engine tells the two apart
The engine reads the dialect off the text. A script that uses anything only this terminal runs is AmenoScript. Any other script is Pine Script v6. No header decides it, and that includes a //@version line, so the label can't disagree with what the script does.
There is no setting either. A script can't declare itself AmenoScript, and nothing else makes a run leak-safe: a script is both exactly when one of its lines uses an addition.
The Script Editor shows the result. Its tab and tag say Pine Script or AmenoScript, and a saved script's name ends in .pine or .ameno. An AmenoScript text states no version, so the editor flags a //@version line in one and offers to remove it. A Pine Script text keeps its //@version=6, because TradingView compiles by it.
A run reads your script with its libraries linked in. A library that uses an addition therefore makes the run leak-safe, even when your own lines are plain Pine.
What changes when a script is AmenoScript
Three things change:
It runs leak-safe, and that changes how it behaves:
- Its last bar is the last closed one, so
barstate.islast,last_bar_indexandlast_bar_timeread that bar. - None of its code runs on the bar still forming on a live chart, so that bar gets no plot point, table update or new order.
- A request on a higher timeframe reads the last closed period, live as in history.
- Constructs that could read ahead or act only live, such as
barmerge.lookahead_onandvarip, stop it before its first bar.
Leak-safe AmenoScript has the rules.
- Its last bar is the last closed one, so
Its additions work. Pine mode refuses each of them, as the next section says.
The editor labels it AmenoScript. Its tab, its tag and its file name say so.
Everything else is Pine Script v6: the types, the series model, ta.*, request.security and the strategy emulator. TradingView's own output is the ground truth for all of it, and the engines are tested against it. Pine compatibility lists the few places where a run here still differs.
Pine mode
The Script Editor's More menu has two modes, AmenoScript, the default, and Pine v6 strict. In Pine v6 strict, a script that uses any addition doesn't run. Each use stops it with an error on its line that names what it found and says TradingView doesn't have it. The script below gets two, one for the lambda and one for array.map, which only AmenoScript has.
Use Pine v6 strict when a script has to run on TradingView too. A script that runs in this mode won't fail there for using one of our additions. Strict mode checks the language, not your symbols: a series only this terminal has, such as CMC:bitcoin or FRED:CPIAUCSL, passes it and still fails on TradingView.
pine
//@version=6
indicator("Refused in Pine mode")
array<float> ribbon = array.map([10, 20], n => ta.ema(close, n))
plot(array.get(ribbon, 0))What AmenoScript adds
| Addition | What it lets you do | Page |
|---|---|---|
| Lambdas and lists | Pass x => e to array.map and six more; map a list of settings to one call site per row | Extensions |
| A script as a function | Run a saved indicator or strategy inside another with s.run(...) | Extensions |
| A strategy as a value | Hold a strategy() in a function and read its equity through a request | Extensions |
| Inputs as a schema | Give an input a stable id, an Optimizer sweep and an input.check | Extensions |
| A daily universe | Read the top N coins as they stood on each date | Universes |
| Each member, every pair | Run one expression per member or per pair, each with its own state | Each and pairs |
| The cross-section | Rank, z-score and demean across members on one bar | Cross-section |
| A book of weights | Backtest a portfolio by stating target weights | Book |
| Portfolio maths | Weights and risk measures from a window of returns | mpt.* |
| Reports | Hand a table per member, or a matrix, out of a run | Reports |
| Dated facts and known time | Read dividends, earnings and macro data as they were published, and ask how fresh a value is | Facts |
| More builtins and syntax | math.atan2, str.trim_left, recursion, nested collections and more | Extensions |
Which one to write
Write Pine Script v6 when the script has to run on TradingView as well. Write AmenoScript when you need a list of symbols, a portfolio, a report or the leak-safe guarantee. You can start in Pine and add one AmenoScript line later, but the script then behaves differently. The whole script now runs leak-safe: its last bar becomes the last closed one, its code stops running on the forming bar, a higher timeframe reads only closed periods, and any refused construct stops it before its first bar. Every other line keeps its meaning.