What are Camarilla Pivots?
Camarilla Pivots are a unique set of intraday support and resistance levels that are typically used by short-term traders to identify potential reversal points or breakout opportunities. Unlike Classic Pivot Points, which are designed to project relatively wide ranges, Camarilla Pivots emphasize price action near the previous day's close. This results in tighter support and resistance levels that are particularly effective in capturing mean-reverting price action, where price tends to return to a central point.
Developed by Nick Stott, Camarilla Pivots are calculated using the previous day's (or chosen period's) High, Low, and Closing prices. They consist of four resistance levels (H1, H2, H3, H4) and four support levels (L1, L2, L3, L4), along with a central Pivot Point (PP), though the PP is less emphasized than the H3/L3 levels.
Traders primarily use Camarilla Pivots for:
- Mean Reversion (Reversals): Price often bounces off L3 (for buying) or H3 (for selling), aiming for a return to the previous day's close or H1/L1.
- Breakout Trading: A decisive break above H4 or below L4 can signal a strong continuation or trending day.
- Setting Entry/Exit Points: Providing clear reference points for order placement.
In Pine Script, Camarilla Pivots are a powerful tool for short-term trading strategies, providing precise levels based on the previous period's volatility and closing dynamics.
Components and Calculation (Camarilla Pivots)
Camarilla Pivots are calculated using the previous period's High, Low, and Close prices. The formulas place more weight on the previous day's close, resulting in levels that are closer to the closing price. The pivot range is primarily derived from the previous day's range `(High - Low)`.
Let `H`, `L`, `C` be the previous period's High, Low, and Close. Let `Range = H - L`.
- Pivot Point (PP):
`PP = (H + L + C) / 3` (Same as Classic Pivot Point, but less focused) - Resistance Levels (H1 to H4):
`H1 = C + (Range * 1.1 / 12)`
`H2 = C + (Range * 1.1 / 6)`
`H3 = C + (Range * 1.1 / 4)`
`H4 = C + (Range * 1.1 / 2)` - Support Levels (L1 to L4):
`L1 = C - (Range * 1.1 / 12)`
`L2 = C - (Range * 1.1 / 6)`
`L3 = C - (Range * 1.1 / 4)`
`L4 = C - (Range * 1.1 / 2)`
These levels remain constant throughout the current trading day and are recalculated at the start of the next trading day (or chosen period, e.g., week, month).
Basic Camarilla Pivots Implementation in Pine Script
Pine Script v5 provides a built-in function `ta.pivotpoints()` that can calculate various pivot types, including "Camarilla". This simplifies the implementation significantly.
//@version=5
indicator("My Camarilla Pivots", overlay=true, max_bars_back=500) // overlay=true to plot on price chart.
// Input for the Pivot Point calculation timeframe
// Camarilla pivots are predominantly used for intraday trading, so "D" (Daily) is most common.
pivotTimeframe = input.string("D", title="Pivot Timeframe", options=["D", "W", "M"])
// Get the Pivot Points values using ta.pivotpoints() with "Camarilla" type
// This function returns a tuple: [pp, r1, r2, r3, s1, s2, s3]
// Note: For Camarilla, these usually map to H1-H4 and L1-L4 for Pine Script's built-in.
// Specifically, for Camarilla, the ta.pivotpoints function typically returns:
// pp (Pivot Point)
// r1 (H1), r2 (H2), r3 (H3), r4 (H4 - not directly in the 3 R/S outputs, but calculated)
// s1 (L1), s2 (L2), s3 (L3), s4 (L4 - not directly in the 3 R/S outputs, but calculated)
// Let's manually get H1-H4 and L1-L4 since ta.pivotpoints only gives R1-R3 and S1-S3.
// We'll calculate them based on the previous bar's HLC.
// We need to fetch previous day's HLC.
prevHigh = request.security(syminfo.tickerid, pivotTimeframe, high[1], lookahead=barmerge.lookahead_on)
prevLow = request.security(syminfo.tickerid, pivotTimeframe, low[1], lookahead=barmerge.lookahead_on)
prevClose = request.security(syminfo.tickerid, pivotTimeframe, close[1], lookahead=barmerge.lookahead_on)
// Ensure we have valid previous day data
if not na(prevHigh) and not na(prevLow) and not na(prevClose)
range = prevHigh - prevLow
// Calculate Camarilla Levels
cam_h4 = (prevClose + range * 1.1 / 2)
cam_h3 = (prevClose + range * 1.1 / 4)
cam_h2 = (prevClose + range * 1.1 / 6)
cam_h1 = (prevClose + range * 1.1 / 12)
cam_l1 = (prevClose - range * 1.1 / 12)
cam_l2 = (prevClose - range * 1.1 / 6)
cam_l3 = (prevClose - range * 1.1 / 4)
cam_l4 = (prevClose - range * 1.1 / 2)
// Plotting the Camarilla Levels
plot(cam_h4, title="H4", color=color.new(color.red, 0), linewidth=2, style=plot.style_stepline)
plot(cam_h3, title="H3", color=color.new(color.red, 0), linewidth=1, style=plot.style_stepline)
plot(cam_h2, title="H2", color=color.new(color.orange, 0), linewidth=1, style=plot.style_stepline)
plot(cam_h1, title="H1", color=color.new(color.orange, 0), linewidth=1, style=plot.style_stepline)
plot(cam_l1, title="L1", color=color.new(color.lime, 0), linewidth=1, style=plot.style_stepline)
plot(cam_l2, title="L2", color=color.new(color.lime, 0), linewidth=1, style=plot.style_stepline)
plot(cam_l3, title="L3", color=color.new(color.green, 0), linewidth=1, style=plot.style_stepline)
plot(cam_l4, title="L4", color=color.new(color.green, 0), linewidth=2, style=plot.style_stepline)
// Optional: Add labels to the pivot lines for clarity (only on the first bar of a new period)
var label h4_label = na
var label h3_label = na
var label h2_label = na
var label h1_label = na
var label l1_label = na
var label l2_label = na
var label l3_label = na
var label l4_label = na
// Check if it's the first bar of the new period (e.g., new day)
isNewPeriod = ta.change(time(pivotTimeframe))
if isNewPeriod
label.delete(h4_label)
label.delete(h3_label)
label.delete(h2_label)
label.delete(h1_label)
label.delete(l1_label)
label.delete(l2_label)
label.delete(l3_label)
label.delete(l4_label)
h4_label := label.new(bar_index, cam_h4, text="H4", style=label.style_label_left, color=color.new(color.red, 70), textcolor=color.white)
h3_label := label.new(bar_index, cam_h3, text="H3", style=label.style_label_left, color=color.new(color.red, 70), textcolor=color.white)
h2_label := label.new(bar_index, cam_h2, text="H2", style=label.style_label_left, color=color.new(color.orange, 70), textcolor=color.white)
h1_label := label.new(bar_index, cam_h1, text="H1", style=label.style_label_left, color=color.new(color.orange, 70), textcolor=color.white)
l1_label := label.new(bar_index, cam_l1, text="L1", style=label.style_label_left, color=color.new(color.lime, 70), textcolor=color.white)
l2_label := label.new(bar_index, cam_l2, text="L2", style=label.style_label_left, color=color.new(color.lime, 70), textcolor=color.white)
l3_label := label.new(bar_index, cam_l3, text="L3", style=label.style_label_left, color=color.new(color.green, 70), textcolor=color.white)
l4_label := label.new(bar_index, cam_l4, text="L4", style=label.style_label_left, color=color.new(color.green, 70), textcolor=color.white)
// Extend labels horizontally
label.set_x(h4_label, bar_index)
label.set_x(h3_label, bar_index)
label.set_x(h2_label, bar_index)
label.set_x(h1_label, bar_index)
label.set_x(l1_label, bar_index)
label.set_x(l2_label, bar_index)
label.set_x(l3_label, bar_index)
label.set_x(l4_label, bar_index)
Practical Camarilla Pivots Trading Strategies
1. Mean Reversion / Reversal Trading (L3 & H3)
This is the most popular strategy with Camarilla Pivots. Traders look for price to test and then reverse from the L3 and H3 levels, aiming for a return to the previous day's close or the H1/L1 levels.
- Buy Signal (Reversal): Price declines and touches or briefly penetrates L3, then shows signs of reversal (e.g., bullish candlestick, strong bounce, or closes back above L3). Entry around L3, with targets at L2, L1, or even the previous day's close. Stop loss just below L4.
- Sell Signal (Reversal): Price rallies and touches or briefly penetrates H3, then shows signs of reversal (e.g., bearish candlestick, strong rejection, or closes back below H3). Entry around H3, with targets at H2, H1, or the previous day's close. Stop loss just above H4.
//@version=5
strategy("Camarilla Reversal Strategy", overlay=true)
pivotTimeframe = input.string("D", title="Pivot Timeframe", options=["D", "W", "M"])
// Request previous day's data
prevHigh = request.security(syminfo.tickerid, pivotTimeframe, high[1], lookahead=barmerge.lookahead_on)
prevLow = request.security(syminfo.tickerid, pivotTimeframe, low[1], lookahead=barmerge.lookahead_on)
prevClose = request.security(syminfo.tickerid, pivotTimeframe, close[1], lookahead=barmerge.lookahead_on)
// Calculate Camarilla Levels
var float cam_h3 = na
var float cam_l3 = na
var float cam_h1 = na
var float cam_l1 = na
var float cam_h4 = na // For stop loss
var float cam_l4 = na // For stop loss
if not na(prevHigh) and not na(prevLow) and not na(prevClose)
range = prevHigh - prevLow
cam_h3 := (prevClose + range * 1.1 / 4)
cam_l3 := (prevClose - range * 1.1 / 4)
cam_h1 := (prevClose + range * 1.1 / 12)
cam_l1 := (prevClose - range * 1.1 / 12)
cam_h4 := (prevClose + range * 1.1 / 2) // For stop loss
cam_l4 := (prevClose - range * 1.1 / 2) // For stop loss
// Plotting (simplified for strategy example)
plot(cam_h3, title="H3", color=color.new(color.red, 0), linewidth=1, style=plot.style_stepline)
plot(cam_l3, title="L3", color=color.new(color.green, 0), linewidth=1, style=plot.style_stepline)
// Long Entry: Price crosses below L3 and immediately closes back above L3.
longCondition = close > cam_l3 and close[1] <= cam_l3[1]
// Short Entry: Price crosses above H3 and immediately closes back below H3.
shortCondition = close < cam_h3 and close[1] >= cam_h3[1]
// Only trigger if a new pivot period has started and levels are available
isNewPeriod = ta.change(time(pivotTimeframe)) // This helps avoid recalculation issues
if longCondition and not isNewPeriod and not na(cam_l4) and not na(cam_l1)
strategy.entry("Long L3 Reversal", strategy.long)
if shortCondition and not isNewPeriod and not na(cam_h4) and not na(cam_h1)
strategy.entry("Short H3 Reversal", strategy.short)
// Exit logic for reversals
// Target: L1 for short, H1 for long
// Stop Loss: L4 for long, H4 for short
strategy.exit("Long L3 Reversal Exit", from_entry="Long L3 Reversal", profit=cam_h1, stop=cam_l4)
strategy.exit("Short H3 Reversal Exit", from_entry="Short H3 Reversal", profit=cam_l1, stop=cam_h4)
2. Breakout Trading (H4 & L4)
While often used for mean reversion, Camarilla Pivots also offer robust levels for breakout trading. A decisive break beyond H4 or L4 indicates strong momentum and a potential trending day.
- Buy Signal (Breakout): Price decisively breaks and holds above H4, often with high volume. This suggests a strong continuation of the uptrend. Target profit levels are often set at fixed risk-reward ratios or by using Fibonacci extensions.
- Sell Signal (Breakout): Price decisively breaks and holds below L4, often with high volume. This suggests a strong continuation of the downtrend.
//@version=5
strategy("Camarilla Breakout Strategy", overlay=true)
pivotTimeframe = input.string("D", title="Pivot Timeframe", options=["D", "W", "M"])
// Request previous day's data
prevHigh = request.security(syminfo.tickerid, pivotTimeframe, high[1], lookahead=barmerge.lookahead_on)
prevLow = request.security(syminfo.tickerid, pivotTimeframe, low[1], lookahead=barmerge.lookahead_on)
prevClose = request.security(syminfo.tickerid, pivotTimeframe, close[1], lookahead=barmerge.lookahead_on)
// Calculate Camarilla Levels
var float cam_h4 = na
var float cam_l4 = na
if not na(prevHigh) and not na(prevLow) and not na(prevClose)
range = prevHigh - prevLow
cam_h4 := (prevClose + range * 1.1 / 2)
cam_l4 := (prevClose - range * 1.1 / 2)
// Plotting (simplified for strategy example)
plot(cam_h4, title="H4", color=color.new(color.red, 0), linewidth=2, style=plot.style_stepline)
plot(cam_l4, title="L4", color=color.new(color.green, 0), linewidth=2, style=plot.style_stepline)
// Breakout logic: Price closes decisively above H4 or below L4
longBreakoutCondition = close > cam_h4 and close[1] <= cam_h4[1] // Ensure it's a fresh break
shortBreakoutCondition = close < cam_l4 and close[1] >= cam_l4[1] // Ensure it's a fresh break
// Optional: Add volume confirmation for breakouts
volumeFactor = input.float(1.5, title="Volume Confirmation Factor", minval=1.0, step=0.1)
avgVolume = ta.sma(volume, 20) // Simple average volume for comparison
isHighVolume = volume > avgVolume * volumeFactor
if (longBreakoutCondition and isHighVolume)
strategy.entry("Long H4 Breakout", strategy.long)
if (shortBreakoutCondition and isHighVolume)
strategy.entry("Short L4 Breakout", strategy.short)
// Exit: Fixed profit/loss or target a fixed number of ATRs
// (Using ATR for dynamic targets/stops since further Camarilla levels are not standard beyond H4/L4)
atrLength = input.int(14, title="ATR Length for Exits", minval=1)
atrValue = ta.atr(atrLength)
// Profit target: e.g., 1.5 * ATR from entry
// Stop loss: e.g., 1.0 * ATR from entry
profitMultiplier = input.float(2.0, title="Profit Target (ATR)", minval=0.5, step=0.1)
stopLossMultiplier = input.float(1.0, title="Stop Loss (ATR)", minval=0.1, step=0.1)
strategy.exit("Long H4 Breakout Exit", from_entry="Long H4 Breakout",
profit=strategy.position_avg_price + atrValue * profitMultiplier,
stop=strategy.position_avg_price - atrValue * stopLossMultiplier)
strategy.exit("Short L4 Breakout Exit", from_entry="Short L4 Breakout",
profit=strategy.position_avg_price - atrValue * profitMultiplier,
stop=strategy.position_avg_price + atrValue * stopLossMultiplier)
3. Range Trading (Between H1 & L1, or H2 & L2)
The inner Camarilla levels (H1, H2, L1, L2) often define a normal trading range. Price tends to fluctuate within these levels on non-trending days.
- Sideways Market Indication: If price is trading consistently between L1 and H1 (or L2 and H2), it indicates a consolidation or low-volatility day.
- Strategy: Traders might look for very short-term scalping opportunities within these ranges, buying near L1/L2 and selling near H1/H2, or simply avoid trading altogether until a clear break occurs.
//@version=5
indicator("Camarilla Range Detector", overlay=true)
pivotTimeframe = input.string("D", title="Pivot Timeframe", options=["D", "W", "M"])
// Request previous day's data
prevHigh = request.security(syminfo.tickerid, pivotTimeframe, high[1], lookahead=barmerge.lookahead_on)
prevLow = request.security(syminfo.tickerid, pivotTimeframe, low[1], lookahead=barmerge.lookahead_on)
prevClose = request.security(syminfo.tickerid, pivotTimeframe, close[1], lookahead=barmerge.lookahead_on)
// Calculate Camarilla Levels (H1, L1)
var float cam_h1 = na
var float cam_l1 = na
if not na(prevHigh) and not na(prevLow) and not na(prevClose)
range = prevHigh - prevLow
cam_h1 := (prevClose + range * 1.1 / 12)
cam_l1 := (prevClose - range * 1.1 / 12)
// Plotting (simplified for detector)
plot(cam_h1, title="H1", color=color.new(color.orange, 0), linewidth=1, style=plot.style_stepline)
plot(cam_l1, title="L1", color=color.new(color.lime, 0), linewidth=1, style=plot.style_stepline)
// Determine if price is trading within the H1-L1 range
isTradingInRange = close < cam_h1 and close > cam_l1 and
open > cam_l1 and open < cam_h1 // Ensure open was also within range for confirmation
// Color background to easily visualize range-bound periods
bgcolor(isTradingInRange ? color.new(color.yellow, 95) : na, title="Range-Bound Zone")
// Alert if price enters or exits the range
alertcondition(ta.crossover(close, cam_h1) or ta.crossunder(close, cam_l1),
"Price Exiting Camarilla Range", "Price is breaking out of the H1-L1 Camarilla range.")
alertcondition(isTradingInRange[1] == false and isTradingInRange,
"Price Entering Camarilla Range", "Price is entering the H1-L1 Camarilla range.")
Optimizing Camarilla Pivots Performance
To get the most from Camarilla Pivots in Pine Script:
- Timeframe Selection: Camarilla Pivots are designed for intraday trading. Using them on daily or weekly charts might provide less relevant signals as their calculation emphasizes short-term volatility. Ensure your chart timeframe is lower (e.g., 5-min, 15-min, 1-hour) than the pivot calculation timeframe (typically "D").
- Confirmation is Key: Never rely solely on Camarilla Pivots. Combine them with other indicators (e.g., volume, momentum oscillators like RSI, MACD, or candlestick patterns) to confirm reversals or breakouts.
- Open Interest (for Futures): For futures markets, observe open interest. A breakout above H4/below L4 on increasing open interest would be a stronger signal.
- Volatility Context: Camarilla pivots work well in normal to moderately volatile markets. In extremely high-volatility markets, price might blow through all levels quickly. In very low-volatility markets, ranges might be too tight to be actionable.
- Trade Entry/Exit Zones: Don't expect exact bounces. Think of Camarilla levels as zones where price action is likely to react. Look for price to consolidate around these levels or form clear reversal/continuation patterns.
Common Camarilla Pivots Pitfalls
- Timeframe Misuse: Using Camarilla Pivots on daily or higher timeframes, or trying to trade them on very low liquidity assets, will likely yield poor results.
- False Signals/Whipsaws: In very choppy markets or during strong news events, price can repeatedly cross Camarilla levels, leading to whipsaws and false signals.
- Over-Reliance: Using Camarilla Pivots as the sole decision-making tool without additional confirmation can lead to significant losses.
- Gap Risk: Large overnight gaps can make the previous day's Camarilla levels less relevant for the current day's trading, especially if the gap opens far beyond H4 or L4.
- Limited Beyond H4/L4: There are no standard levels beyond H4 and L4. Once price breaks these, it's considered to be in a strong trend, and other tools (e.g., trend lines, dynamic moving averages) might be more appropriate for targets.
Conclusion
Camarilla Pivots are a powerful and widely utilized set of intraday support and resistance levels in Pine Script for TradingView. By emphasizing price action near the previous period's close, they offer precise levels for identifying potential mean reversion (reversal) opportunities around H3/L3 and breakout opportunities beyond H4/L4. While primarily suited for short-term and intraday trading, their effectiveness is significantly enhanced when combined with other confirming indicators, such as candlestick patterns, volume, or momentum oscillators. By understanding their calculation, applying them to appropriate timeframes, and integrating them strategically into your pine script strategies, you can leverage Camarilla Pivots to improve your entry/exit timing and manage risk in dynamic markets.
Enhance Your Trading
Get a high-performance Pine Script analysis tool for actionable market insights, designed for traders on the move.
This strategy runs in live mode on TradingView, helping you identify potential opportunities.
Subscribe now @ $99/month