FMZ PINE Script documentation is provided.

Author: Inventors quantify - small dreams, Created: 2022-05-06 14:27:06, Updated: 2024-10-12 15:27:04

The column values. - What?length(series int) K number of lines (length). - What?mult(simple int/float) standard deviation

See you later


### ta.bbw

布林带的宽度。布林带宽度是上轨和下轨到中线的距离。

ta.bbw(series, length, mult)


**例子**
```pine
plot(ta.bbw(close, 5, 4), color=color.yellow)

// the same on pine
f_bbw(src, length, mult) =>
    float basis = ta.sma(src, length)
    float dev = mult * ta.stdev(src, length)
    ((basis + dev) - (basis - dev)) / basis

plot(f_bbw(close, 5, 4))

Returns the valueThe bandwidth of Brin.

Parameters - series(series int/float) The series value to be executed. - What?length(series int) K number of lines (length). - What?mult(simple int/float) standard deviation

See you later


### ta.cci

CCI(商品路径指数)的计算方法是商品的典型价格与其简单移动平均线之间的差值除以典型价格的平均绝对偏差。该指数按0.015的倒数进行缩放,以提供更多可读的数字。

ta.cci(source, length)


**返回值**
lengthK线返回的source的商品渠道指数。

**参数**
- ```source``` (series int/float) 待执行的系列值。
- ```length``` (series int) K线数量(长度).

### ta.change

当前值与前一个值之间的差分,source - source[length]。

ta.change(source, length)


ta.change(source)


**返回值**
减法的结果。

**参数**
- ```source``` (series int/float) 源系列。
- ```length``` (series int) 从当前k线偏移到上一个k线。 可选,如未给予,则使用length = 1。

**另见**
```ta.mom``` ```ta.cross```

### ta.mom

`source`价格和`source`价格`length`K线之前的动量。这只是一个差分:source - source[length]。

ta.mom(source, length)


**返回值**
`source`价格和`source`价格`length`K线之前的动量。

**参数**
- ```source``` (series int/float) 待执行的系列值。
- ```length``` (series int) 从当前k线偏移到上一个k线。

**另见**
```ta.change```

### ta.cmo

钱德动量摆动指标。计算最近的上涨点数之和与最近的下跌点数之和,然后将两者相减,然后将结果除以同一时期内所有价格变动的总和

ta.cmo(series, length)


**例子**
```pine
plot(ta.cmo(close, 5), color=color.yellow)

// the same on pine
f_cmo(src, length) =>
    float mom = ta.change(src)
    float sm1 = math.sum((mom >= 0) ? mom : 0.0, length)
    float sm2 = math.sum((mom >= 0) ? 0.0 : -mom, length)
    100 * (sm1 - sm2) / (sm1 + sm2)

plot(f_cmo(close, 5))

Returns the valueThe dynamic oscillation indicator in Chad

Parameters - series(series int/float) The series value to be executed. - What?length(series int) K number of lines (length).

See you later


### ta.percentile_linear_interpolation

使用最近的两个排名之间的线性插值方法计算百分比。

ta.percentile_linear_interpolation(source, length, percentage)


**返回值**
`length`K线返回的`source`系列的第P个百分位数。

**参数**
- ```source``` (series int/float) 待执行的系列值(来源)。
- ```length``` (series int) 过去的K线数量(长度)
- ```percentage``` (simple int/float) 百分比,从0到100的范围内的数字

**备注**
请注意,使用此方法计算的百分比并非都是输入数据集一员。

**另见**
```ta.percentile_nearest_rank```

### ta.percentile_nearest_rank

根据最近的排名方法计算百分比。

ta.percentile_nearest_rank(source, length, percentage)


**返回值**
`length`K线返回的`source`系列的第P个百分位数。

**参数**
- ```source``` (series int/float) 待执行的系列值(来源)。
- ```length``` (series int) 过去的K线数量(长度)
- ```percentage``` (simple int/float) 百分比,从0到100的范围内的数字

**备注**
使用少于过去100 k线长度的最近排名法可导致相同的数字用于多个百分位数。
最近排名法计算的百分比都是输入数据集一员。
第100个百分点被定义为输入数据集中的最大值。

**另见**
```ta.percentile_linear_interpolation```

### ta.percentrank

百分比等级是以前的值小于或等于给定系列当前值的百分比。

ta.percentrank(source, length)


**返回值**
`length`K线返回的`source`百分比排名。

**参数**
- ```source``` (series int/float) 待执行的系列值。
- ```length``` (series int) K线数量(长度).

### ta.variance

方差是一系列与其均值的平方偏差的期望值 (ta.sma),它非正式地衡量一组数字与其均值的距离。

ta.variance(source, length, biased)


**返回值**
`length` K线返回的`source`的方差。

**参数**
- ```source``` (series int/float) 待执行的系列值。
- ```length``` (series int) K线数量(长度).
- ```biased``` (series bool) 确定应该使用哪个估计。可选。默认值为true。

**备注**
如果`biased`为true,函数将使用对整个总体的有偏估计进行计算,如果为false - 对样本的无偏估计。

**另见**
```ta.dev``` ```ta.stdev```

### ta.tr

ta.tr(handle_na)


**返回值**
真实范围。它是math.max(high - low, math.abs(high - close[1]), math.abs(low - close[1]))。

**参数**
- ```handle_na``` (simple bool) 如何处理 NaN 值。 如果为 true,并且前一天的收盘价为 NaN,则 tr 将被计算为当天的高-低点。否则(如果为false) tr 在这种情况下将返回 NaN。另请注意,ta.atr 使用 ta.tr(true)。

**备注**
```ta.tr(false)```与```ta.tr```完全相同。

**另见**
```ta.atr```

### ta.mfi

资金流量指标。资金流量指标是一种技术指标,它使用价格和成交量来确定资产中的超买或超卖状况。

ta.mfi(series, length)


**例子**
```pine
plot(ta.mfi(hlc3, 14), color=color.yellow)

// the same on pine
pine_mfi(src, length) =>
    float upper = math.sum(volume * (ta.change(src) <= 0.0 ? 0.0 : src), length)
    float lower = math.sum(volume * (ta.change(src) >= 0.0 ? 0.0 : src), length)
    mfi = 100.0 - (100.0 / (1.0 + upper / lower))
    mfi

plot(pine_mfi(hlc3, 14))

Returns the valueIndicators of cash flow

Parameters - series(series int/float) The series value to be executed. - What?length(series int) K number of lines (length).

See you later


### ta.kc

肯特纳通道。肯特那通道是一个技术指标,包含了中间的移动平均线以及上下轨的通道。

ta.kc(series, length, mult)


ta.kc(series, length, mult, useTrueRange)


**例子**
```pine
[middle, upper, lower] = ta.kc(close, 5, 4)
plot(middle, color=color.yellow)
plot(upper, color=color.yellow)
plot(lower, color=color.yellow)


// the same on pine
f_kc(src, length, mult, useTrueRange) =>
    float basis = ta.ema(src, length)
    float span = (useTrueRange) ? ta.tr : (high - low)
    float rangeEma = ta.ema(span, length)
    [basis, basis + rangeEma * mult, basis - rangeEma * mult]
    
[pineMiddle, pineUpper, pineLower] = f_kc(close, 5, 4, true)

plot(pineMiddle)
plot(pineUpper)
plot(pineLower)

Returns the valueThe Kenta Pass

Parameters - series(series int/float) The series value to be executed. - What?length(simple int) K number of lines (length). - What?mult(simple int/float) standard deviation - What?useTrueRange(simple bool) Optional parameter. Specifies whether to use a true range; default to true. If the value is false, the range is calculated using the expression ((high-low)).

See you later


### ta.kcw

肯特纳通道宽度。肯特那通道宽度是上,下通道之间的差除以中间通道的值。

ta.kcw(series, length, mult)


ta.kcw(series, length, mult, useTrueRange)


**例子**
```pine
plot(ta.kcw(close, 5, 4), color=color.yellow)

// the same on pine
f_kcw(src, length, mult, useTrueRange) =>
    float basis = ta.ema(src, length)
    float span = (useTrueRange) ? ta.tr : (high - low)
    float rangeEma = ta.ema(span, length)
    
    ((basis + rangeEma * mult) - (basis - rangeEma * mult)) / basis

plot(f_kcw(close, 5, 4, true))

Returns the valueThe width of the channel.

Parameters - series(series int/float) The series value to be executed. - What?length(simple int) K number of lines (length). - What?mult(simple int/float) standard deviation - What?useTrueRange(simple bool) Optional parameter. Specifies whether to use a true range; default to true. If the value is false, the range is calculated using the expression ((high-low)).

See you later


### ta.correlation

相关系数。描述两个系列倾向于偏离其ta.sma值的程度。

ta.correlation(source1, source2, length)


**返回值**
相关系数。

**参数**
- ```source1``` (series int/float) 源系列。
- ```source2``` (series int/float) 目标系列。
- ```length``` (series int) 长度(K线数量)

**另见**
```request.security```

### ta.cross

ta.cross(source1, source2)


**返回值**
如果两个系列相互交叉则为true,否则为false。

**参数**
- ```source1``` (series int/float) 第一数据系列。
- ```source2``` (series int/float) 第二数据系列。

**另见**
```ta.change```

### ta.crossover

`source1`-series被定义为跨越`source2`-series,如果在当前K线上,`source1`的值大于`source2`的值,并且在前一个K线上,`source2`的值source1`小于`source2`的值。

ta.crossover(source1, source2)


**返回值**
如果`source1`穿过`source2`则为true,否则为false。

**参数**
- ```source1``` (series int/float) 第一数据系列。
- ```source2``` (series int/float) 第二数据系列。

### ta.crossunder

`source1`-series 被定义为在 `source2`-series 下交叉,如果在当前K线上,`source1`的值小于`source2`的值,并且在前一根K线上,`source1`的值大于`source2`的值。

ta.crossunder(source1, source2)


**返回值**
如果`source1`在`source2`下交叉,则为true,否则为false。

**参数**
- ```source1``` (series int/float) 第一数据系列。
- ```source2``` (series int/float) 第二数据系列。

### ta.atr

函数ATR(真实波动幅度均值)返回真实范围的RMA。真实波动幅度是max(high - low, abs(high - close[1]), abs(low - close[1]))。

ta.atr(length)


**例子**
```pine
plot(ta.atr(14))

//the same on pine
pine_atr(length) =>
    trueRange = na(high[1])? high-low : math.max(math.max(high - low, math.abs(high - close[1])), math.abs(low - close[1]))
    //true range can be also calculated with ta.tr(true)
    ta.rma(trueRange, length)

plot(pine_atr(14))

Returns the valueThe mean of the true oscillation magnitude (ATR)

Parameterslength (simple int) length ((K number of lines)

See you later


### ta.sar

抛物线转向(抛物线停止和反向)是J. Welles Wilder, Jr.设计的方法,以找出交易市场价格方向的潜在逆转。

ta.sar(start, inc, max)


**例子**
```pine
plot(ta.sar(0.02, 0.02, 0.2), style=plot.style_cross, linewidth=3)

// The same on Pine
pine_sar(start, inc, max) =>
  var float result = na
  var float maxMin = na
  var float acceleration = na
  var bool isBelow = na
  bool isFirstTrendBar = false
  
  if bar_index == 1
    if close > close[1]
      isBelow := true
      maxMin := high
      result := low[1]
    else
      isBelow := false
      maxMin := low
      result := high[1]
    isFirstTrendBar := true
    acceleration := start
  
  result := result + acceleration * (maxMin - result)
  
  if isBelow
    if result > low
      isFirstTrendBar := true
      isBelow := false
      result := math.max(high, maxMin)
      maxMin := low
      acceleration := start
  else
    if result < high
      isFirstTrendBar := true
      isBelow := true
      result := math.min(low, maxMin)
      maxMin := high
      acceleration := start
      
  if not isFirstTrendBar
    if isBelow
      if high > maxMin
        maxMin := high
        acceleration := math.min(acceleration + inc, max)
    else
      if low < maxMin
        maxMin := low
        acceleration := math.min(acceleration + inc, max)
  
  if isBelow
    result := math.min(result, low[1])
    if bar_index > 1
      result := math.min(result, low[2])
    
  else
    result := math.max(result, high[1])
    if bar_index > 1
      result := math.max(result, high[2])
  
  result
  
plot(pine_sar(0.02, 0.02, 0.2), style=plot.style_cross, linewidth=3)

Returns the valueThe parallelized line turns towards the indicator.

Parameters - start(simple int/float) started. - What?inc(simple int/float) increases - What?max(simple int/float) is the largest.

ta.barssince

Calculate the number of k-strings from the last condition true.

ta.barssince(condition) 

Examples

// get number of bars since last color.green bar
plot(ta.barssince(close >= open))

Returns the valueIf the condition is true then the number of k strings is true.

NotesIf the condition is never satisfied before the current line K, the function returns na. Please note that using this variable/function may result in a redrawing of the indicator.

See you later


### ta.cum

`source` 的累积(全部的)总和。换句话说,它是`source`的所有元素的总和。

ta.cum(source)


**返回值**
系列总和。

**参数**
- ```source``` (series int/float)

**另见**
```math.sum```

### ta.dmi

dmi函数返回动向指数DMI。

ta.dmi(diLength, adxSmoothing)


**例子**
```pine
len = input.int(17, minval=1, title="DI Length")
lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50)
[diplus, diminus, adx] = ta.dmi(len, lensig)
plot(adx, color=color.red, title="ADX")
plot(diplus, color=color.blue, title="+DI")
plot(diminus, color=color.orange, title="-DI")

Returns the valueThe three components of the DMI series are: positive directional motion (+DI), negative directional motion (−DI) and average directional motion (ADX).

Parameters - diLength (simple int) DI Period。 - adxSmoothing(simple int) ADX smooth cycle

See you later


### ta.falling

测试 `source` 系列对于 `length` K线long是否正在下跌。

ta.falling(source, length)


**返回值**
如果当前 `source` 值小于 `length` K线返回的任何先前 `source` 值,则为true,否则为false。

**参数**
- ```source``` (series int/float) 待执行的系列值。
- ```length``` (series int) K线数量(长度).

**另见**
```ta.rising```

### ta.rising

测试 `source` 系列对于 `length` K线long是否正在上涨。

ta.rising(source, length)


**返回值**
如果当前 `source` 值大于 `length` K线返回的任何先前 `source` 值,则为true,否则为false。

**参数**
- ```source``` (series int/float) 待执行的系列值。
- ```length``` (series int) K线数量(长度).

**另见**
```ta.falling```

### ta.pivothigh

此函数返回枢轴高点的价格。 如果没有枢轴高点,则返回“NaN”。

ta.pivothigh(source, leftbars, rightbars)


ta.pivothigh(leftbars, rightbars)


**例子**
```pine
leftBars = input(2)
rightBars=input(2)
ph = ta.pivothigh(leftBars, rightBars)
plot(ph, style=plot.style_cross, linewidth=3, color= color.red, offset=-rightBars)

Returns the valueThe price at this point is either NaN.

Parameters - source(series int/float) Optional parameter↑ data sequence computed value↑ default value string High string↑ - What?leftbars(series int/float) - What?rightbars(series int/float) Right length.

NotesIf the parameter is leftbars or rightbars, you should use the max_bars_back function as the source bar.

ta.pivotlow

This function returns the price at the pivot lows. If there is no pivot lows, it returns NaN.

ta.pivotlow(source, leftbars, rightbars) 
ta.pivotlow(leftbars, rightbars) 

Examples

leftBars = input(2)
rightBars=input(2)
pl = ta.pivotlow(close, leftBars, rightBars)
plot(pl, style=plot.style_cross, linewidth=3, color= color.blue, offset=-rightBars)

Returns the valueThe price at this point is either NaN.

Parameters - source(series int/float) Optional parameter. The data series calculation value. The default is low. - What?leftbars(series int/float) - What?rightbars(series int/float) Right length.

NotesIf the parameter is leftbars or rightbars, you should use the max_bars_back function as the source bar.

ta.highest

The highest value of a given number of past k lines.

ta.highest(source, length) 
ta.highest(length) 

Returns the valueThe highest value in the series.

Parameters - source(series int/float) The series value to be executed. - What?length(series int) K number of lines (length).

NotesTwo versions of args:sourceIt's a series.lengthis the number of returned k lines. A version of arg:lengthis the number of k lines returned. The algorithm uses high as thesourceThe series.

See you later


### ta.highestbars

过去k线的给定数目的最高值偏移。

ta.highestbars(source, length)


ta.highestbars(length)


**返回值**
偏移到最高k线。

**参数**
- ```source``` (series int/float) 待执行的系列值。
- ```length``` (series int) K线数量(长度).

**备注**
两个 args 版本:`source` 是一个系列,`length` 是返回的K线数。
一个 arg 版本:`length` 是返回的K线数。算法使用high作为 `source` 系列。

**另见**
```ta.lowest``` ```ta.highest``` ```ta.lowestbars``` ```ta.barssince``` ```ta.valuewhen```

### ta.stoch

随机指标。计算方程:100 * (close - lowest(low, length)) / (highest(high, length) - lowest(low, length))。

ta.stoch(source, high, low, length)


**返回值**
随机

**参数**
- ```source``` (series int/float) 源系列。
- ```high``` (series int/float) 高系列
- ```low``` (series int/float) 低系列
- ```length``` (series int) 长度(K线数量)

**另见**
```ta.cog```

### ta.supertrend

超级趋势指标。超级趋势指标是一个跟随趋势的指标。

ta.supertrend(factor, atrPeriod)


**例子**

```pine
//@version=5
indicator("Pine Script™ Supertrend")

[supertrend, direction] = ta.supertrend(3, 10)
plot(direction < 0 ? supertrend : na, "Up direction", color = color.green, style=plot.style_linebr)
plot(direction > 0 ? supertrend : na, "Down direction", color = color.red, style=plot.style_linebr)

// The same on Pine Script™
pine_supertrend(factor, atrPeriod) =>
  src = hl2
  atr = ta.atr(atrPeriod)
  upperBand = src + factor * atr
  lowerBand = src - factor * atr
  prevLowerBand = nz(lowerBand[1])
  prevUpperBand = nz(upperBand[1])

  lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ? lowerBand : prevLowerBand
  upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ? upperBand : prevUpperBand
  int direction = na
  float superTrend = na
  prevSuperTrend = superTrend[1]
  if na(atr[1])
    direction := 1
  else if prevSuperTrend == prevUpperBand
    direction := close > upperBand ? -1 : 1
  else
    direction := close < lowerBand ? 1 : -1
  superTrend := direction == -1 ? lowerBand : upperBand
  [superTrend, direction]

[pineSupertrend, pineDirection] = pine_supertrend(3, 10)
plot(pineDirection < 0 ? pineSupertrend : na, "Up direction", color = color.green, style=plot.style_linebr)
plot(pineDirection > 0 ? pineSupertrend : na, "Down direction", color = color.red, style=plot.style_linebr)

Returns the valueThe components of the two supertrend series are: supertrend lines and trend directions. Possible values are 1 (downward) and -1 (upward).

Parameters - factor(series int/float) The number of times ATR will be multiplied. - What?atrPeriod(simple int) The mean real wavelength

See you later


### ta.lowest

过去k线的给定数目的最低值。

ta.lowest(source, length)


ta.lowest(length)


**返回值**
系列中的最低值。

**参数**
- ```source``` (series int/float) 待执行的系列值。
- ```length``` (series int) K线数量(长度).

**备注**
两个 args 版本:`source` 是一个系列,`length` 是返回的K线数。
一个 arg 版本:`length` 是返回的K线数。算法使用low作为`source`系列。

**另见**
```ta.highest``` ```ta.lowestbars``` ```ta.highestbars``` ```ta.valuewhen``` ```ta.barssince```

### ta.lowestbars

过去k线的给定数目的最低值偏移。

ta.lowestbars(source, length)


ta.lowestbars(length)


**返回值**
偏移到最低k线。

**参数**
- ```source``` (series int/float) 待执行的系列值。
- ```length``` (series int) 返回K线数。

**备注**
两个 args 版本:`source` 是一个系列,`length` 是返回的K线数。
一个 arg 版本:`length` 是返回的K线数。算法使用low作为`source`系列。

**另见**
```ta.lowest``` ```ta.highest``` ```ta.highestbars``` ```ta.barssince``` ```ta.valuewhen```

### ta.valuewhen

返回第n次最近出现的“condition”为true的K线的“source”系列值。

ta.valuewhen(condition, source, occurrence)


**例子**
```pine
slow = ta.sma(close, 7)
fast = ta.sma(close, 14)
// Get value of `close` on second most recent cross
plot(ta.valuewhen(ta.cross(slow, fast), close, 1))

Parameters - condition(series bool) The conditions to be searched. - What?source(series int/float/bool/color) Returns the value from the line K that satisfies the condition. - What?occurrence(simple int) condition occurs. The number starts at 0 and goes backwards in time, so 0 is the most recently occurring condition , 1 is the second most recently occurring , and so on.

NotesThis function needs to be executed on every K line. It is not recommended to use it in for or while loop structures, as its behavior may be unexpected. Please note that using this function may cause indicators to be redrawn.

See you later


### ta.vwap

成交量加权平均价格

ta.vwap(source)


**返回值**
成交量加权平均

**参数**
- ```source``` (series int/float) 源系列。

**另见**
```ta.vwap```

### ta.vwma

vwma 函数返回 `length` K线的 `source` 的成交量加权移动平均值。等同于:sma(source * volume, length) / sma(volume, length)。

ta.vwma(source, length)


**例子**
```pine
plot(ta.vwma(close, 15))

// same on pine, but less efficient
pine_vwma(x, y) =>
    ta.sma(x * volume, y) / ta.sma(volume, y)
plot(pine_vwma(close, 15))

Returns the value lengthThe K line returnssourceThe number of transactions multiplied by the weighted moving average.

Parameters - source(series int/float) The series value to be executed. - What?length(series int) K number of lines (length).

See you later


### ta.wpr

威廉姆斯指标Williams %R。。该振荡指标显示当前收盘价与过去“一段时间内”的高/低价之间的关系。

ta.wpr(length)


**例子**
```pine
plot(ta.wpr(14), title="%R", color=color.new(#ff6d00, 0))

Returns the value Williams %R。

Parameters - length(series int) K number of lines.

See you later


## plot

### plot

在图表上绘制一系列数据。

plot(series, title, color, linewidth, style, trackprice, histbase, offset, join, editable, show_last, display)


**例子**
```pine
plot(high+low, title='Title', color=color.new(#00ffaa, 70), linewidth=2, style=plot.style_area, offset=15, trackprice=true)

// You may fill the background between any two plots with a fill() function:
p1 = plot(open)
p2 = plot(close)
fill(p1, p2, color=color.new(color.green, 90))

Returns the valueDrawing objects that can be used to fill.

Parameters - series(series int/float) The data series to be drawn. - What?title(const string) Drawing title. - What?color(series color) The color of the drawing. You can use a color constant such as color = red or color = #ff001a and complex expressions such as color = close >= open? green : red. Optional parameters. - What?linewidth(input int) Width of drawing line. The default value is 1; not applicable to all styles. - What?style(plot_style) plot type. Possible values are plot.style_line, plot.style_stepline, plot.style_stepline, plot.style_histogram, plot.style_cross, plot.style_area, plot.style_columns, plot.style_circles, plot.style_linebr, plot.style_areabr. The default value is plot.style_line. - What?trackprice(input bool) If true, the horizontal price line will be displayed at the level of the last indicator value. - What?histbase(input int/float) When drawing a graph in the plot.style_histogram, plot.style_columns or plot.style_area style, the value of the reference level is used. The default value is 0.0. - What?offset(series int) Moves left or right on a certain number of k lines. Default is 0. - What?join(input bool) If true, the drawing point will be connected to the line, only for plot.style_cross and plot.style_circles styles. The default is false. - What?editable(const bool) If true, the drawing style can be edited in the format dialog box. The default is true. - What?show_last(input int) If set, defines the number of k-strings drawn on the graph ((returns past from last k-string) ). - What?display(plot_display) Controls the position of the drawing. Possible values are: display.none、display.all. The default is display.all. - What?overlay(const bool) A parameter of the FMZ platform extension used to set the current function in the main diagram (set true) or subgraph (set false).strategyOrindicatorThe insideoverlayThe parameters are set.strategyOrindicatorNo settingsoverlayParameters are processed according to the default parameters.

See you later


### plotshape

在图表上绘制可视形状。

plotshape(series, title, style, location, color, offset, text, textcolor, editable, size, show_last, display)


**例子**
```pine
data = close >= open
plotshape(data, style=shape.xcross)

Parameters - series(series bool) A series of data plotted as a shape. Except for location.absolute, the series is treated as a set of Boolean values for all location values. Necessary parameters. - What?title(const string) Drawing title. - What?style(input string) Drawing type. Possible values are shape.xcross, shape.cross, shape.triangleup, shape.triangledown, shape.flag, shape.circle, shape.arrowup, shape.arrowdown, shape.labelup, shape.labeldown, shape.square, shape.diamond. The default value is shape.xcross. - What?location(input string) shape is the location on the chart. Possible values are location.abovebar, location.belowbar, location.top, location.bottom, location.absolute. The default value is location.abovebar. - What?color(series color) shaped colors. You can use a color constant such as color = red or color = #ff001a and complex expressions such as color = close >= open? green : red. Optional parameters. - What?offset(series int) a left or right moving shape over a specified number of k lines. The default value is 0. - What?text(const string) The text is displayed as a shape. You can use multiple lines of text, separated by a string of consonants. Example: consonant line one consonant line two. - What?textcolor(series color) The color of the text. You can use constants such as textcolor=red or textcolor=#ff001a, as well as complex expressions such as textcolor = close >= open? green : red. Optional parameters. - What?editable(const bool) If true, the plotshape style can be edited in the format dialog box. The default is true. - What?show_last(input int) If set, defines the number of shapes drawn on the graph ((from the last k-line backwards)); - What?size(const string) Character size in the chart. Possible values are size.auto, size.tiny, size.small, size.normal, size.large, size.huge. The default is size.auto. - What?display(plot_display) Controls the position of the drawing. Possible values are: display.none、display.all. The default is display.all. - What?overlay(const bool) A parameter of the FMZ platform extension used to set the current function in the main diagram (set true) or subgraph (set false).strategyOrindicatorThe insideoverlayThe parameters are set.strategyOrindicatorNo settingsoverlayParameters are processed according to the default parameters.

See you later


### plotchar

在图表上使用任何给定的Unicode字符绘制可视形状。

plotchar(series, title, char, location, color, offset, text, textcolor, editable, size, show_last, display)


**例子**
```pine
data = close >= open
plotchar(data, char='❄')

Parameters - series(series bool) A series of data plotted as a shape. Except for location.absolute, the series is treated as a set of Boolean values for all location values. Necessary parameters. - What?title(const string) Drawing title. - What?char(input string) Characters used as visual shapes - What?location(input string) shape is the location on the chart. Possible values are location.abovebar, location.belowbar, location.top, location.bottom, location.absolute. The default value is location.abovebar. - What?color(series color) shaped colors. You can use a color constant such as color = red or color = #ff001a and complex expressions such as color = close >= open? green : red. Optional parameters. - What?offset(series int) a left or right moving shape over a specified number of k lines. The default value is 0. - What?text(const string) The text is displayed as a shape. You can use multiple lines of text, separated by a string of consonants. Example: consonant line one consonant line two. - What?textcolor(series color) The color of the text. You can use constants such as textcolor=red or textcolor=#ff001a, as well as complex expressions such as textcolor = close >= open? green : red. Optional parameters. - What?editable(const bool) If true, the plotchar style can be edited in the format dialog box. The default is true. - What?show_last(input int) If set, defines the number of graphs drawn on the graph ((from the last k-line backwards)); - What?size(const string) Character size in the chart. The value may be: size.auto, size.tiny, size.small, size.normal, size.large, size.huge. - What?display(plot_display) Controls the position of the drawing. Possible values are: display.none、display.all. The default is display.all. - What?overlay(const bool) A parameter of the FMZ platform extension used to set the current function in the main diagram (set true) or subgraph (set false).strategyOrindicatorThe insideoverlayThe parameters are set.strategyOrindicatorNo settingsoverlayParameters are processed according to the default parameters.

See you later


### plotcandle

在图表上绘制蜡烛。

plotcandle(open, high, low, close, title, color, wickcolor, editable, show_last, bordercolor, display)


**例子**
```pine
indicator("plotcandle example", overlay=true)
plotcandle(open, high, low, close, title='Title', color = open < close ? color.green : color.red, wickcolor=color.black)

Parameters - open(series int/float) Data open series are used as float open values. - What?high(series int/float) High-series data is used as the high value of the array. - What?low(series int/float) Low-series data is used as the low value of the array. - What?close(series int/float) Close the series data as a value to close the k-string. - What?title(const string) plotcandle title. Optional parameters. - What?color(series color) The color of the onion. You can use a constant of the onion such as onioncolor = red onion or onioncolor = #ff001a and complex expressions such as onioncolor = close >= open? green : red onion. Optional parameters. - What?wickcolor(series color) The color of the incandescent lamp head. - What?editable(const bool) If true, the plotcandle style can be edited in the format dialog box. The default is true. - What?show_last(input int) If set, defines the number of cubes plotted on the graph ((from the last k-line backwards)); - What?bordercolor(series colour) The colour of the border of the grid. - What?display(plot_display) Controls the position of the drawing. Possible values are: display.none、display.all. The default is display.all. - What?overlay(const bool) A parameter of the FMZ platform extension used to set the current function in the main diagram (set true) or subgraph (set false).strategyOrindicatorThe insideoverlayThe parameters are set.strategyOrindicatorNo settingsoverlayParameters are processed according to the default parameters.

NotesIf the slope is NaN, then the K line need not be shown. The maximum value of open, high, low, and receive will be set to high and low, and the minimum value will be set to low and high.

See you later


### plotarrow

在图表上绘制向上和向下箭头:向上箭头绘制在每个正值指示器上,而向下箭头绘制在每个负值上。 如果指标返回na,则不会绘制箭头。 箭头具有不同的高度,指标的绝对值越大,绘制箭头越长。

plotarrow(series, title, colorup, colordown, offset, minheight, maxheight, editable, show_last, display)


**例子**

codiff = close - open plotarrow(codiff, colorup=color.new(color.teal,40), colordown=color.new(color.orange, 40), overlay=true)


**参数**
- ```series``` (series int/float) 要绘制成箭头的数据系列。 必要参数。
- ```title``` (const string) 绘图标题。
- ```colorup``` (series color) 向上箭头的颜色。可选参数。
- ```colordown``` (series color) 向下箭头的颜色。可选参数。
- ```offset``` (series int) 在K线特定数量上向左或向右移动箭头。 默认值为0。
- ```minheight``` (input int) 以像素为单位最小可能的箭头高度。默认值为5。
- ```maxheight``` (input int) 以像素为单位的最大可能的箭头高度。默认值为100
- ```editable``` (const bool) 如果为true,则plotarrow样式可在格式对话框中编辑。 默认值为true。
- ```show_last``` (input int) 如已设置,则定义在图表上绘制的箭数(从最后k线返回过去)。
- ```display``` (plot_display) 控制显示绘图的位置。可能的值为:display.none、display.all。预设值为display.all。
- ```overlay``` (const bool) FMZ平台扩展的参数,用于设置当前函数在主图(设置true)或者副图(设置false)上画图显示,默认值为false。不指定该参数则按照```strategy```或者```indicator```中的```overlay```参数设置,```strategy```或者```indicator```没有设置```overlay```参数,则按照默认参数处理。

**另见**
```plot``` ```plotshape``` ```plotchar``` ```barcolor``` ```bgcolor```

## array

### array.pop

该函数从阵列中删除最后一个元素并返回其值。

```array.pop(id)```

例子
```pine
// array.pop example
a = array.new_float(5,high)
removedEl = array.pop(a)
plot(array.size(a))
plot(removedEl)

Returns the valueThe value of the deleted element.

Parameters - id(any array type) Array object.

See you later


### array.shift

该函数删除阵列的第一个元素并返回其值。

```array.shift(id)```

**例子**
```pine
// array.shift example
a = array.new_float(5,high)
removedEl = array.shift(a)
plot(array.size(a))
plot(removedEl)

Returns the valueThe value of the deleted element.

Parameters - id(any array type) Array object.

See you later


### array.unshift

该函数将值插入阵列的初始位置。

```array.unshift(id, value)```

**例子**
```pine
// array.unshift example
a = array.new_float(5, 0)
array.unshift(a, open)
plot(array.get(a, 0))

Parameters - id(any array type) Array object. - What?value (series <type of the array's elements>) to be added to the value at the initial position of the array.

See you later


### array.size

该函数返回阵列中元素的数量。

```array.size(id)```

**例子**
```pine
// array.size example
a = array.new_float(0)
for i = 0 to 9
    array.push(a, close[i])
// note that changes in slice also modify original array
slice = array.slice(a, 0, 5)
array.push(slice, open)
// size was changed in slice and in original array
plot(array.size(a))
plot(array.size(slice))

Returns the valueThe number of elements in the array.

Parameters - id(any array type) Array object.

See you later


### array.slice

该函数从现有阵列创建分片。如果分片中的对象发生更改,则更改将同时应用于新阵列和原始阵列。

array.slice(id, index_from, index_to)


**例子**
```pine
// array.slice example
a = array.new_float(0)
for i = 0 to 9
    array.push(a, close[i])
// take elements from 0 to 4
// *note that changes in slice also modify original array 
slice = array.slice(a, 0, 5)
plot(array.sum(a) / 10)
plot(array.sum(slice) / 5)

Returns the valueA shallow copy of an array of fragments.

Parameters - id(any array type) Array object. - What?index_from(series int) To start extracting from an index starting from zero. - What?index_to(series int) An index starting from zero before the extraction is complete. The function extracts the elements before this index.

See you later


### array.abs

返回一个阵列,其中包含原始阵列中每个元素的绝对值。

array.abs(id)


**参数**
- ```id``` (int[]/float[]) 阵列对象。

**另见**
```array.new_float``` ```array.insert``` ```array.slice``` ```array.reverse``` ```order.ascending``` ```order.descending```

### array.binary_search

该函数返回值的索引,如果未找到该值,则返回-1。要搜索的阵列必须按升序排序。

array.binary_search(id, val)


**例子**
```pine
// array.binary_search
a = array.from(5, -2, 0, 9, 1)
array.sort(a) // [-2, 0, 1, 5, 9]
position = array.binary_search(a, 0) // 1
plot(position)

Parameters - id(int[]/float[]) array objects. - What?val(series int/float) The value to be searched in the array.

NotesBinary search is used for arrays that have been pre-ordered in ascending order. It first compares the element in the middle of the array with the target value. If the element matches the target value, it returns its position in the array. If the value of the element is greater than the target value, the search continues in the lower half of the array. If the value of the element is less than the target value, the search continues in the upper half of the array.

See you later


### array.binary_search_leftmost

如果找到值,该函数将返回该值的索引。当未找到值时,该函数返回下一个最小元素的索引,如果它在阵列中,则在值所在位置的左侧。要搜索的阵列必须按升序排序。

array.binary_search_leftmost(id, val)


**例子**
```pine
// array.binary_search_leftmost
a = array.from(5, -2, 0, 9, 1)
array.sort(a) // [-2, 0, 1, 5, 9]
position = array.binary_search_leftmost(a, 3) // 2
plot(position)

Parameters - id(int[]/float[]) array objects. - What?val(series int/float) The value to be searched in the array.

NotesBinary search is used for arrays that have been pre-ordered in ascending order. It first compares the element in the middle of the array with the target value. If the element matches the target value, it returns its position in the array. If the value of the element is greater than the target value, the search continues in the lower half of the array. If the value of the element is less than the target value, the search continues in the upper half of the array.

See you later


### array.binary_search_rightmost

如果找到该值,该函数将返回该值的索引。当未找到该值时,该函数返回该值在阵列中所在位置右侧的元素的索引。阵列必须按升序排序。

array.binary_search_rightmost(id, val)


**例子**
```pine
// array.binary_search_rightmost
a = array.from(5, -2, 0, 9, 1)
array.sort(a) // [-2, 0, 1, 5, 9]
position = array.binary_search_rightmost(a, 3) // 3
plot(position)

Parameters - id(int[]/float[]) array objects. - What?val(series int/float) The value to be searched in the array.

NotesBinary search works on an array that has been sorted in ascending order. It first compares the element in the middle of the array to the target value. If the element matches the target value, it returns its position in the array. If the element's value is greater than the target value, the search continues in the lower half of the array. If the element's value is less than the target value, the search continues in the upper half of the array.

See you later


### array.sort

该函数对阵列的元素进行排序。

array.sort(id, order)


**例子**
```pine
// array.sort example
a = array.new_float(0,0)
for i = 0 to 5
    array.push(a, high[i])
array.sort(a, order.descending)
if barstate.islast
    runtime.log(str.tostring(a))

Parameters - id(int[]/float[]/string[]) Array objects are also used. - What?order(sort_order) Sort order: order.ascending (default) or order.descending.

See you later


### array.sort_indices

返回一个索引阵列,当用于索引原始阵列时,将按其排序顺序访问其元素。它不会修改原始阵列。

array.sort_indices(id, order)


**例子**
```pine
// array.sort_indices
a = array.from(5, -2, 0, 9, 1)
sortedIndices = array.sort_indices(a) // [1, 2, 4, 0, 3]
indexOfSmallestValue = array.get(sortedIndices, 0) // 1
smallestValue = array.get(a, indexOfSmallestValue) // -2
plot(smallestValue)

Parameters - id(int[]/float[]/string[]) Array objects are also used. - What?order(sort_order) Sort order: order.ascending or order.descending。 optional。 the default is order.ascending。

See you later


### array.clear

该函数从阵列中删除所有元素。

array.clear(id)


**例子**
```pine
// array.clear example
a = array.new_float(5,high)
array.clear(a)
array.push(a, close)
plot(array.get(a,0))
plot(array.size(a))

Parameters - id(any array type) Array object.

See you later


### array.concat

该函数用于合并两个阵列。它将所有元素从第二个阵列推送到第一个阵列,然后返回第一个阵列。

array.concat(id1, id2)


**例子**
```pine
// array.concat example
a = array.new_float(0,0)
b = array.new_float(0,0)
for i = 0 to 4
    array.push(a, high[i])
    array.push(b, low[i])
c = array.concat(a,b)
plot(array.size(a))
plot(array.size(b))
plot(array.size(c))

Returns the valueThe first array has a composite element from the second array.

Parameters - id1(any array type) The first array object. - What?id2(any array type) The second array object.

See you later


### array.copy

该函数创建现有阵列的副本。

array.copy(id)


**例子**
```pine
// array.copy example
length = 5
a = array.new_float(length, close)
b = array.copy(a)
a := array.new_float(length, open)
plot(array.sum(a) / length)
plot(array.sum(b) / length)

Returns the valueA copy of the array.

Parameters - id(any array type) Array object.

See you later


### array.stdev

该函数返回阵列元素的标准差。

array.stdev(id, biased)


**例子**
```pine
// array.stdev example
a = array.new_float(0)
for i = 0 to 9
    array.push(a, close[i])
plot(array.stdev(a))

Returns the valueThe standard deviation of array elements.

Parameters - id(int[]/float[]) array objects. - What?biased(series bool) Determines which estimate should be used. Optional. Default is true.

NotesWhat ifbiasedIf true, the function will calculate using biased estimates of the total, if false - biased estimates of the sample.

See you later


### array.standardize

该函数返回标准化元素的阵列。

array.standardize(id)


**例子**
```pine
// array.standardize example
a = array.new_float(0)
for i = 0 to 9
    array.push(a, close[i])
b = array.standardize(a)
plot(array.min(b))
plot(array.max(b))

Returns the valueArray of standardized elements.

Parameters - id(int[]/float[]) array objects.

See you later


### array.variance

该函数返回阵列元素的方差。

array.variance(id, biased)


**例子**
```pine
// array.variance example
a = array.new_float(0)
for i = 0 to 9
    array.push(a, close[i])
plot(array.variance(a))

Returns the valueThe square of the element of the array.

Parameters - id(int[]/float[]) array objects. - What?biased(series bool) Determines which estimate should be used. Optional. Default is true.

NotesWhat ifbiasedIf true, the function will calculate using biased estimates of the total, if false - biased estimates of the sample.

See you later


### array.covariance

该函数返回两个阵列的协方差。

array.covariance(id1, id2, biased)


**例子**
```pine
// array.covariance example
a = array.new_float(0)
b = array.new_float(0)
for i = 0 to 9
    array.push(a, close[i])
    array.push(b, open[i])
plot(array.covariance(a, b))

Returns the valueThe two arrays have a cosine difference.

Parameters - id1(int[]/float[]) array objects. - What?id2(int[]/float[]) array objects. - What?biased(series bool) Determines which estimate should be used. Optional. Default is true.

NotesWhat ifbiasedIf true, the function will calculate using biased estimates of the total, if false - biased estimates of the sample.

See you later


### array.fill

该函数将阵列的元素设置为单个值。如果未指定索引,则设置所有元素。如果仅提供起始索引(默认为0),则设置从该索引开始的元素。如果同时使用两个索引参数,则会设置从开始索引到但不包括结束索引的元素(默认值为na)。

array.fill(id, value, index_from, index_to)


**例子**
```pine
// array.fill example
a = array.new_float(10)
array.fill(a, close)
plot(array.sum(a))

Parameters - id(any array type) Array object. - What?value (series <type of the array's elements>) is used to fill the value of the array. - What?index_from(series int) starts the index as 0//. - What?index_to(series int) terminates the index, assuming by default that na. must be greater than the index of the last element to be set.

See you later


### array.includes

如果在阵列中找到该值,则该函数返回true,否则返回false。

array.includes(id, value)


**例子**
```pine
// array.includes example
a = array.new_float(5,high)
p = close
if array.includes(a, high)
    p := open
plot(p)

Returns the valueIf the value is found in the array, it is true, otherwise it is false.

Parameters - id(any array type) Array object. - What?value (series <type of the array's elements>The value to be searched in the array.

See you later


### array.insert

该函数通过在适当位置添加新元素来更改阵列的内容。

array.insert(id, index, value)


**例子**
```pine
// array.insert example
a = array.new_float(5, close)
array.insert(a, 0, open)
plot(array.get(a, 5))

Parameters - id(any array type) Array object. - What?index(series int) is the index to which the value is inserted. - What?value (series <type of the array's elements>) to be added to the array.

See you later


### array.join

该函数通过连接阵列的所有元素来建立并返回新字符串,用指定的分隔符字符串分隔。

array.join(id, separator)


**例子**
```pine
// array.join example
a = array.new_float(5, 5)
runtime.log(array.join(a, ","))

Parameters - id(int[]/float[]/string[]) Array objects are also used. - What?separator(series string) A string used to separate each array element.

See you later


### array.lastindexof

此函数返回值最后一次出现的索引。如果找不到该值,则返回 -1。

array.lastindexof(id, value)


**例子**
```pine
// array.lastindexof example
a = array.new_float(5,high)
index = array.lastindexof(a, high)
plot(index)

Returns the valueThe index of the element.

Parameters - id(any array type) Array object. - What?value (series <type of the array's elements>The value to be searched in the array.

See you later


### array.max

该函数返回最大值,或给定阵列中的第n个最大值。

array.max(id, nth)


**例子**
```pine
// array.max
a = array.from(5, -2, 0, 9, 1)
secondHighest = array.max(a, 2) // 1
plot(secondHighest)

Returns the valueThe largest value in the array, or the nth largest value.

Parameters - id(int[]/float[]) array objects. - What?nth(series int) returns the nth largest value, where 0 is the largest. Optional. Default null.

See you later


### array.min

该函数返回最小值,或给定序列中的第n个最小值。

array.min(id, nth)


**例子**
```pine
// array.min
a = array.from(5, -2, 0, 9, 1)
secondLowest = array.min(a, 1) // 0
plot(secondLowest)

Returns the valueThe smallest value in the array, or the nth smallest value.

Parameters - id(int[]/float[]) array objects. - What?nth(series int) The first n-minimum value to be returned, where 0 is the minimum. Optional. Default null.

See you later


### array.median

该函数返回阵列元素的中位数。

array.median(id)


**例子**
```pine
// array.median example
a = array.new_float(0)
for i = 0 to 9
    array.push(a, close[i])
plot(array.median(a))

More

wuhuoyanHow do you do it if you want to have multiple transactions running simultaneously?

Light cloudsPlease tell me, can pine do more transactions? Can it also go through transactions like JS? Thank you.

lisa20231Thank you for providing detailed documentation.

artistryWow! How does this pine script use the okex simulation on the platform?

artistryThis is equivalent to copying the tradingview platform's strategy directly to the inventor platform and using it!

Inventors quantify - small dreamsThe PINE language can only do single-variety strategies, multi-variety strategies are best written in python, javascript, c++.

Inventors quantify - small dreamsOh, yes, OKX is special, their analog environment and the real disk environment have the same address, only the difference is made elsewhere.

Light cloudsI can't use the okx analogue disc.

Inventors quantify - small dreamsThis multi-variety architecture problem cannot be solved, because each exchange has a different interface, and the frequency limitation of the interface is not the same, which causes many problems.

Inventors quantify - small dreamsWell, thank you for the suggestion, please report this request here.

Light cloudsIt feels better to be able to mix with JS and JS can be better adapted to different trading methods.

The trend hunterIn the future, will we consider more varieties?

Inventors quantify - small dreamsI'm not being polite.

Light cloudsGood, thank you very much.

Inventors quantify - small dreamsHello, the PINE language policy is currently only for single varieties.

Inventors quantify - small dreamsThank you for your support. The documentation will continue to be improved.

Inventors quantify - small dreamsYes, I did.

Inventors quantify - small dreamsPINE template library, where parameters can be set to switch exchange base addresses.