Pine Script-第一栏的背景色

时间:2020-01-03 14:53:40

标签: pine-script

在“交易视图Pine脚本”中, 如何将当天的前30分钟酒吧颜色的背景色设置为黑褐色

2 个答案:

答案 0 :(得分:0)

//@version=4
study("")
bgcolor(change(dayofweek) ? color.black : na)

答案 1 :(得分:0)

//@version=4
study(title="30 minute bg ranges color", overlay=true)

// Create the inputs
Session_time = input(title="Enter your country's starting time session",type=input.session,defval="0800-0830")


transparency = input(title="Transparency", type=input.integer,defval=50, minval=0, maxval=100)

// The BarInSession function returns true when
// the current bar is inside the session parameter
BarInSession(sess) => time(period, sess) != 0

// Set the colour variables for the ranges
tm_Colour =color.black // Cornflower blue

// Determine the chart's background colour
chartColour = BarInSession(Session_time ) ? tm_Colour : na

// Set the background colour
bgcolor(color=chartColour, transp=transparency)

以上代码适用于所有时间段,您需要在代码中输入会话时间,也可以根据您所在国家/地区的30分钟开始时间在用户界面输入中输入时间。