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

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明