简体   繁体   English

Pine Script - Tradingview 绘制每日矩形

[英]Pine Script - Tradingview Draw a daily rectangle

I'm working on a TradingView script (Pine) and I would to develop a simply script that draw a rectangle from a start of current day to the end based on my current timeframe from Monday To Friday...我正在开发一个 TradingView 脚本(Pine),我想开发一个简单的脚本,根据我从周一到周五的当前时间范围从当天开始到结束绘制一个矩形......

Example: First rectangle drawed from 24/03/2021 to 25/03/2021, Second Rectangle drawed from 25/03/2021 to 26/03/2021, etc...示例:从 24/03/2021 到 25/03/2021 绘制的第一个矩形,从 25/03/2021 到 26/03/2021 绘制的第二个矩形,等等...

Any solutions to achieve this result?有什么解决方案可以达到这个结果?

Thank's in advance提前致谢

I think I have understood your request.我想我已经理解了你的要求。 The below should help assist you以下内容应该可以帮助您

在此处输入图像描述

//@version=4
study("Daily Box", overlay=true)

Bottom = input(title="Bottom", type=input.session, defval="0000-2359:1234567")

colourcheck = 1.0
boxheight = input(title="Box Height", type=input.float, defval=3)

DailyHigh = security(syminfo.tickerid, "D", high, lookahead=true)
DailyLow = security(syminfo.tickerid, "D", low, lookahead=true)

dayrange = DailyHigh - DailyLow

BottomLowBox = DailyLow + (dayrange * 0.01 * boxheight)
TopLowBox = DailyHigh - (dayrange * 0.01 * boxheight)

BarInSession(sess) => time(timeframe.period, sess) != 0

//ASIA
BottomL = plot(DailyLow and BarInSession(Bottom) ? DailyLow : na, title="Bottom High", style=plot.style_linebr, linewidth=3, color=na)
TopL = plot(DailyHigh and BarInSession(Bottom) ? DailyHigh : na, title="Bottom Low", style=plot.style_linebr, linewidth=3, color=na)
fill(BottomL, TopL, color=color.purple, title="Fill Box", transp=50)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM