Pine Script Indicators (Legacy)
Legacy path. For native RoboQuant chart indicators, see RoboQuant indicators.
RoboQuant indicators can be Pine Script v5 scripts declared with indicator(). They visualize market structure on your chart and can optionally drive webhook alerts.
Minimal indicator skeleton
//@version=5
indicator("Session Box", overlay=true)
session = input.session("0930-1600", "Session", group="Session")
boxColor = input.color(color.new(color.green, 80), "Box Color", group="Visual")
inSession = not na(time(timeframe.period, session, "America/New_York"))
var float sessHigh = na
var float sessLow = na
if inSession
sessHigh := na(sessHigh) ? high : math.max(sessHigh, high)
sessLow := na(sessLow) ? low : math.min(sessLow, low)
plot(sessHigh, "Session High", color=color.green, display=display.none)
plot(sessLow, "Session Low", color=color.red, display=display.none)
Strategy vs indicator
| Strategy | Indicator | |
|---|---|---|
| Declaration | strategy(...) | indicator(...) |
| Positions | Yes — Strategy Tester | No |
| Backtest stats | Full trade list | N/A (unless paired with strategy) |
| Webhook mode | Auto — strategy variables | Manual — you set buy/sell + qty |
| RoboCharts | Can attach | Primary use case |
Drawing primitives
Indicators commonly use:
| Primitive | Purpose |
|---|---|
plot() | Lines, hidden values for alerts |
plotshape() | Entry/signal markers |
line.new() / box.new() | Dynamic levels and zones |
label.new() | Text annotations |
bgcolor() | Session shading |
Hide plots used only for alerts:
signal = close > ta.sma(close, 20) ? 1 : 0
plot(signal, "Long Signal", display=display.none)
Plot variables in webhooks
When deploying an indicator via webhook, you can pass plot values to RoboQuant using TradingView placeholders:
{{plot_0}} through {{plot_19}}
plot_0= firstplot()in your script (order matters)- Use for custom signal values, dynamic stop levels, or filter flags
In the RoboQuant dashboard (Webhooks → Alert setup), choose Indicator mode and configure action/quantity manually — unlike strategies, TradingView does not auto-fill order side from indicator logic.
Alert conditions
Create a TradingView alert on your indicator:
- Condition: your indicator + specific alert condition (or "Any alert() function call")
- Webhook URL: from RoboQuant Webhooks tab
- Message: JSON from RoboQuant alert builder
- Frequency: Once Per Bar Close (recommended)
Using alert() in Pine
bullishBreak = close > sessHigh and not inSession[1]
if bullishBreak
alert("Bullish session break", alert.freq_once_per_bar_close)
Metadata convention
// === METADATA ===
// @category: indicator
// @title: NY Session Box Indicator
// @components: SessionRangeBox
RoboCharts integration
Indicators saved in your account appear under My Indicators on the dashboard. Indicators marked On chart are attached to saved RoboCharts layouts.
Workflow:
- Build indicator in workspace
- Deploy to TradingView chart
- Save layout in RoboCharts
- Optionally wire alerts to live execution
Common patterns in RoboQuant knowledge base
Reusable building blocks (see strategies-knowledge/ in the repo):
- SessionRangeBox — session high/low boxes
- FvgRegistry — fair value gap tracking
- StructureTracker — break of structure (BoS)
- LiquidityLevels — swept highs/lows
- TradeBoxRenderer — entry/SL/TP visualization
When asking the AI to build an indicator, reference these components by name for consistent output.
Related
- Pine strategies — when you need TradingView backtests and automatic webhook order fields
- TradingView deployment — indicator versus strategy alert modes
- Webhook reference — JSON fields and plot variables