Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
381 views
in Technique[技术] by (71.8m points)

Pine Script : number of bars in a series returned by the security function?

To get the number of bars for the current ticker and timeframe (resolution) you use the built-in bar_index (pinescript version 4) or n but how do you get the number of bars when using the security function to retrieve a series?

question from:https://stackoverflow.com/questions/65870573/pine-script-number-of-bars-in-a-series-returned-by-the-security-function

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
//@version=4
study("My Script", overlay=true)

bar_index_weekly = security(syminfo.tickerid, "W", bar_index)

plot(bar_index_weekly, "bar_index_weekly")
plot(bar_index, "bar_index_current_timeframe")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...