Monday 15:15 Monthly and Weekly Open Signals

bala89_ece · study · 51 行 · 点赞 4 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=6
indicator("Monday 15:15 Monthly and Weekly Open Signals", overlay = true)
 
if barstate.isfirst and (not timeframe.isminutes or timeframe.multiplier != 60)
    runtime.error("Use a standard 1-hour chart with regular trading hours.")
 
// Capture the first chart candle's open in each new month and week.
var float monthlyOpen = na
var float weeklyOpen = na
 
if timeframe.change("M")
    monthlyOpen := open
 
if timeframe.change("W")
    weeklyOpen := open
 
// `time` identifies the candle stamped 15:15 IST.
bool monday315Candle =
     dayofweek(time, "Asia/Kolkata") == dayofweek.monday and
     hour(time, "Asia/Kolkata") == 15 and
     minute(time, "Asia/Kolkata") == 15
 
bool ready = monday315Candle and
     not na(monthlyOpen) and not na(weeklyOpen)
 
bool buyPut = ready and monthlyOpen > weeklyOpen and weeklyOpen > open
bool buyCall = ready and monthlyOpen < weeklyOpen and weeklyOpen < open
bool noSetup = ready and not buyPut and not buyCall
 
plot(monthlyOpen, "Monthly Open", color = color.blue,
     linewidth = 2, style = plot.style_stepline)
plot(weeklyOpen, "Weekly Open", color = color.orange,
     linewidth = 2, style = plot.style_stepline)
 
plotshape(buyPut, title = "Buy Put", text = "BUY PUT\n15:15",
     style = shape.labeldown, location = location.abovebar,
     color = color.red, textcolor = color.white)
 
plotshape(buyCall, title = "Buy Call", text = "BUY CALL\n15:15",
     style = shape.labelup, location = location.belowbar,
     color = color.green, textcolor = color.white)
 
plotshape(noSetup, title = "No Setup", text = "NO SETUP\n15:15",
     style = shape.labeldown, location = location.abovebar,
     color = color.gray, textcolor = color.white)
 
alertcondition(buyPut, title = "Buy Put",
     message = "BUY PUT condition on {{ticker}}: Monthly open > Weekly open > Monday 15:15 candle open.")
 
alertcondition(buyCall, title = "Buy Call",
     message = "BUY CALL condition on {{ticker}}: Monthly open < Weekly open < Monday 15:15 candle open.")

← 返回列表