简体   繁体   中英

Pine-Script: Select one bar [only] from a known range

I want to highlight which bar has a bigger close within a range. The range would be all bars that are above a SMA line.

It's a bit difficult to explan and the following image explains what I want to achieve:

在此处输入图片说明

I have manually highlighted (in "yellow") the start end of the range, which is where the SMA cross up and down ocurred. From within that range, I would like to highly the bar with a bigger close (in the image the one with the "blue" arrow)

Is that possible to be done in Pine? Because I can know if the current bar is the higher one from the start of the range and I can display an "arrow" on that bar, but later a new bar will appear with higher close so I will put another "arrow", having several arrows within the specific range.

Thanks!

You need to define a label once, and then move it with label.set_x() when a higher close occurs.
Example: How to change a label's price coordinate in TradingView Pine Script?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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