1、设置指标名字
study("我的指标") //指标名字
2、画线
plot(close, color=osc_color, style=line, linewidth=2)
四个参数,依次为数据、颜色、类型、线宽,好想还有其他不常用参数,除了数据参数,其他都可以省略。
其中style类型有如下几种:
- line:曲线
- histogram:直方图
- 其他的还需要摸索
官方解释:
style (plot_style) Type of plot. Possible values are: plot.style_line, plot.style_stepline, plot.style_stepline_diamond, plot.style_histogram, plot.style_cross, plot.style_area, plot.style_columns, plot.style_circles, plot.style_linebr, plot.style_areabr. Default value is plot.style_line.
3、画线之间的填充
p1 = plot(open)
p2 = plot(close)
fill(p1, p2, color=color.new(color.green, 90))
还有很多内容,后续持续更新。。。
3、参数输入
一般来说,我们不需要定义变量,直接使用就行了,如下面代码左边。可是变量总有个输入来源,那就是参数设置,使用input函数。
length = input.int(9, minval=1)
length2 = input.int(2, minval=1)
length3 = input.int(3, minval=1)