首页 > 解决方案 > Is it possible to retrieve the current bar's color?

问题描述

I'd like a quick way to determine if the current bar is bullish or bearish. I can only find the barColor() function which sets the bar color; I'd like to read it.

标签: pine-script

解决方案


您的脚本无法查看条形的实际颜色,但它知道价格信息,因此可以使用如下布尔表达式导出蜡烛的状态:

upBar = close > open

推荐阅读