RocnRoll
RocnRoll in ProBuilder returns discrete trading signals, 1 bullish, 2 bearish, -1 exit, built from rate of change and exponential averages. Syntax, examples.
Syntax
RocnRoll(price)Parameters
| Name | Type | Default | Description |
|---|---|---|---|
price | price source | close | The price series the signal is computed on, usually close, also open, high, or low. |
Formula
RocnRoll is a composite signal generator rather than a continuous oscillator. Internally it combines the rate of change of the price series with exponential moving averages to classify the current bar into one of three states. The exact periods and combination logic are fixed by the platform and not exposed as parameters. The output mapping is:
1 = bullish signal
2 = bearish signal
-1 = exit signalHow it works
Most momentum indicators return a value to interpret. RocnRoll instead returns a decision code, which makes it closer to a ready-made signal line than a raw measurement. On each bar the built-in logic evaluates momentum, via rate of change, against its exponential average context and emits one of the three states.
On a chart the indicator is conventionally displayed as a histogram, green bars for state 1, red bars for state 2 and blue bars for state -1. In code the states are consumed with plain equality tests, which keeps strategy logic short, at the cost of transparency, since the internal thresholds cannot be tuned.
A detail that matters when testing the states: the bearish signal is 2, not -1 or 0. The negative value is reserved for the exit state, so conditions like RocnRoll(close) < 0 match the exit signal only, not bearish bars.
Examples
Example 1, Signal histogram (Indicator)
// Compute the RocnRoll state for the closing price
myRocnRoll = RocnRoll(close)
// Display the raw state codes as a histogram
RETURN myRocnRoll STYLE(histogram) AS "RocnRoll signal"Applies RocnRoll to the closing price and draws the state codes as a histogram, bars at 1 for bullish, 2 for bearish and -1 for exit signals.
Example 2, Long-only system driven by state codes (ProOrder)
DEFPARAM CumulateOrders = false
s = RocnRoll(close)
// Enter on the bullish state
IF NOT LongOnMarket AND s = 1 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Close the position on the exit state or a bearish flip
IF LongOnMarket AND (s = -1 OR s = 2) THEN
SELL AT MARKET
ENDIFThe three states map directly to order logic, state 1 opens the long, state -1 or 2 closes it. No thresholds or crossings need to be defined.
Example 3, Screening for fresh bullish signals (ProScreener)
s = RocnRoll(close)
// State is bullish now and was not bullish on the previous bar
newSignal = s = 1 AND s[1] <> 1
SCREENER[newSignal](close AS "Last price")Lists instruments whose RocnRoll state switched to bullish on the current bar, filtering out those that have been in state 1 for many bars already.
Interpretation
| Value | Signal | Conventional display |
|---|---|---|
| 1 | Bullish, upward momentum conditions met | Green histogram |
| 2 | Bearish, downward momentum conditions met | Red histogram |
| -1 | Exit, leave the market | Blue histogram |
The indicator gives a categorical opinion, not a strength measure. Two consecutive bullish bars are not stronger than one, and there is no magnitude to compare across instruments. It is typically used as a trigger inside a larger framework, with trend filters and risk management supplied separately.
Common errors and gotchas
- Bearish is 2, not a negative number. Testing
RocnRoll(close) < 0catches only the exit state. Bearish bars must be tested with= 2explicitly. - No tunable parameters. The instruction accepts only the price source. Periods and internal thresholds are fixed, so the signal cannot be made faster or slower. Behaviour differences must come from the timeframe instead.
- Treating the state as a magnitude. Averaging or summing the codes, for example
Average[10](RocnRoll(close)), produces numbers that mix the 1, 2 and -1 labels into meaningless arithmetic. Compare with equality only. - Opaque logic. Because the internal formula is not exposed, backtest results cannot be decomposed into the underlying ROC and average conditions. Validating the signal on the target instrument and timeframe before live use is essential.
Related instructions
ROC, the rate-of-change oscillator underlying the signal.RSI, bounded momentum oscillator for manual signal construction.MACD, exponential-average momentum with crossing signals.ExponentialAverage, the smoothing component of the internal logic.Momentum, raw N-bar price difference.Stochastic, range-position oscillator with its own signal conventions.Supertrend, trend-state indicator, another categorical-style signal.SAR, stop and reverse points, an alternative entry and exit generator.
