Changes save automatically on this device.
Server runs explicitly upload the revealed/loaded bars and script to this LAN server for reproducibility. Local Run stays in the browser.
Single position · no leverage · next-bar fills · fees on both sides · open positions closed at end of test. Equity drawdown measured at bar close.
XChart 1.6.0
TradingView Lightweight Charts™Copyright (с) 2025 TradingView, Inc. TradingView
Attribution notice · Apache 2.0 license
Move the crosshair and tap each anchor. The drawing finishes automatically. Tap a drawing to move or resize it; tap outside to deselect. Channels and Fibonacci extensions use three anchors.
Select a drawing on the chart to move it or drag either anchor. Double-click or long-press/right-click to edit its properties. Locked drawings can still be edited here.
A Pine-style subset for XChart. Full Pine Script compatibility is not included. Unsupported statements fail with a line number.
strategy("My strategy") fast = ta.ema(close, 9) slow = ta.ema(close, 21) plot(fast, "Fast EMA") plot(slow, "Slow EMA") if ta.crossover(fast, slow) strategy.entry("Long", strategy.long) if ta.crossunder(fast, slow) strategy.close("Long")
Declarations: strategy("Name") or indicator("Name"). Declaration options are descriptive only; use the backtest settings for execution costs and capital.
Series: open, high, low, close, volume, hl2, hlc3, ohlc4, bar_index. History: close[1]. Variables: fast = expression.
Functions: ta.sma, ta.ema, ta.rsi (rolling gain/loss RSI), ta.highest, ta.lowest, ta.crossover, ta.crossunder; math.abs, math.min, math.max; nz; input.int, input.float, input.bool, input.source (positional default values).
Operators: + − * / %, >, <, >=, <=, ==, !=, and, or, not. Indented if blocks support entry/close calls. strategy.entry("ID", strategy.long/short), strategy.close("ID"), strategy.close_all(). No pyramiding, stop/limit orders, loops, functions, request.security, named arguments or alerts.
CSV: time,open,high,low,close,volume. Time can be Unix seconds, milliseconds, or ISO dates. Import timezone-aware intraday timestamps. Data is sorted, validated, kept locally, and can be aggregated to a larger timeframe. No smaller bars are invented.
Data: Crypto uses Binance public historical klines. US equities use Alpaca (IEX default, not consolidated SIP). Philippine stocks use EODHD PSE daily/weekly data. Configure credentials in the server .env. Demo is explicitly synthetic.
Backtesting: Signals at close; fills at next standard open with adverse slippage. Single fully funded long or short position. Short borrow, funding, dividends, lot-size rules, taxes and corporate actions are not modeled. First-price-seeded EMA differences and rolling RSI can differ from Pine. No live trading.
Drawings: Select a tool, then click on the chart. Fibonacci values interpolate between anchors; logarithmic Fibonacci uses exp(log(A) + r × (log(B) − log(A))). Drawings, scripts, and the last chart view save automatically on this device. Select a drawing to drag it, drag its handles to resize, or open Edit to change coordinates, styles, and Fibonacci levels. Fibonacci follows the chart scale by default.