Strategy Arena › ArenaScript
ArenaScript: describe a trading rule in a few lines, search it on CPU or GPU, take it back to Pine
ArenaScript is a short declarative language for trading rules. The Strategy Arena engine (Rust, on your CPU or an NVIDIA GPU with CUDA) sweeps its parameter ranges, counts every attempt and gives one verdict on a period kept sealed during the search. When you are done, it exports Pine v5 for TradingView, marked EXACT or PARTIAL.
strategy "EMA cross with ATR stop" version 1.2 asset: BTC timeframe: 4h capital: 10000 entry: condition: EMA(12) crosses above EMA(26) size: 50% exit: condition: EMA(12) crosses below EMA(26) stop_loss: 2 x ATR(14) params: fast: min=5 max=20 type=int default=12 slow: min=21 max=60 type=int default=26
Buy when the 12 EMA crosses above the 26 EMA, sell on the opposite cross or at a stop two ATRs below the entry. The params: lines ask the Lab to search fast periods between 5 and 20 and slow periods between 21 and 60. This script passes validate_arenascript on the public MCP server (checked 23 November 2026).
Already write Pine? Keep it.
Keep Pine Script and TradingView for charts, drawings and alerts. To test a strategy on data it has not seen, paste your Pine in the free online judge: no account, the end of the history stays sealed. ArenaScript is the next step, for when you want to declare parameter ranges, run large sweeps, or let an AI write and repair the rule.
What ArenaScript does well for research
- Parameter ranges, swept for you. A
params:line declares a range (min, max, type, default). The Lab searches the combinations on your CPU, or on an NVIDIA GPU with CUDA. - Every attempt counted. The verdict takes into account how many variants were tried, so the best of a thousand tries is not read as if it were the only one.
- A sealed period. The end of the history is kept out of the search and played once, at the end. The verdict reads: survives, no evidence of an edge, inconclusive, or not enough trades.
- An AI that writes and repairs the rule. Over the MCP server, an assistant calls
arenascript_reference,validate_arenascriptandrepair_arenascript: the engine says which line it refuses, and why. - Back to Pine v5, with a clear status. The export is marked EXACT when every rule is converted, PARTIAL with the list of lines the Pine does not execute. EXACT describes the conversion made by our engine, not a validation by TradingView: on the ATR breakout example, the Pine and the ArenaScript replayed in our judge give the same trades, but fills in TradingView can differ with its settings and data.
inspect_pine_export_capabilitygives the status before you export. - One engine for Pine and ArenaScript. The judge reads both with the same engine. In our side-by-side comparison, three classic strategies written in both languages gave the same trades on BTCUSDT.
What ArenaScript does not do
- It is not a general-purpose language: no variables, loops or functions of your own. One condition per line, joined by
andoror. - No chart, no drawing, no alert. For that, Pine and TradingView remain the tools.
- The indicators of version 1.2 only: moving averages, RSI, MACD, ADX, ATR, Bollinger and Keltner bands, Donchian channel, stochastic, CCI and a few others, listed in the grammar. An indicator you wrote yourself in Pine cannot be ported.
- Research on past data only: no broker connection, no order. A result is never advice.
- A backtest on the public MCP server is a draft (
sealed: false) on about 35 days of server candles. The verdict is given in the Lab, on your PC.
How it fits with TradingView
Questions
Is ArenaScript a replacement for Pine Script?
No. Pine Script runs inside TradingView with charts, drawings, alerts and a large community. ArenaScript v1.2 has a fixed set of indicators and no chart. It is a research language: you describe a rule, the Strategy Arena engine searches its parameter ranges and judges it on a sealed period, then you can export Pine v5 back to TradingView.
I already have a Pine strategy. Do I need to rewrite it?
No. The free online judge and the Lab read supported Pine v5 directly, with the same engine that runs ArenaScript. Rewrite a rule in ArenaScript only when you want to declare parameter ranges, let an AI edit it over MCP, or keep a short readable version of it.
Do I need a graphics card?
No. The Lab sweeps parameter ranges on the CPU. With an NVIDIA card, it can also use CUDA for large sweeps. The verdict is the same kind either way: one judgement on a sealed period, with every attempt counted.
Is this investment advice?
No. ArenaScript and the Lab are for research on past data. No order is sent to any broker, and no result is a promise of gain.
See also: ArenaScript v1.2 grammar and execution rules · Pine Script alternatives compared · MCP server for AI assistants. Research on past data, never advice.