0

我有一个用于识别星期几的 Tradingview Pinescript 脚本。我想添加识别月份名称的功能,这可能吗?

//@version=4

study(title = "Day of Week & Open - Intraday", shorttitle = "Day of Week", overlay=true)

// Get User input - which time label to show
showDOPEN       = input(true, title="Identify Daily Open - 5PM EST")
showDOW         = input(true, title="Identify Days of Week - Midnight EST")

BarInSession(sess) =>
    not na(time(timeframe.period, sess))
    
// 5PM EST. *Sun open identified which is also Mondays bar open
dayOpen =   time(timeframe.period,"1700-1659")
plotshape(showDOPEN ? hour == 17 and minute == 0 and dayofweek == dayofweek.sunday : false, title="Mon Open", text="MO", color=color.aqua, location=location.belowbar, style=shape.triangleup, textcolor=color.aqua, size=size.tiny, transp=10)
plotshape(showDOPEN ? hour == 17 and minute == 0 and dayofweek == dayofweek.monday : false, title="Tue Open", text="TO", color=color.aqua, location=location.belowbar, style=shape.triangleup, textcolor=color.aqua, size=size.tiny, transp=10)
plotshape(showDOPEN ? hour == 17 and minute == 0 and dayofweek == dayofweek.tuesday : false, title="Wed Open", text="WO", color=color.aqua, location=location.belowbar, style=shape.triangleup, textcolor=color.aqua, size=size.tiny, transp=10)
plotshape(showDOPEN ? hour == 17 and minute == 0 and dayofweek == dayofweek.wednesday : false, title="Thur Open", text="RO", color=color.aqua, location=location.belowbar, style=shape.triangleup, textcolor=color.aqua, size=size.tiny, transp=10)
plotshape(showDOPEN ? hour == 17 and minute == 0 and dayofweek == dayofweek.thursday : false, title="Fri Open", text="FO", color=color.aqua, location=location.belowbar, style=shape.triangleup, textcolor=color.aqua, size=size.tiny, transp=10)

// Midnight EST - Day of Week
plotshape(showDOW ? hour == 0 and minute == 0 and dayofweek == dayofweek.monday : false, title="Mon", text="M", color=color.green, style=shape.diamond, textcolor=color.green, size=size.tiny, transp=10)
plotshape(showDOW ? hour == 0 and minute == 0 and dayofweek == dayofweek.tuesday : false, title="Tue", text="T", color=color.green, style=shape.diamond, textcolor=color.green, size=size.tiny, transp=10)
plotshape(showDOW ? hour == 0 and minute == 0 and dayofweek == dayofweek.wednesday : false, title="Wed", text="W", color=color.green, style=shape.diamond, textcolor=color.green, size=size.tiny, transp=10)
plotshape(showDOW ? hour == 0 and minute == 0 and dayofweek == dayofweek.thursday : false, title="Thur", text="R", color=color.green, style=shape.diamond, textcolor=color.green, size=size.tiny, transp=10)
plotshape(showDOW ? hour == 0 and minute == 0 and dayofweek == dayofweek.friday : false, title="Fri", text="F", color=color.green, style=shape.diamond, textcolor=color.green, size=size.tiny, transp=10)

谢谢。

4

0 回答 0