OPEN-SOURCE SCRIPT

Camarilla Screener

//version=5
indicator("Camarilla Screener", overlay=false)

// Input for timeframe (Yearly or Monthly)
timeframe = input.timeframe("1M", "Timeframe for Analysis")

// Fetch high, low, and close of the selected timeframe
high_tf = request.security(syminfo.tickerid, timeframe, high)
low_tf = request.security(syminfo.tickerid, timeframe, low)
close_tf = request.security(syminfo.tickerid, timeframe, close)

// Calculate Camarilla levels
range_hl = high_tf - low_tf
S3 = close_tf - (range_hl * 1.1 / 4)
S4 = close_tf - (range_hl * 1.1 / 2)
S5 = close_tf - (range_hl * 1.1)

// Current month candle details
open_current = request.security(syminfo.tickerid, "1M", open)
close_current = request.security(syminfo.tickerid, "1M", close)
low_current = request.security(syminfo.tickerid, "1M", low)
high_current = request.security(syminfo.tickerid, "1M", high)

// Conditions
low_sweep = low_current < low_tf // Monthly low sweeps previous month's low
bullish_close = close_current > open_current // Bullish close
doji_condition = math.abs(close_current - open_current) < (0.005 * close_current) // Doji condition
cross_camarilla = high_current > S3 or high_current > S4 or high_current > S5 // Camarilla levels breached

// Combine all conditions
condition_met = low_sweep and bullish_close and doji_condition and cross_camarilla

// Plot signals
plotshape(condition_met, title="Signal", location=location.top, color=color.green, style=shape.labelup, text="Camarilla Setup")

// Display levels for reference
plot(S3, color=color.red, title="S3")
plot(S4, color=color.orange, title="S4")
plot(S5, color=color.yellow, title="S5")
educational

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer