根据值绘制不同颜色的图表

时间:2020-03-17 16:59:04

标签: pine-script

我试图将RSI显示为柱形图,并根据RSI值显示每列的颜色。

我有以下代码:

  return new Promise(function (resolve, reject) {
    axios
        .get(imgSrcURl, {
                responseType: 'arraybuffer'
            })
        .then(response => {
            var data_url = Buffer.from(response.data, 'binary').toString('base64');
            data_url = "data:application/octet-stream;base64," + data_url;
            fabric.Image.fromURL(
                data_url,
                img => {
                    resolve(img);
                });
        });
});

我在编译时收到以下消息:“外部输入')'期望为':'。”

我的错误在哪里? 非常感谢你的帮助!这让我发疯了!

1 个答案:

答案 0 :(得分:0)

//@version=4
///Plot colors
study("Plot colors")
DarkGreen = #26A69A
LightGreen = #B2DFDB
DarkRed = #EF5350
LightRed = #FFCDD2
DarkGrey = #BBBBBB
LightGrey = #D7D7D7
RSI = rsi(close, 14)
c = color(na)
if RSI<=30
    c:=DarkGreen
if RSI>30 and RSI<43
    c:=LightGreen
if RSI>=43 and RSI<50
    c:=LightGrey
if RSI>=50 and RSI<65
    c:=DarkGrey
if RSI>=65 and RSI<70
    c:=LightRed
if RSI>=70
    c:=DarkRed
plot(RSI, title="FMG Comp", style= plot.style_columns, color=c, transp=0 )