WealthScript · Code · Backtest

Turn your trading idea into an indicator.
In minutes.

WealthScript is WealthCharts' built-in language for custom indicators and strategies. Write it yourself, or describe it in plain English, typed or spoken aloud where your AI assistant supports voice, and let the AI write it. Then backtest it on real history before you risk a dollar.

Write it, type it or say it to AIConvert from any platformBacktest before you risk a dollar
WealthCharts · custom WealthScript on a live chart
What you can build

One language, one editor, every chart. Everything below is in the reference today.

Indicators
Up to 99 plots per script, on price or in their own pane.
Strategies
Buy, sell and short orders you can run in the Strategy Tester.
Alerts
A platform alert with sound on the bar that matters.
Bar coloring
Paint bars and background bands on any condition.
Custom inputs
Settings traders change from the chart dialog, no code.
Drawings & tables
Trend lines, levels, labels, rectangles, on-chart tables.
216 built-in functions
Averages, RSI, MACD, ATR, Bollinger, SuperTrend, pivots.
Platform indicators
Import any indicator your account holds into your script.
Bring your code

Your indicators move with you.

Spent years building indicators somewhere else? Don't start over. Paste your existing script into ChatGPT, Claude or any AI assistant along with our official WealthScript reference, and it rewrites it in WealthScript, the advanced WealthCharts language. Same logic, same signals, on your new charts.

Legacy languages & systems
Scripts and indicators you wrote for any of the legacy trading platforms, in whatever language they used.
converts to
WealthCharts · the advanced future
WealthScript is one language for your indicators, strategies and backtesting, built to run natively on every WealthCharts chart.
  1. 01Copy your indicator's source code.
  2. 02Hand your AI assistant the WealthScript reference and ask it to convert the script for you.
  3. 03Paste the result into the Code Editor, compile it, and apply it to any chart you trade on.
Sell what you build. List your indicators on the WealthCharts Marketplace and reach traders already on the platform.
See the conversion guide
legacy.txtLegacy
1//@version=52indicator("Fast/Slow MA Cross", overlay=true)3fastLen = input.int(10, "Fast")4slowLen = input.int(30, "Slow")5fastMA = ta.sma(close, fastLen)6slowMA = ta.sma(close, slowLen)7plot(fastMA, "fast MA")8plot(slowMA, "slow MA")9barcolor(fastMA > slowMA ? color.green : na)10if ta.cross(fastMA, slowMA)11    alert("Fast/slow MA cross")
ma_cross.wsWealthScript
Hover a line to see its match11 legacy lines in · 13 WealthScript lines out · same signals
your ideaTyped or spoken
“Plot a fast and a slow moving averageon the price chart,colour the bar when the fast averageis above the slow one,and raise an alert on the barwhere the two averages cross.
ma_cross.wsWealthScript
Hover a line to see its matchOne sentence in · 13 WealthScript lines out · compiled unedited
No code? Describe it.

Say what you want. Get the script.

Never written a line of code? Tell your AI assistant what the indicator should do, in plain English. Type it, or just say it out loud where your assistant supports voice to text. Hand it our WealthScript reference and it writes the whole script. The example here is the exact request from our tutorial and the exact script that came back, compiled and applied unedited.

  1. 01Describe the indicator in a sentence or two.
  2. 02Hand your AI assistant the WealthScript reference and ask it to write the whole script for you.
  3. 03Paste the result into the Code Editor, compile it, and apply it to any chart you trade on.
Get the AI prompt
How It Works

Idea to backtest in four steps.

Step 1 · Convert it with AI
Starter Scripts

Copy one. Paste it. Trade in five minutes.

Four small scripts written straight from the reference. Copy, paste into the Code Editor, compile, and change the inputs from the chart dialog.

rsi_zones.ws
1[Name = "RSI Zones"]2[PlotSubchart(1, 1)]3[PlotSubchart(2, 1)]4[PlotSubchart(3, 1)]5input Len(14);6input Overbought(70);7input Oversold(30);8let rsiVal = RSI(close, Len);9plot1(rsiVal, "RSI");10plot2(Overbought, "overbought", Red);11plot3(Oversold, "oversold", Green);12if rsiVal > Overbought then13  ColorBar(Red);14elseif rsiVal < Oversold then15  ColorBar(Green);16end;
RSI ZonesOscillatorBar coloringInputs

RSI in its own pane with overbought and oversold levels, and the bar painted when price is stretched.

breakout_alert.ws
1[Name = "Breakout Alert"]2input Len(20);3let hiBand = Highest(high, Len);4let loBand = Lowest(low, Len);5plot1(hiBand[1], "breakout high", Green);6plot2(loBand[1], "breakout low", Red);7if close > hiBand[1] and CheckAlert() then8  Alert("Breakout above the range high");9end;10if close < loBand[1] and CheckAlert() then11  Alert("Breakdown below the range low");12end;
Breakout AlertAlertsLevelsInputs

Draws the prior N-bar high and low on price and alerts once when a close breaks either side.

bollinger_bands.ws
1[Name = "Bollinger Bands"]2input Len(20);3input Dev(2);4let upperBand = BollingerBand(close, Len, Dev);5let lowerBand = BollingerBand(close, Len, -Dev);6plot1(upperBand, "upper");7plot2(lowerBand, "lower");8plot3(Average(close, Len), "basis", DarkGray);9if close > upperBand then10  ColorBar(Green);11elseif close < lowerBand then12  ColorBar(Red);13end;
Bollinger BandsBandsBar coloringInputs

Upper and lower bands around a moving average, with the bar painted on a close outside them.

ma_cross_strategy.ws
1[Name = "MA Cross Strategy"]2input FastLen(10);3input SlowLen(50);4input StopPct(2);5let quick = Average(close, FastLen);6let slowly = Average(close, SlowLen);7if CrossOver(quick, slowly) then8  buy("Long") 1 contracts next bar at market;9end;10if CrossUnder(quick, slowly) then11  sell("Flat") all next bar at market;12end;13if MarketPosition() != 0 then14  SetStopPercent(StopPct, false);15end;16plot1(quick, "fast");17plot2(slowly, "slow");
MA Cross StrategyStrategyBacktestStop loss

Goes long on a fast-over-slow cross, flattens on the cross back, with a percent stop. Built for the Strategy Tester.

FAQ

Quick answers.

Stop trading someone else's indicator.
Build your own edge with WealthScript.

Included with every WealthCharts membership. Code it, AI it, backtest it, trade it.