Reference the connector reads

Changed

A connected app reads the text below when it writes BullScript™. You are reading the same text. There is not a second copy.

The pages in the sidebar are the longer guide: examples, the Pine Script comparison, and one page per name. This block is the short version the app is given.

text
1BullScript™ writes an indicator on the member's chart.
2
3A script starts with indicator("Name", overlay=true) to draw on the price, or overlay=false for a separate pane.
4
5Bars: open, high, low, close, volume, hl2, hlc3, ohlc4, bar_index, time. na means no value.
6
7Inputs: length = input.int(20, "Length", minval=1). Also input.float, input.bool, input.string, input.source.
8
9Draw: plot(series, "Title", color=color.orange, linewidth=2). plotshape, plotchar, hline, fill, bgcolor, label.new, line.new, table.new.
10
11Logic: if else, for to, and or not, == != > < >= <=, ? :. Comparisons and ta.crossover / ta.crossunder return a boolean.
12
13ta: sma, ema, rma, wma, rsi, macd, atr, bb, stoch, change, cross, crossover, crossunder, highest, lowest, pivothigh, pivotlow.
14math: abs, max, min, round, sqrt, pow. str: format, tostring. color: rgb, r, g, b, and color.green, color.red, color.orange.
15
16Example, a 20-bar average and a cross of price:
17
18indicator("Average cross", overlay=true)
19length = input.int(20, "Length", minval=1)
20basis = ta.sma(close, length)
21plot(basis, "Basis", color=color.orange)
22plotshape(ta.crossover(close, basis), "Cross up", style=shape.triangleup, location=location.belowbar, color=color.green, size=size.tiny)
23
24Other symbols and timeframes: request.security(symbol, timeframe, expression) reads any market Bullmania charts, on any chart: a coin ("BINANCE:ETHUSDT"), a stock ("NASDAQ:AAPL"), an index ("SPX"), Fear & Greed ("FNG"), or a computed index P/E ("SPX.PE", "SPX.FPE", "NDX.PE", "NDX.FPE"). The symbol is the text you would type in Symbol Search. timeframe is "60", "240", "D", "W" or "M", or "" for the chart's. Values line up with the chart's bars, and a higher timeframe gives only bars that have closed (the week so far is not used) unless lookahead = barmerge.lookahead_on. Where the other market has no bar (a stock on a weekend), the last value carries on; gaps = barmerge.gaps_on gives na there instead. request.security_lower_tf(symbol, timeframe, expression) returns an array of the lower-timeframe values inside each chart bar; another symbol's days are available on weekly and monthly charts. A market with little or no history is not an error: its values are na until it has bars. A symbol Bullmania cannot find stops the script with the reason at that line, unless you pass ignore_invalid_symbol = true (then na). A script reads at most 40 different symbol and timeframe combinations (the chart's own other timeframes included; the same symbol and timeframe asked twice counts once); past that it stops with "This script requests N different symbol and timeframe combinations. The limit is 40 per script." Charts, alerts, backtests and this connector all compute the same values.
25
26Example, Fear & Greed under BTC and the S&P 500 P/E:
27
28indicator("Sentiment and valuation", overlay=false)
29fng = request.security("FNG", "D", close)
30pe = request.security("SPX.PE", "D", close)
31weekly = request.security("FNG", "W", ta.sma(close, 4))
32plot(fng, "Fear & Greed", color=color.orange)
33plot(weekly, "Fear & Greed, 4-week average", color=color.gray)
34plot(pe, "S&P 500 P/E", color=color.green)
35hline(25, "Extreme fear")
36hline(75, "Extreme greed")
37
38Example, Bitcoin relative to Ethereum on any chart: ratio = request.security("BINANCE:BTCUSDT", "D", close) / request.security("BINANCE:ETHUSDT", "D", close).
39
40Future dates draw exactly like past ones. Zones and future dates: color a time zone (a cycle phase, a session) with bgcolor(color); it fills the pane's full height, whatever zoom or price window the reader has (including a manual window far above and below the candles), and never moves the price axis. Future bars: add bgcolor(colorFor(time + n * barMs), offset = n) with a fixed n, painting only where bar_index + n > last_bar_index; a future bar takes the color computed on bar j - n, so n must stay below the number of bars on the chart (barMs = timeframe.in_seconds(timeframe.period) * 1000). plot(series, offset = n) and fill() between two such plots draw n bars ahead the same way. line.new, label.new, box.new and polyline.new with xloc = xloc.bar_time take any time, future included, and linefill.new fills between two such lines; a vertical marker through the pane is line.new(t, close, t, close * 1.01, xloc = xloc.bar_time, extend = extend.both). A linefill between two price lines is a price range, not a zone. A box is a price range: never fake a full-height zone with a made-up top or bottom (high * 3, 0, a negative price, 1e10). table.new may use any position; a top table sits under the legend.
41
42Example, a zone over history and 300 bars ahead:
43
44indicator("Zones", overlay=true)
45AHEAD = 300
46barMs = timeframe.in_seconds(timeframe.period) * 1000
47zone(t) => t >= timestamp("UTC", 2027, 2, 1, 0, 0) and t < timestamp("UTC", 2028, 4, 15, 0, 0) ? color.new(color.gray, 75) : na
48bgcolor(zone(time), title="Zone")
49bgcolor(bar_index + AHEAD > last_bar_index ? zone(time + AHEAD * barMs) : na, offset=AHEAD, title="Zone ahead")
50
51A run returns the latest values, the crossings, and any label or table text. It does not return the series or this source back unless the script is the member's own.
52
53Logs: log.info("text"), log.warning(...), log.error(...), or log.info("close {0} rsi {1}", close, rsi) with str.format placeholders. A run returns the newest 50 entries as logs (level, bar_time, bar_index, line, message) and logs_dropped for the rest. Use them to see values on the bars you care about, for example if barstate.islast then log.info(...).
54
55Errors: runtime.error("message") stops the script with your message. A failed run returns error_detail with class, code, step, message, retryable, trace_id, and for script errors the line, column and bar. Classes: script_compile and script_runtime are problems in the code (fix the line, do not retry unchanged); engine_internal is not the script's fault (retry once, then report the trace_id); data_provider means the market data could not be loaded (retry later); timeout and limit mean the script was too slow or too large (make it lighter); system means the script or service could not be reached (retry later).

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