{"id":506094,"date":"2026-12-04T15:00:08","date_gmt":"2026-12-04T12:00:08","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=506094"},"modified":"2026-12-04T15:00:08","modified_gmt":"2026-12-04T12:00:08","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=506094","title":{"rendered":"Pine Script Online: Write, Run and Backtest Scripts in the Browser for Free"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<h2>Pine Script Online: Write, Run and Backtest Scripts in the Browser for Free<\/h2>\n<p>Pine Script is the de facto language for chart indicators: short, series-based, and readable by people who have never written a line of JavaScript. The usual way to use it ties you to one charting product. We wanted something different: to <strong>run Pine Script online, free and right in the browser<\/strong>, on our own charts, with no account and no install. So we wrote an interpreter for it.<\/p>\n<p>This post is a hands-on tour. We will paste an indicator, break it on purpose to see what the errors look like, then turn it into a strategy and read a backtest report. Along the way I will explain what the engine does under the hood, because \u201cit runs Pine Script\u201d can mean very different things. If you just want to try it, here is the page: <a href=\"https:\/\/fire.bothub.chat\/en\/trading\/pine-script\">run Pine Script online, free and right in the browser<\/a>.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/14\/6e\/60\/146e60f7a2543900517d86ee41a1f665.png\" alt=\"An EMA cross indicator in Pine Script v6 applied to a daily bitcoin chart, with the editor pinned to the right\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/14\/6e\/60\/146e60f7a2543900517d86ee41a1f665.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/14\/6e\/60\/146e60f7a2543900517d86ee41a1f665.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>An EMA cross indicator in Pine Script v6 applied to a daily bitcoin chart, with the editor pinned to the right<\/figcaption><\/div>\n<\/figure>\n<h3>Where the editor lives<\/h3>\n<p>The editor is part of <a href=\"https:\/\/fire.bothub.chat\/en\/tradingview-alternative\">FiRe Trading<\/a>, the free charting terminal of BotHub FiRe. It accepts Pine Script compatible with TradingView, versions 5 and 6, alongside our own simpler formula language. You open it from the chart\u2019s top bar: the <strong>\u0192x<\/strong> button (\u201cMy indicators\u201d) \u2192 <strong>New Pine Script indicator<\/strong>. On a narrow screen the button may sit in the \u201cMore\u201d menu.<\/p>\n<p>The editor detects the language from the <code>\/\/@version=<\/code> line, so you can also paste a script into an ordinary \u201cNew indicator\u201d window \u2014 the status line under the code switches to \u201cPine Script\u201d. A script without a version line is read as v6. Versions 1\u20134 are rejected with a clear message (\u201cPine Script version 4 is not supported: use version 5 or 6\u201d), because <code>study()<\/code>, the old <code>sma()<\/code> without a namespace and the rest of v4 would need a separate front end.<\/p>\n<p>Nothing here requires signing in. Scripts are kept in the browser (IndexedDB); if you do log in, they also sync to your account and open on any device.<\/p>\n<h3>Step 1: an indicator<\/h3>\n<p>Let\u2019s start with the classic \u2014 two exponential moving averages and markers where they cross:<\/p>\n<pre><code>\/\/@version=6indicator(\"EMA cross\", overlay = true)fastLen = input.int(20, \"Fast EMA\", minval = 1)slowLen = input.int(50, \"Slow EMA\", minval = 1)fast = ta.ema(close, fastLen)slow = ta.ema(close, slowLen)plot(fast, \"Fast\", color = color.orange)plot(slow, \"Slow\", color = color.blue)bull = ta.crossover(fast, slow)bear = ta.crossunder(fast, slow)plotshape(bull, \"Buy\", shape.triangleup, location.belowbar, color.green, size = size.small)plotshape(bear, \"Sell\", shape.triangledown, location.abovebar, color.red, size = size.small)alertcondition(bull, \"Fast crossed above slow\", \"EMA cross up\")alertcondition(bear, \"Fast crossed below slow\", \"EMA cross down\")<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper\"><\/span><\/a><\/div><\/pre>\n<p>Paste it and press <strong>Apply to chart<\/strong>. Three things happen:<\/p>\n<ol>\n<li>\n<p>The two lines and the triangles appear on the price chart (the screenshot above is exactly this script on daily BTC).<\/p>\n<\/li>\n<li>\n<p>Both <code>input.int()<\/code> calls become number fields under the code. Change 20 to 9 and the chart recalculates \u2014 no need to touch the text.<\/p>\n<\/li>\n<li>\n<p>The status line says \u201cNo errors \u00b7 Pine Script \u00b7 On the price chart\u201d. The last part comes from <code>overlay = true<\/code>; without it the script gets its own pane.<\/p>\n<\/li>\n<\/ol>\n<p>Type a name, press <strong>Save<\/strong>, and the script appears in \u201cMy indicators\u201d and in the regular Indicators dialog, so you can drop it on any other chart. The editor window can be pinned to the right side of the terminal (the pin icon in its header), which is what you see in the screenshot: code on the right, chart on the left, and every \u201cApply\u201d redraws in place.<\/p>\n<p>The <code>alertcondition()<\/code> lines are not decoration. The bell in the indicator\u2019s legend lets you set an alert on any of them; a logged-in user\u2019s alerts are checked by the server even when the tab is closed (up to 5 alerts on your own scripts).<\/p>\n<h3>Step 2: break it<\/h3>\n<p>An interpreter is only as pleasant as its error messages. Here is a mistake almost everyone makes once:<\/p>\n<pre><code>\/\/@version=6indicator(\"Plot inside if\", overlay = true)fast = ta.ema(close, 20)slow = ta.ema(close, 50)if fast &gt; slow    plot(fast, \"Fast\", color.green)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/bb\/28\/09\/bb2809a30e61f6cce8a554b75eaa0586.png\" alt=\"The editor points at the exact line and column when a script breaks a rule of the language\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/bb\/28\/09\/bb2809a30e61f6cce8a554b75eaa0586.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/bb\/28\/09\/bb2809a30e61f6cce8a554b75eaa0586.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>The editor points at the exact line and column when a script breaks a rule of the language<\/figcaption><\/div>\n<\/figure>\n<p>The editor highlights the line and says: <em>Line 6, column 5 \u2014 plot() can be used only at the top level of the script, not inside a block or a function.<\/em> That is the language\u2019s own rule: the number of plots must be known before the first bar is calculated, so a conditional <code>plot<\/code> is illegal. The idiomatic fix is to plot conditionally by value \u2014 <code>plot(fast &gt; slow ? fast : na)<\/code>.<\/p>\n<p>Two other messages you may meet, both with a position in the text:<\/p>\n<ul>\n<li>\n<p><code>import is not supported yet<\/code> \u2014 libraries are not there yet (see \u201cWhat is missing\u201d below);<\/p>\n<\/li>\n<li>\n<p><code>There is no symbol \u2026<\/code> \u2014 <code>request.security()<\/code> asked for something we do not have. With <code>ignore_invalid_symbol = true<\/code> the request returns <code>na<\/code> instead.<\/p>\n<\/li>\n<\/ul>\n<h3>How the engine works<\/h3>\n<p>It is worth being precise here, because \u201cPine in the browser\u201d is easy to fake with a regex-based translator to JavaScript and <code>eval<\/code>. We did not do that.<\/p>\n<ul>\n<li>\n<p><strong>A real parser and interpreter.<\/strong> The text is parsed into a tree and executed bar by bar, as the language defines: the script runs once per candle, <code>var<\/code> keeps a value between bars, <code>varip<\/code> exists, <code>x[n]<\/code> works on the history of any expression. There is no <code>eval<\/code> and no <code>new Function<\/code> anywhere \u2014 the script has no access to the page, cookies or network.<\/p>\n<\/li>\n<li>\n<p><strong>The whole v5\/v6 syntax.<\/strong> Types and qualifiers, <code>if<\/code>, <code>switch<\/code>, <code>for<\/code>, <code>for\u2026in<\/code>, <code>while<\/code>, user functions and methods, <code>type<\/code>, <code>enum<\/code>, tuple returns <code>[a, b] = f()<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>446 built-in functions and 330 variables and constants.<\/strong> All 59 <code>ta.*<\/code> functions of the v6 reference, with the original formulas: Wilder\u2019s smoothing for RSI and ATR, seeding with the average of the first values, <code>na<\/code> at the start of a series. <code>label.*<\/code>, <code>line.*<\/code>, <code>box.*<\/code>, <code>table.*<\/code>, <code>polyline.*<\/code> (105 functions, with the language\u2019s object limits), <code>array.*<\/code>, <code>map.*<\/code>, <code>matrix.*<\/code> (115), <code>str.*<\/code>, <code>math.*<\/code>, <code>color.*<\/code>, <code>time()<\/code> and <code>session.*<\/code> with real exchange hours and DST.<\/p>\n<\/li>\n<li>\n<p><strong>Other symbols and intervals.<\/strong> <code>request.security<\/code> and <code>request.security_lower_tf<\/code> work without look-ahead; <code>barmerge.lookahead_on<\/code> behaves as in the language. Exchange-prefixed names are mapped automatically: <code>NASDAQ:AAPL<\/code>, <code>MOEX:SBER<\/code>, <code>BINANCE:BTCUSDT<\/code>, <code>CME_MINI:ES1!<\/code>, <code>TVC:DXY<\/code> all resolve to our symbols.<\/p>\n<\/li>\n<li>\n<p><strong>Budgets instead of freezes.<\/strong> A run has hard limits \u2014 100,000 iterations per loop, 100,000 candles per calculation, 5,000 bars of <code>x[n]<\/code> history, 64 plots, 500 inputs \u2014 and a time budget. A runaway <code>while<\/code> ends with an error pointing at the line, not with a frozen tab.<\/p>\n<\/li>\n<\/ul>\n<p>How much of real-world code does that cover? On 28 November 2026 we ran 966 open-source scripts through the engine on five candle series of different length (Apple daily and hourly, bitcoin hourly, BTC\/EUR and gold daily). <strong>834 of 966 (86%) compile and run without an error as they are<\/strong>, 895 (93%) at least compile. Strategies do better than indicators: 251 of 262 (96%) against 583 of 704 (83%). Most failures are libraries (<code>import<\/code>) and drawing-heavy scripts that hit a missing corner.<\/p>\n<h3>Step 3: from indicator to strategy<\/h3>\n<p>Swap <code>indicator()<\/code> for <code>strategy()<\/code> and add orders:<\/p>\n<pre><code>\/\/@version=6strategy(\"EMA cross strategy\", overlay = true,  initial_capital = 10000,  default_qty_type = strategy.percent_of_equity,  default_qty_value = 90,  commission_type = strategy.commission.percent,  commission_value = 0.1)fastLen = input.int(20, \"Fast EMA\", minval = 1)slowLen = input.int(50, \"Slow EMA\", minval = 1)stopPct = input.float(5, \"Stop, %\", minval = 0.5, step = 0.5)fast = ta.ema(close, fastLen)slow = ta.ema(close, slowLen)plot(fast, \"Fast\", color.orange)plot(slow, \"Slow\", color.blue)if ta.crossover(fast, slow)    strategy.entry(\"Long\", strategy.long)if ta.crossunder(fast, slow)    strategy.close(\"Long\")stopPrice = strategy.position_avg_price * (1 - stopPct \/ 100)strategy.exit(\"Stop\", \"Long\", stop = stopPrice)<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><span class=\"sc-logo-wrapper icon-only\"><\/span><\/a><\/div><\/pre>\n<p>After <strong>Apply to chart<\/strong> the trades appear on the chart and the tester panel opens under it: equity curve with drawdown, list of trades and a summary.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/extt\/5e\/77\/51\/5e77513be212b85aaefcf29093e112f5.png\" alt=\"The strategy tester under the chart: summary of an EMA cross strategy with a 5% stop\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/extt\/5e\/77\/51\/5e77513be212b85aaefcf29093e112f5.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/extt\/5e\/77\/51\/5e77513be212b85aaefcf29093e112f5.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>The strategy tester under the chart: summary of an EMA cross strategy with a 5% stop<\/figcaption><\/div>\n<\/figure>\n<p>On daily BTC\/USD, from 28 October 2025 to 4 December 2026 (403 candles \u2014 the depth of daily history on that chart), this strategy made three trades, one of them a winner, and ended at \u22121.94% ($9,806 out of $10,000, $51.91 of commission). Buy-and-hold over the same period lost 55.4%. Max drawdown was \u221210.4%. Do not read anything into these numbers beyond \u201cthe tester works\u201d: three trades is not a sample, and a test on history does not promise the same result in the future.<\/p>\n<p>What matters for a developer is <em>how<\/em> the tester fills orders, because that is where backtests usually lie:<\/p>\n<ul>\n<li>\n<p>The script runs once per candle, at its close, and sees the position after that candle\u2019s fills. It never reads a later candle.<\/p>\n<\/li>\n<li>\n<p>A market order fills at the <strong>open of the next candle<\/strong>; with <code>process_orders_on_close = true<\/code>, at the close of the same one.<\/p>\n<\/li>\n<li>\n<p>Inside a candle the price goes from the open to the <strong>nearer extreme first<\/strong>, then to the farther one, then to the close. So a stop and a target in the same candle resolve deterministically.<\/p>\n<\/li>\n<li>\n<p>A limit or stop fills at its own price, or at the market price after a gap.<\/p>\n<\/li>\n<li>\n<p><code>slippage<\/code> (in ticks) worsens market and stop fills; commission of any of the three kinds is charged on every fill; <code>pyramiding<\/code>, OCA groups and the risk rules are supported.<\/p>\n<\/li>\n<li>\n<p>There is no intrabar recalculation: <code>calc_on_order_fills<\/code> and <code>use_bar_magnifier<\/code> are not implemented yet. The tester uses four prices per candle \u2014 open, high, low, close.<\/p>\n<\/li>\n<\/ul>\n<p>A strategy is tested on the symbol\u2019s history, up to the last 20,000 candles of the chart\u2019s interval.<\/p>\n<h3>What is missing<\/h3>\n<p>Honest list, as of December 2026:<\/p>\n<ul>\n<li>\n<p><code>import<\/code> of libraries.<\/p>\n<\/li>\n<li>\n<p>Requests on special chart types: <code>ticker.renko<\/code>, <code>ticker.kagi<\/code>, <code>ticker.linebreak<\/code>, <code>ticker.pointfigure<\/code>.<\/p>\n<\/li>\n<li>\n<p><code>plotcandle<\/code> and <code>plotbar<\/code> are calculated, but the script\u2019s own candles are not drawn yet.<\/p>\n<\/li>\n<li>\n<p>Spreads in a request (<code>\"AAPL\/MSFT\"<\/code>) and exchange holidays inside session strings.<\/p>\n<\/li>\n<li>\n<p>Currency conversion in strategies.<\/p>\n<\/li>\n<li>\n<p>Pixel-exact placement of labels and tables: colours and widths follow the script, text may sit a few pixels off.<\/p>\n<\/li>\n<li>\n<p>Protected and invite-only scripts cannot be moved at all \u2014 their source is hidden by design.<\/p>\n<\/li>\n<\/ul>\n<h3>Sharing and limits<\/h3>\n<p><strong>Share<\/strong> gives a link to the chart; the texts of the scripts on it travel with the link (up to 120,000 bytes in total), and the recipient can save them. You can keep up to 50 scripts, each up to 262,144 characters, all texts together up to 4 MB \u2014 in the browser without an account, and in your account once you log in.<\/p>\n<h3>If Pine Script is overkill<\/h3>\n<p>Pine is a full language, and for \u201ca moving average of the candle body\u201d it is more than you need. The terminal has a second, much smaller formula language: <code>name = formula<\/code> lines, <code>plot()<\/code>, <code>input()<\/code>, a short list of functions, no types or blocks. It runs through the same chart, the same tester and the same alerts. The full guide with examples is <a href=\"https:\/\/fire.bothub.chat\/en\/trading\/custom-indicators\">here<\/a>.<\/p>\n<p>If you try your own scripts and hit something that should work but does not, tell us which function failed \u2014 the compatibility list grows from exactly those reports.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1115934\/\">https:\/\/habr.com\/ru\/articles\/1115934\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pine Script Online: Write, Run and Backtest Scripts in the Browser for FreePine Script is the de facto language for chart indicators: short, series-based, and readable by people who have never written a line of JavaScript. The usual way to use it ties you to one charting product. We wanted something different: to run Pine Script online, free and right in the browser, on our own charts, with no account and no install. So we wrote an interpreter for it.This post is a hands-on tour. We will paste an indicator, break it on purpose to see what the errors look like, then turn it into a strategy and read a backtest report. Along the way I will explain what the engine does under the hood, because \u201cit runs Pine Script\u201d can mean very different things. If you just want to try it, here is the page: run Pine Script online, free and right in the browser.An EMA cross indicator in Pine Script v6 applied to a daily bitcoin chart, with the editor pinned to the rightWhere the editor livesThe editor is part of FiRe Trading, the free charting terminal of BotHub FiRe. It accepts Pine Script compatible with TradingView, versions 5 and 6, alongside our own simpler formula language. You open it from the chart\u2019s top bar: the \u0192x button (\u201cMy indicators\u201d) \u2192 New Pine Script indicator. On a narrow screen the button may sit in the \u201cMore\u201d menu.The editor detects the language from the \/\/@version= line, so you can also paste a script into an ordinary \u201cNew indicator\u201d window \u2014 the status line under the code switches to \u201cPine Script\u201d. A script without a version line is read as v6. Versions 1\u20134 are rejected with a clear message (\u201cPine Script version 4 is not supported: use version 5 or 6\u201d), because study(), the old sma() without a namespace and the rest of v4 would need a separate front end.Nothing here requires signing in. Scripts are kept in the browser (IndexedDB); if you do log in, they also sync to your account and open on any device.Step 1: an indicatorLet\u2019s start with the classic \u2014 two exponential moving averages and markers where they cross:\/\/@version=6indicator(&#171;EMA cross&#187;, overlay = true)fastLen = input.int(20, &#171;Fast EMA&#187;, minval = 1)slowLen = input.int(50, &#171;Slow EMA&#187;, minval = 1)fast = ta.ema(close, fastLen)slow = ta.ema(close, slowLen)plot(fast, &#171;Fast&#187;, color = color.orange)plot(slow, &#171;Slow&#187;, color = color.blue)bull = ta.crossover(fast, slow)bear = ta.crossunder(fast, slow)plotshape(bull, &#171;Buy&#187;, shape.triangleup, location.belowbar, color.green, size = size.small)plotshape(bear, &#171;Sell&#187;, shape.triangledown, location.abovebar, color.red, size = size.small)alertcondition(bull, &#171;Fast crossed above slow&#187;, &#171;EMA cross up&#187;)alertcondition(bear, &#171;Fast crossed below slow&#187;, &#171;EMA cross down&#187;)Paste it and press Apply to chart. Three things happen:The two lines and the triangles appear on the price chart (the screenshot above is exactly this script on daily BTC).Both input.int() calls become number fields under the code. Change 20 to 9 and the chart recalculates \u2014 no need to touch the text.The status line says \u201cNo errors \u00b7 Pine Script \u00b7 On the price chart\u201d. The last part comes from overlay = true; without it the script gets its own pane.Type a name, press Save, and the script appears in \u201cMy indicators\u201d and in the regular Indicators dialog, so you can drop it on any other chart. The editor window can be pinned to the right side of the terminal (the pin icon in its header), which is what you see in the screenshot: code on the right, chart on the left, and every \u201cApply\u201d redraws in place.The alertcondition() lines are not decoration. The bell in the indicator\u2019s legend lets you set an alert on any of them; a logged-in user\u2019s alerts are checked by the server even when the tab is closed (up to 5 alerts on your own scripts).Step 2: break itAn interpreter is only as pleasant as its error messages. Here is a mistake almost everyone makes once:\/\/@version=6indicator(&#171;Plot inside if&#187;, overlay = true)fast = ta.ema(close, 20)slow = ta.ema(close, 50)if fast &gt; slow    plot(fast, &#171;Fast&#187;, color.green)The editor points at the exact line and column when a script breaks a rule of the languageThe editor highlights the line and says: Line 6, column 5 \u2014 plot() can be used only at the top level of the script, not inside a block or a function. That is the language\u2019s own rule: the number of plots must be known before the first bar is calculated, so a conditional plot is illegal. The idiomatic fix is to plot conditionally by value \u2014 plot(fast &gt; slow ? fast : na).Two other messages you may meet, both with a position in the text:import is not supported yet \u2014 libraries are not there yet (see \u201cWhat is missing\u201d below);There is no symbol \u2026 \u2014 request.security() asked for something we do not have. With ignore_invalid_symbol = true the request returns na instead.How the engine worksIt is worth being precise here, because \u201cPine in the browser\u201d is easy to fake with a regex-based translator to JavaScript and eval. We did not do that.A real parser and interpreter. The text is parsed into a tree and executed bar by bar, as the language defines: the script runs once per candle, var keeps a value between bars, varip exists, x[n] works on the history of any expression. There is no eval and no new Function anywhere \u2014 the script has no access to the page, cookies or network.The whole v5\/v6 syntax. Types and qualifiers, if, switch, for, for\u2026in, while, user functions and methods, type, enum, tuple returns [a, b] = f().446 built-in functions and 330 variables and constants. All 59 ta.* functions of the v6 reference, with the original formulas: Wilder\u2019s smoothing for RSI and ATR, seeding with the average of the first values, na at the start of a series. label.*, line.*, box.*, table.*, polyline.* (105 functions, with the language\u2019s object limits), array.*, map.*, matrix.* (115), str.*, math.*, color.*, time() and session.* with real exchange hours and DST.Other symbols and intervals. request.security and request.security_lower_tf work without look-ahead; barmerge.lookahead_on behaves as in the language. Exchange-prefixed names are mapped automatically: NASDAQ:AAPL, MOEX:SBER, BINANCE:BTCUSDT, CME_MINI:ES1!, TVC:DXY all resolve to our symbols.Budgets instead of freezes. A run has hard limits \u2014 100,000 iterations per loop, 100,000 candles per calculation, 5,000 bars of x[n] history, 64 plots, 500 inputs \u2014 and a time budget. A runaway while ends with an error pointing at the line, not with a frozen tab.How much of real-world code does that cover? On 28 November 2026 we ran 966 open-source scripts through the engine on five candle series of different length (Apple daily and hourly, bitcoin hourly, BTC\/EUR and gold daily). 834 of 966 (86%) compile and run without an error as they are, 895 (93%) at least compile. Strategies do better than indicators: 251 of 262 (96%) against 583 of 704 (83%). Most failures are libraries (import) and drawing-heavy scripts that hit a missing corner.Step 3: from indicator to strategySwap indicator() for strategy() and add orders:\/\/@version=6strategy(&#171;EMA cross strategy&#187;, overlay = true,  initial_capital = 10000,  default_qty_type = strategy.percent_of_equity,  default_qty_value = 90,  commission_type = strategy.commission.percent,  commission_value = 0.1)fastLen = input.int(20, &#171;Fast EMA&#187;, minval = 1)slowLen = input.int(50, &#171;Slow EMA&#187;, minval = 1)stopPct = input.float(5, &#171;Stop, %&#187;, minval = 0.5, step = 0.5)fast = ta.ema(close, fastLen)slow = ta.ema(close, slowLen)plot(fast, &#171;Fast&#187;, color.orange)plot(slow, &#171;Slow&#187;, color.blue)if ta.crossover(fast, slow)    strategy.entry(&#171;Long&#187;, strategy.long)if ta.crossunder(fast, slow)    strategy.close(&#171;Long&#187;)stopPrice = strategy.position_avg_price * (1 &#8212; stopPct \/ 100)strategy.exit(&#171;Stop&#187;, &#171;Long&#187;, stop = stopPrice)After Apply to chart the trades appear on the chart and the tester panel opens under it: equity curve with drawdown, list of trades and a summary.The strategy tester under the chart: summary of an EMA cross strategy with a 5% stopOn daily BTC\/USD, from 28 October 2025 to 4 December 2026 (403 candles \u2014 the depth of daily history on that chart), this strategy made three trades, one of them a winner, and ended at \u22121.94% ($9,806 out of $10,000, $51.91 of commission). Buy-and-hold over the same period lost 55.4%. Max drawdown was \u221210.4%. Do not read anything into these numbers beyond \u201cthe tester works\u201d: three trades is not a sample, and a test on history does not promise the same result in the future.What matters for a developer is how the tester fills orders, because that is where backtests usually lie:The script runs once per candle, at its close, and sees the position after that candle\u2019s fills. It never reads a later candle.A market order fills at the open of the next candle; with process_orders_on_close = true, at the close of the same one.Inside a candle the price goes from the open to the nearer extreme first, then to the farther one, then to the close. So a stop and a target in the same candle resolve deterministically.A limit or stop fills at its own price, or at the market price after a gap.slippage (in ticks) worsens market and stop fills; commission of any of the three kinds is charged on every fill; pyramiding, OCA groups and the risk rules are supported.There is no intrabar recalculation: calc_on_order_fills and use_bar_magnifier are not implemented yet. The tester uses four prices per candle \u2014 open, high, low, close.A strategy is tested on the symbol\u2019s history, up to the last 20,000 candles of the chart\u2019s interval.What is missingHonest list, as of December 2026:import of libraries.Requests on special chart types: ticker.renko, ticker.kagi, ticker.linebreak, ticker.pointfigure.plotcandle and plotbar are calculated, but the script\u2019s own candles are not drawn yet.Spreads in a request (&#171;AAPL\/MSFT&#187;) and exchange holidays inside session strings.Currency conversion in strategies.Pixel-exact placement of labels and tables: colours and widths follow the script, text may sit a few pixels off.Protected and invite-only scripts&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-506094","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/506094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=506094"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/506094\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=506094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=506094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=506094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}