首页 > 解决方案 > previous quarter high and low in Pine script?

问题描述

Does anyone know what script I can use to plot the previous quarter (3 months) high and low on a daily chart in trading view? The script I use now for the previous week high and low is the following.

Regards,

Juros

Blockquote

//modified by Juros as by xKaVaLiS as modidified by zonedoutdad from the script by ChrisMoody
study(title="previous Week high & low", shorttitle="Prev Wk H-L", overlay=true, precision=8)
swt = input(true, title="Show This Weeks OHLC?")
showMonthly = input(false, title="Show Monthly Data (open/close)?")
highlightBG = input(false, title="Highlight Background Bias")
aboveBelowBarWeekIndicator = input(true, title="Turn on Above/Below Week Open Top Chart")

//Weekly

prevWeekHigh = security(tickerid, 'W', high[1], lookahead=true)
prevWeekLow = security(tickerid, 'W', low[1], lookahead=true)

//Weekly Plots
plot(swt and prevWeekHigh ? prevWeekHigh : na, title="Prev Week High", style=stepline, linewidth=1, color=green,transp=50)
plot(swt and prevWeekLow ? prevWeekLow : na, title="Prev Week Low", style=stepline, linewidth=1,  color=red,transp=50)

标签: pine-script

解决方案


推荐阅读