简体   繁体   English

松脚本:为当前蜡烛着色不同的颜色

[英]pine script : color the current candle different color

i wanna to color all candles , all down candles will be red ,, all up candle will be green and the current candle will be black (if not closed yet)我想给所有蜡烛上色,所有向下的蜡烛都是红色的,所有向上的蜡烛都是绿色的,当前的蜡烛是黑色的(如果还没有关闭)

this is for example这是例如

//@version=4
study("color all except current candle", overlay=true)

this_is_current_candle_function = ?????????????

redbar = close < open
greenbar = close > open

barcolor(not this_is_current_candle_function and redbar ? color.red:color.black)
barcolor(not this_is_current_candle_function and greenbar ? color.green:color.black)

you use barstate.isconfirmed function你使用barstate.isconfirmed函数

    //@version=5
    indicator("barcolor example", overlay=true)
    barcolor(barstate.isconfirmed ? na : color.black)

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

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