其实更换K线颜色就是重构了了下K线而已,看到有币友有这块需求,随手改了个主图指标,专门用于修改K线颜色。重构K线有两种思路,一种是使用系统内置的绘制蜡烛图drawCandle函数,一种是自己画
使用系统内置的函数drawCandle
- drawCandleIf(close>open, open, high, low, close, color="#D11E11");
- drawCandleIf(close<open, open, high, low, close, color="#F5F5F5");
复制代码
不使用系统内置的函数
- drawHistogramBetweenIf(close>open, open, close, color="#D11E11", showpricevalue=true, showtitle=true);
- drawStickBetweenIf(close>open, high, low, color="#D11E11", linewidth=1, showpricevalue=true, showtitle=true);
- drawHistogramBetweenIf(close<open, open, close, color="#F5F5F5", showpricevalue=true, showtitle=true);
- drawStickBetweenIf(close<open, high, low, color="#F5F5F5", linewidth=1, showpricevalue=true, showtitle=true);
复制代码
|