Getting Started with WealthScript
Updated
WealthScript is the language you write your own indicators and strategies in. You write it in the Code Editor, which lives in the main menu under Research & Analysis Tools > WealthScript. Save and Compile checks your script and flags an error on the line that caused it; Apply to chart puts the result on your charts.
YOUTUBE: How to add indicators from WealthScript to charts
A script runs once per bar. It reads that bar, decides something, and draws or trades. A useful script can be four lines:
[PlotStyle(1, Dots, 5)]
let buyDot = close > close[1] and close[1] > close[2]
if buyDot then
plot1(low, "Buy Signal", Green)
endThe attribute on the first line says how plot slot 1 is drawn: dots, size 5. The word let names a value for the current bar. Brackets read earlier bars, so close[1] is the previous bar's close. And plot1 draws into slot 1, where the name in quotes is what the chart legend shows.
Two things are worth knowing before you write more. The language is case insensitive, so Close and close are the same word. And every word the language knows is in the WealthScript Reference, every error the compiler can raise on WealthScript Error Codes, and how the language works in the WealthScript Language Guide. All of them are generated from the language release, so they never drift from what the compiler accepts.
When the editor shows an error, hover the underlined code. An error with a code shows View details there: it opens that code on the WealthScript Error Codes page, with what it means and what to write instead.