Getting started

Changed

You write BullScript™ to put an indicator on your chart.

If you already write Pine Script, start with BullScript™ and Pine Script. The calls for a header, an input, a moving average, and a plot look the same. Differences from Pine Script is the list of what does not.

Write the first script#

  1. Open a chart.
  2. Open the BullScript™ editor. On a large screen it is the code button under Alerts. You can also open it from Indicators, then My scripts.
  3. Paste the script below and add it to the chart.

The script draws the close on top of the price.

bullscript-run
//@version=6
indicator("Close", overlay=true)
plot(close)

overlay=true draws on the price. Use overlay=false when the script should sit in its own pane.

Read the bar#

You can use these names without a prefix: open, high, low, close, volume, hl2, hlc3, ohlc4, bar_index, and time. na means there is no value.

Add a setting#

An input is a number, a switch, or a choice the chart shows. This one is a length, at least 1.

bullscript-run
1//@version=6
2indicator("Average", overlay=true)
3length = input.int(20, "Length", minval=1)
4plot(ta.sma(close, length))

The same family includes input.float, input.bool, input.string, and input.source.

Draw#

plot draws a line. You can also use plotshape, plotchar, hline, fill, bgcolor, label.new, line.new, and table.new. Each name has a page in the sidebar.

if and else, for, and, or, not, comparisons, and ? : are the usual logic. ta.crossover and ta.crossunder are true or false.

Where to go next#

Each function page names the call and shows the editor hint when there is one. If a call is not accepted, the script stops on that line and the message says why.

Bullmania is not affiliated with, endorsed or sponsored by TradingView. Pine Script and TradingView are trademarks of TradingView, Inc.