当前位置:网站首页>Pine Script脚本常用内容

Pine Script脚本常用内容

2022-06-24 03:35:00 码肥人壮

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)

在这里插入图片描述

原网站

版权声明
本文为[码肥人壮]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_42887343/article/details/125384982