RoboQuant
Legacy · TradingView

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

StrategyIndicator
Declarationstrategy(...)indicator(...)
PositionsYes — Strategy TesterNo
Backtest statsFull trade listN/A (unless paired with strategy)
Webhook modeAuto — strategy variablesManual — you set buy/sell + qty
RoboChartsCan attachPrimary use case

Drawing primitives

Indicators commonly use:

PrimitivePurpose
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 = first plot() 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:

  1. Condition: your indicator + specific alert condition (or "Any alert() function call")
  2. Webhook URL: from RoboQuant Webhooks tab
  3. Message: JSON from RoboQuant alert builder
  4. 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:

  1. Build indicator in workspace
  2. Deploy to TradingView chart
  3. Save layout in RoboCharts
  4. 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.