WickScript
WickScript is ChartRider's scripting language for writing your own indicators and backtestable trading strategies in short, sentence-like lines.
WickScript is the scripting language of ChartRider. You use it to write your own indicators (lines, histograms, marks, levels and HUD lines on the chart) and your own strategies (entries, stops, targets and exits that the backtest trades). A script reads almost like a sentence:
wickscript 1
indicator "EMA Cross" on chart
fast = ema(close, input 9 "Fast")
slow = ema(close, input 21 "Slow")
show fast as line "Fast" color amber
show slow as line "Slow" color blue
when fast crosses above slow
alert "Fast EMA crossed above"
endThe language is built around a few rules:
- Every script starts with its version and its kind. The first line is
wickscript 1, the second says what the script is:indicator "Name"orstrategy "Name". Comments may come before the version line. - Units are strict. Every number has a unit (price, percentage, amount, candles, R, time span, plain number).
close + 5is an error because 5 has no price unit – writeclose + 5 * tickorclose + 0.5%. The checker tells you how to fix it. - No look-ahead. A script runs candle by candle from left to right and can only read the current and earlier candles.
close[1]is the previous close;close[-1]is an error.ema(close, 50) on 4huses the last closed 4h candle. What works in the backtest works the same way live. - Forgiving syntax. Indentation, blank lines and upper/lower case don't matter (
EMA,emaandEmaare the same name). Blocks end withend. - Safe. Scripts have no access to the network, files or JavaScript, and they can only trade paper money in backtests.
Access
WickScript is unlocked by inviting friends: once three people have created a ChartRider account through your invite link, WickScript is unlocked for your account permanently. You find your invite link in your account – see Account. Your scripts are saved in your strategies and only you can see them.
Where you write scripts
Open Strategies (F6) → Strategy Lab → Scripts. The Scripts tab lists the scripts of the active strategy.
- New script starts from a template: the EMA cross indicator, the EMA cross strategy, a breakout strategy with partial exit and trailing stop, a blank script, or one of the standard indicators (SMA, EMA, RSI, MACD …), which are WickScripts too.
- The editor colors the code, underlines problems and offers a fix to click, shows help when you hover a name and suggests names while you type (arrow keys to choose, Enter or Tab to accept). Tab indents by four spaces.
- Apply or Ctrl/⌘ + Enter applies the script to the chart. Only scripts without errors are applied; warnings and hints are allowed.
- Format or Shift + Alt + F indents blocks by four spaces, writes every name the way it was first defined and removes trailing spaces. Text in quotes and comments stay as they are.
- Below the editor you see the inputs, the outputs with a preview on the chart's candles, and At the crosshair: the value of every variable at the candle you last hovered in the chart (step candle by candle with ◀ ▶), plus the lines written by
log. - For a strategy script the tab also shows a backtest preview of your draft while you type: number of trades, short/long, win rate, total R and R per trade.
A WickScript indicator also appears in the indicator list (F3) as "WickScript", and its outputs can be used like any other indicator in the Trade Setup.
Indicators and strategies
| Indicator | Strategy | |
|---|---|---|
| Head line | indicator "Name" on chart or indicator "Name" in pane | strategy "Name" risk 1% |
| Draws | lines, histograms, events, marks, levels, HUD lines | the same, plus its trades in the backtest |
| Trades | no | enter, stop at, target at, exit … |
| Reads the open position | no | position.r, bars since entry … |
| Reads other indicators of the strategy | no | use RSI1 as r |
A minimal strategy: buy when the fast EMA crosses above the slow one, stop below the low of the last 10 candles, target at twice the risk.
wickscript 1
strategy "EMA cross" risk 1%
fast = ema(close, input 9 "Fast")
slow = ema(close, input 21 "Slow")
show fast as line "Fast" color amber
show slow as line "Slow" color blue
when fast crosses above slow
tag "cross long"
enter long at market
stop at lowest(low, 10) - 2 * tick
target at 2R
end
when fast crosses below slow
tag "cross short"
enter short at market
stop at highest(high, 10) + 2 * tick
target at 2R
endTo trade with a strategy script, click Trade with this script in the Scripts tab. From then on F5 and Run strategy backtest the applied version of the script. The first script with a strategy head line is the one that trades.
A second example: marks and a HUD line
wickscript 1
indicator "RSI extremes" on chart
r = rsi(close, input 14 "RSI length")
when r crosses above 70
mark "OB" above color red
end
when r crosses below 30
mark "OS" below color green
end
hud "RSI {r}"mark writes a label above the high or below the low of the candle, hud adds a line with the latest value to the HUD stack of the chart.
The WickScript pages
- Language guide – syntax, units, operators, conditions,
if/when, functions, inputs and all output statements. - Indicators – outputs and panes, inputs as settings and Step 1 / Step 2,
use indicator, the standard indicators as WickScript. - Strategies – entries, stops, targets, partial exits, breakeven, trailing stops, the open position, metrics and the backtest.
- Data – other timeframes and markets, sessions and killzones, orderflow, footprint, ticks and the order book.
- Reference – every built-in value, function and keyword.
Logo
The WickScript logo carries a KillerWick – the glowing wick tip the ChartRider chart draws at the end of violent moves – as the dot on the i. You may use it to link to or talk about WickScript:
- Wordmark (SVG) · PNG – for dark backgrounds
- Mark (SVG) · PNG – the candle with its KillerWick in code braces, for icons and small sizes